|
![](/i/fill.gif) |
On 25/04/2012 06:08 AM, Darren New wrote:
> On 4/23/2012 1:05, Invisible wrote:
>>> There are lots of languages that let you can pass a function as an
>>> argument.
>>
>> Heh. I bet most of them are scripting languages though. :-P
>
> Not really. Arguably, even C allows it, C++, C# allows a delegate which
> is essentially the same thing, and yes, bunches of interpreted languages.
C and C++ have function pointers. It's dubious whether functions are
"first class", but certainly you can pass them as arguments.
C# presumably allows /everything/.
Java allows you to use the reflection API to create an object that
represents a function method, and to invoke that method. Alternatively
you can use anonymous inner classes. (The fact that this feature even
/exists/ tells you how badly Java programmers want anonymous functions.)
Pascal? Forget it.
Eiffel? Well, they have "delegates", which are sort-of the same thing.
Come to think of it, I don't actually /know/ any other compiled languages...
Obviously, any random scripting languages supports eval() and so
trivially supports first-class functions.
Post a reply to this message
|
![](/i/fill.gif) |