Thread overview
Anonymous functions?
Feb 01, 2003
Andy Friesen
Feb 19, 2003
Walter
ILX: Extending NET for Functional Language Interoperability
Feb 19, 2003
Mark Evans
February 01, 2003
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.

February 02, 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/


February 19, 2003
Anonymous functions (in some form) are a very good idea. -Walter


February 19, 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