[Gambas-user] gb.scripter draft interface
g4mba5 at gmail.com
Mon Jun 28 20:44:31 CEST 2021
Le 28/06/2021 à 03:14, Brian G a écrit :
> I have been working on a gb.scripter component.
> I am attaching a very rough draft document of what the interface to this
> may look like.
> I would love to get some feedback and comment if possible.
> "Failure is the key to success;
> each mistake teaches us something" .. Morihei Ueshiba
> Brian G
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
I have juste quickly read your document, so here are my comments about
the interface for running scripts only:
Sorry, but I really dislike your interface. You designed it like a C
library, but Gambas has objects and events.
A script is, for the user, a Process-like object that encapsulates an
actual Process object with a lot of magic around it.
So we can imagine a 'Script' class that you instanciate for running a
That class would define properties that match the arguments of your
'ScriptRun' function, added to the interface of the Process class.
The 'ScriptRun' callback is replaced by events. You can add events for
each script preprocessing or compilation step, when there is a
compilation error, and delegates the events of the Process class.
The 'Script' class could have a static method (or use the static '_call'
special methid) for running a script in a quick way like 'ScriptRun'
would do. Not being able to raise event, the static method could raise
errors instead when there is a compilation problem.
And why do you want to return script compilation errors as structured
strings? You should better create objects with properties and return an
array of them.
More information about the User