![]() |
super functions?
Considering that functions are now variables... Wouldn't it be easy to implement this?
PHP Code:
|
What exactly would these super functions do?
|
Quote:
|
Use the old function from within the new function I guess.
Bad idea. Don't override. It makes for ugly development later on, when those who inherit your code try and use the original function without thinking "Oh yeah, grampa redefined "echo", I need to use "super::echo". Just don't, name yours "echo2" and have done. Mass replacement's not hard. |
Next he'll ask for overloaded functions ^^.
|
What would be nice is if we could access the code that each built-in function uses (or does it use built-in code, not gs2?) and ever nicer to be able to modify.
|
well logically, if it was in a class called super and you joined it.
you could do: super::echo(stuff); I think. |
Quote:
|
Quote:
PHP Code:
|
I have no idea what these function objects are and am yet to play with them until I get a decent explanation on what I could possibly do with them.
|
You cant overload functions since everything is TGraalVar in the basic sense. You could have an if statement in a function to check the type of the parameter, but doing that is bad (I've tried it) since variables aren't always what they're supposed to be. Better to sick with separate functions. Though I would like it if the params array was present for all functions and not just actions.
What I would like is Custom Object Types :) And the ability to add global functions. I have yet to see an actual demonstration of function objects though I would like it very much. |
| All times are GMT +2. The time now is 02:23 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.