D - Anonymous functions?
- Andy Friesen (13/13) Feb 01 2003 Basically, some syntactic sugar for small functions that are only needed...
-
Carlos Santander B.
(52/52)
Feb 01 2003
"Andy Friesen"
escribió en el mensaje - Walter (1/1) Feb 18 2003 Anonymous functions (in some form) are a very good idea. -Walter
- Mark Evans (3/3) Feb 19 2003 Microsoft considered functional language features important enough to en...
Basically, some syntactic sugar for small functions that are only needed
for a moment.
alias void delegate(int i) Function;
Function f = Function { return i * 3 };
Or somesuch. If one wants to get fancy, one could get the compiler to
try and inline them when passed as template arguments, which opens the
doorway to C++ STL-like algorithms.
instance Algorithm(SomeType,
Comparer {
return a.something > b.something;
}
).Sort(somearray);
Maybe the syntax isn't so hot, though.
Feb 01 2003
"Andy Friesen" <andy ikagames.com> escribió en el mensaje
news:b1h5uk$2omp$1 digitaldaemon.com...
| Basically, some syntactic sugar for small functions that are only needed
| for a moment.
|
| alias void delegate(int i) Function;
| Function f = Function { return i * 3 };
|
| Or somesuch. If one wants to get fancy, one could get the compiler to
| try and inline them when passed as template arguments, which opens the
| doorway to C++ STL-like algorithms.
|
| instance Algorithm(SomeType,
| Comparer {
| return a.something > b.something;
| }
| ).Sort(somearray);
|
| Maybe the syntax isn't so hot, though.
|
What about functions inside other functions (what's the real name for that),
like in Delphi? I'm not sure about the syntax, but maybe that could be a
workaround (sp?) for anon functions. Or am I getting it wrong?
-------------------------
Carlos Santander
http://carlos3.netfirms.com/
"Andy Friesen" <andy ikagames.com> escribió en el mensaje
news:b1h5uk$2omp$1 digitaldaemon.com...
| Basically, some syntactic sugar for small functions that are only needed
| for a moment.
|
| alias void delegate(int i) Function;
| Function f = Function { return i * 3 };
|
| Or somesuch. If one wants to get fancy, one could get the compiler to
| try and inline them when passed as template arguments, which opens the
| doorway to C++ STL-like algorithms.
|
| instance Algorithm(SomeType,
| Comparer {
| return a.something > b.something;
| }
| ).Sort(somearray);
|
| Maybe the syntax isn't so hot, though.
|
What about functions inside other functions (what's the real name for that),
like in Delphi? I'm not sure about the syntax, but maybe that could be a
workaround (sp?) for anon functions. Or am I getting it wrong?
-------------------------
Carlos Santander
http://carlos3.netfirms.com/
Feb 01 2003
Anonymous functions (in some form) are a very good idea. -Walter
Feb 18 2003
Microsoft considered functional language features important enough to enhance NET. D should pay them serious attention. -M. http://research.microsoft.com/projects/ilx/babel01.pdf
Feb 19 2003









"Carlos Santander B." <carlos8294 msn.com> 