lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all,

I'm not sure it's a good idea. I frequently return function as variable.
For a game, I've implemented a state chart keeping state as a function pointer.

If a function without parameter is automatically call without (), I can't do something like this

function GetNextState()
   if( must_change_state )
   {
       return my_state;
   }
end

function my_state( ) ... end

Julien Hamaide
Elsewhere Entertainment

Olivier Delannoy a écrit :

It's easyer to type () than rembering names are function call one month or even a week later.



On 2/28/06, Bret Victor <bret@ugcs.caltech.edu> wrote:
Lisa Parratt writes:
I mention this in part because in Perl
Why does everyone always suggest features from that aborted
abomination of a language, rather than ones from SPARK, Z, or other
languages with a bit of class and back bone?
Well, the feature in question (syntactically sugary closures) is in Smalltalk
and (therefore) Ruby, both of which have class.  (Or, at least, classes.)
I imagine Perl adopted it from there.

I'm personally a fan of any syntax that makes abstraction easier to type.

Lua:  function () return foo + bar end
Smalltalk:  [ foo + bar ]