Hardware-driven language design

Timon Gehr timon.gehr at gmx.ch
Sun Jun 5 07:55:40 PDT 2011


On Reddit I have just found a thread about a paper that I didn't know:
http://www.reddit.com/r/programming/comments/hs24h/programming_language_design_and_analysis/

The paper "Programming Language Design and Analysis motivated by Hardware
Evolution" by Alan Mycroft, 2007:
http://www.cl.cam.ac.uk/~am21/papers/sas07final.pdf
beaorphile wrote:
> The slides:
> http://www.cl.cam.ac.uk/~am21/papers/sas07slides.pdf
>
> In the slides the part I find more interesting for language design is pages > 28-35.
>
> In slide 31 it shows the syntax:
> void foo(Q @p) {...
>
> This means "use either CBV or CBR but reject the body of f if it does
> anything which can tell the difference" (Functions needing CBR or CBV can
> have it, but CBEWE allows late binding of physical distribution.)
> [snip.]

I think D has this (if Q is a value type). Isn't @ just a fancy way to signal that
p is immutable?

So in D, this would look like
void foo(immutable Q p);

Given that signature, the compiler can effectively decide whether to use CBV or
CBR iff Q is a value type. It does not work that well for Ds reference types
(because you cannot pass them by value obv.).


Timon


More information about the Digitalmars-d mailing list