lua-users home
lua-l archive

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


Why can't I use expressions as statements?

Sure, annotation.annotation ^ function(self, target) ... end isn't very useful, BUT this would be:

game.mod(modid) ^ function(self)
  self.preInit ^ function(event)
  end
end

(inb4 something about `game.mod[modid] = ...`)

Alternatively, can we extend function calls to take functions?

game.mod(modid) function(self)
end

This wouldn't be as useful as expressions as statements (there's no way to do game.mod(modid) annotation.typecheck ^ function(self) ... end, while you could do game.mod(modid) ^ annotation.typecheck ^ function(self) ... end - note that I knew quite well how to exploit ^'s right-associativity), but would be "good enough" for most use cases.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.