On Sunday, 25 July 2010 at 14:10:10 UTC, Simen kjaeraas wrote:
Update: Members of FunctionAttribute have been renamed from
uppercase to lowercase and when needed an underscore has been
added to the enumerators that conflict with keywords such as:
PURE has been renamed to pure_
On Sunday, 25 July 2010 at 14:10:10 UTC, Simen kjaeraas wrote:
bearophile bearophileh...@lycos.com wrote:
I suggest all people in all D newsgroups, to write code that
runs, not uncompilable snippets. All errors in the last
Walter's talk can be avoided in few minutes running the code.
In
bearophile bearophileh...@lycos.com wrote:
But a bigger problem is that I can't see a way to define a conditionally
pure templated function, for example a map() that is pure if the given
function pointer is pure, and is not pure otherwise:
This is fairly simple currently:
template map(
Simen kjaeraas:
This is fairly simple currently:
template map( alias fn ) { // blah blah blah, whatever is necessary here
static if ( isPure!fn ) {
pure map( Range )( Range r ) { ... }
} else {
auto map( Range )( Range r ) { ... }
}
}
Do you mean code
bearophile bearophileh...@lycos.com wrote:
Simen kjaeraas:
This is fairly simple currently:
[snip]
Do you mean code like this (this doesn't work yet)?
[snip]
Yeah.
I suggest all people in all D newsgroups, to write code that runs, not
uncompilable snippets. All errors in the last
I think that some years from now, in situations where D will be used used in
functional-style programming, the pure attribute for functions will be
important and useful.
In functional-style programming you often use Higher-Order Functions like map,
filter and reduce. So it can be quite