[Gambas-user] Updated Scripter to allow Lib to be included
Benoît Minisini
g4mba5 at gmail.com
Sat Feb 22 22:15:06 CET 2020
Le 22/02/2020 à 20:07, Brian G a écrit :
> 2 the lib keyword is only used by the scripter, it passes the library
> key in the project file, does not require any changes to the compiler at
> all. The library uses a different path than the components. So I used
> that as a way of denoting the difference. I can change to use the full
> word library... Would that be acceptable.
The problem is that it is one more keyword, and I think we can get rid
of it. See below.
> 3 this version was not final and the exec sometimes during testing did
> not stop and wait in the debugger, I was trying to figure that out. Exec
> works correctly at runtime without the debugger. I think I just
> commented it out for testing.
Strange...
> 4 I will change that to use /&
> 5 I can change that to warnings.
> The version I sent out was a first pass, I have a lot to learn about
> this process. Sorry
> I did decide to add the lib support after doing the support for warnings.
> I will make the changes and send it out again.
> I appreciate the feedback, I hope to do a little better next time
> My biggest concern in this version was library dependencies and how they
> are resolved.
>
> thank you
> brian
>
About the "USE" keyword and libraries:
For the interpreter, there is no real difference between a component or
a library. For it, everything is a component that can have a part in a
binary shared library and another part in a Gambas executable.
It's the syntax of the string given in the project file that makes the
difference.
If that string begins with a '/' or a ':', then we have a library,
otherwise whe have a component.
For a component, the string is the component name ('gb.xxxx'), and the
component files are searched in the Gambas system component directory
(usually '/usr/lib/gambas3/').
If the string begins with ':', then it must have the form
':<vendor>/<name>:<version>'. '<name>' gives you the name of the
library, and the library path is
'~/.local/share/gambas3/lib/<vendor>/<name>:<version>.gambas'.
If the string begins with '/', then it is the absolute path of the
library file, and the name of the library is the name of the file
without the extension.
The IDE does not allow to specify a library with an absolute path
(hopefully). It's something implemented to load a library at runtime
with the Component.Load() method.
As the syntax ':<vendor>/<name>:<version>" is hidden, and was done that
way to be fast to parse for the interpreter, I think we can choose
another syntax, that still can be used with the "USE" keyword.
For example:
USE "gb.xxxx" -> component
USE "<vendor>.<name>:<version>" -> library
'gbs3' can check the provided names when compiling the script.
--
Benoît Minisini
More information about the User
mailing list