I'm not sure what exactly this is about.
Modular coding of a script and configuration of a script are two rather different aspects.
The former is to organize a script's code so that it allow the scripter, and also a third-party scripter, to easily see what is where and how to edit and add stuff.
The latter is about configuration of a script by the end-user of it.
Local aliases, as drum showed, are one method of the latter aspect, namely configuration. I use them myself for small scripts and/or scripts that do not have menu's or dialogs.
However, for bigger scripts, this method would mean heaps of aliases, and the need to start using token strings as their names, that's okay for the functional aliases of a script, but for this 'return a configuration parameter', it's more of a mess which goes rather away from easy editing by third-party.
So I believe this feature request is more about the former aspect, namely the organisation of the code in a script.
If you want to write a script in such a way that another scripter (so some1 that knows what he does) can easily add his own code sections/modules for it, then this gosub method would come in as a method that allows to keep the code parts separated, so no mix of one scripter's code with another's code.
But let's consider the namespace. It was said that the locals of the calling place should be preserved. Ok, but that means that the 'sub'routine cannot alter them. This is rather contradictional with the idea of being able to 'construct' a script from code on different locations/different scripters.
In the end, the third-party guy has to know the calling code anyway, including its variable names, since that's what you get when you don't like the work involved in the method of using alias $1- parameters - described input $1 = this $2 = that etc (or command /signal + event on signal)
So I have doubts about this. If it is about code organisation-location freedom, the requested namespace is in conflict and it should be more like a kind of 'global' /goto. If it's just configuration parameters, the local aliases come in, and if there are plenty ones, you could always make one called as $constants().name and in it an if/elseif structure like if ($prop = name) { return MyGoatBot } etc. Or a goto $prop and :name | return MyGoatBot.
Last edited by RRX; 11/04/10 02:45 PM.