DMD 1.038 and 2.022 releases
Robert Jacques
sandford at jhu.edu
Tue Dec 16 09:58:47 PST 2008
On Mon, 15 Dec 2008 17:48:21 -0500, mastrost <titi.mastro at free.fr> wrote:
> int delegate() getPureFunction(int x){
> int bar(){
> return x;
> }
> return &bar;
> }
int delegate() getPureFunction(int x){
int bar(){
return x++; // no longer pure
}
return &bar;
}
> In this example, myPureFunction looks like a pure function, does it?
No it doesn't, but on the other hand, pure member functions argue that
pure delegates are reasonable and useful. (i.e. delegates tagged as pure
and then checked for references to non-pure data)
> This was my first question. The second one concerns purity and parallel
> programming. Is dmd 2.022 implementing some kind of parallelism thanks
> to pure
> function? In fact I have been argued that "pure" keyword is not enough
> for the
> compiler to make an efficient parallel program. The problem would be
> that the
> compiler has no mean to know the granularity of the tasks. What are your
> feelings
> about that?
I'd say that you're unlikely to get an optimal parallel program, but there
already exists several functional languages (i.e. pure) that automatically
parallelize their code bases quite efficiently.
More information about the Digitalmars-d-announce
mailing list