Re: Pure and higher-order functions

2012-02-24 Thread mist
Ok, finally understood. I was trying to declare hof like this: void f2( pure int function() param ) , similar to the way I declare usual pure functions. Looks like it is syntax error and only void f2( int function() pure param ) is allowed. That led me to false conclusion, that such

Re: Pure and higher-order functions

2012-02-24 Thread bearophile
mist: Are there any reasons for this inconsistency? I don't know. Maybe it's just a parser bug. There are some of those in Bugzilla. If you don't like it, then I suggest you to add it to D Bugzilla. Bye, bearophile

Re: Pure and higher-order functions

2012-02-24 Thread mist
Actually, looks like you have done it already 2 years ago :) http://d.puremagic.com/issues/show_bug.cgi?id=4505

Pure and higher-order functions

2012-02-23 Thread mist
Hello! I have been asked few question recently from a Haskell programmer about D2 and, after experimenting a bit, have found that I really can't provide a good answe myself, as I am not getting a design limititations (if any). Here is the snippet, it is pretty self-descriptive:

Re: Pure and higher-order functions

2012-02-23 Thread deadalnix
Le 23/02/2012 21:00, mist a écrit : Hello! I have been asked few question recently from a Haskell programmer about D2 and, after experimenting a bit, have found that I really can't provide a good answe myself, as I am not getting a design limititations (if any). Here is the snippet, it is

Re: Pure and higher-order functions

2012-02-23 Thread mist
But is there any way to actually say D compiler that I want this function to accept only pure delegates?

Re: Pure and higher-order functions

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 21:17:46 mist wrote: But is there any way to actually say D compiler that I want this function to accept only pure delegates? Mark the delegate type that it accepts as pure. - Jonathan M Davis