View Single Post
  #2  
Old 04-06-2011, 06:01 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
This is normally called "function overriding".

And, it is "already possible" in GS2 in some technical sense. If you have access to a variable containing a function pointer (i.e., it was defined as an anonymous function), then you can override it.

The problem is that all the existing functions are not defined as anonymous functions.


Personally, I'd like to see the libraries be written in terms of higher order functions: e.g., onwall would accept the tiletype function as a parameter. This way you would rarely need to override things. This would be more work to do though.



As for your second point, since GS2 does have some sort of OO support, I do agree that prototypes would be a good addition.


Edit: Also, it's fairly critical that we get closure support soon (meaning that you can access variables outside the anonymous function from inside it) natively, rather than using my ugly hack for it.
Reply With Quote