Idea: partially pure functions

Bruno Medeiros brunodomedeiros+spam at com.gmail
Fri May 2 03:29:06 PDT 2008


Steven Schveighoffer wrote:
> "Bruno Medeiros" wrote
>>> I guess it all depends on what you consider partially pure :)  I believe 
>>> the current rules as stated on D's website require invariant return data, 
>>> or data that can be implicitly cast to invariant.
>> In Andrei's latest presentation 
>> (http://www.digitalmars.com/d/2.0/accu-functional.pdf)
>> when he lists the requirements for pure, it does not say that is should 
>> return invariant data. (and I'm assuming those requirements are complete)
> 
> Those requirements are not complete.  For instance, the web site says that 
> pure functions can call new expressions, but that is not stated in the pdf 
> (or at least, I don't remember seeing it).  I think it will eventually be 
> stated that pure functions initially will have to return invariant data, or 
> data that can be implicitly cast to invariant.  Unless I can convince Andrei 
> otherwise :)
> 
> -Steve 
> 
> 

It's not stated in the pdf "that pure functions can call new 
expressions" because it only states what pure functions *cannot* do. 
What they can do is everything else. So new expressions are allowed 
(likely following the same rules as function calling, ie, only pure 
constructors are allowed).

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list