Discussion:
"User components" replaced by "Libraries" in Gambas 3
(too old to reply)
Benoît Minisini
2010-04-25 16:50:38 UTC
Permalink
Hi,

In the last revision, I added the implementation of "libraries" in Gambas 3.
That libraries completely replace the "user components" concept of Gambas 2.

How does it work?

You have a new tab named "libraries" in the IDE project property dialog. In
that tab, you can define a list of gambas executables (*.gambas files) that
will be used as libraries.

When adding a library to a project, the IDE will extract from it all the
information needed for the automatic completion, as for the normal components.

These libraries will be loaded at program startup by the interpreter exactly
like any component written in Gambas.

When your project in run in debugging mode, i.e. from the IDE, the libraries
are located by using the absolute path specified in the project property
dialog.

But when running the project normally, the library is searched in the
following directory only:
- The same directory as the project.
- /usr/bin
- /bin

So, a Gambas executable that must act as a library for another program must be
installed in /bin, /usr/bin, or in the same directory as the program using it.

Now I'm waiting for your comments about this new feature!

Regards,
--
Benoît Minisini
svitoos
2010-04-25 19:02:10 UTC
Permalink
Post by Benoît Minisini
You have a new tab named "libraries" in the IDE project property dialog. In
that tab, you can define a list of gambas executables (*.gambas files) that
will be used as libraries.
When adding a library to a project, the IDE will extract from it all the
information needed for the automatic completion, as for the normal components.
These libraries will be loaded at program startup by the interpreter
exactly like any component written in Gambas.
This is very good.
The *.info and *.list files will be included in the library files?
Post by Benoît Minisini
But when running the project normally, the library is searched in the
- The same directory as the project.
- /usr/bin
- /bin
So, a Gambas executable that must act as a library for another program must
be installed in /bin, /usr/bin, or in the same directory as the program
using it.
I think it is better to look for libraries in the directories listed in
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
Benoît Minisini
2010-04-25 19:38:19 UTC
Permalink
Post by svitoos
Post by Benoît Minisini
You have a new tab named "libraries" in the IDE project property dialog.
In that tab, you can define a list of gambas executables (*.gambas
files) that will be used as libraries.
When adding a library to a project, the IDE will extract from it all the
information needed for the automatic completion, as for the normal components.
These libraries will be loaded at program startup by the interpreter
exactly like any component written in Gambas.
This is very good.
The *.info and *.list files will be included in the library files?
Yes. As soon as some of the project classes are exported, a .info and a .list
file are generated by the compiler, and these files are included in the
executable.

The "gba3" command, which creates executable, can now extract file from an
archive, if you want to check.

For example, do:

$ gba3 -x <executable> .list

to get the .list file.
Post by svitoos
Post by Benoît Minisini
But when running the project normally, the library is searched in the
- The same directory as the project.
- /usr/bin
- /bin
So, a Gambas executable that must act as a library for another program
must be installed in /bin, /usr/bin, or in the same directory as the
program using it.
I think it is better to look for libraries in the directories listed in
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
I don't want to multiply the directories where libraries must be searched for.

But I agree that /usr/bin and /bin are not necessarily a good solution.

As they are libraries, looking inside <gambas installation prefix>/lib/gambas3
may be a good solution, but Gambas executables are architecture-independant,
so maybe they should go into <gambas installation prefix>/share?

Something to thing about...
--
Benoît Minisini
Ian Haywood
2010-04-26 00:53:22 UTC
Permalink
Post by svitoos
I think it is better to look for libraries in the directories listed in
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
I think this is a good idea, because gambas should behave like other
POSIX-based interpreted languages (python, ruby, perl, etc.) unless
there is a good reason not to.
Post by svitoos
As they are libraries, looking inside <gambas installation prefix>/lib/gambas3
may be a good solution, but Gambas executables are architecture-independant,
so maybe they should go into <gambas installation prefix>/share?
"lib" is where python and ruby libraries go, even though technically
their bytecodes are architecture-independent too, this is probably
because "lib" has all the other
system libraries and its more confusing to make an exception.
Post by svitoos
I don't want to multiply the directories where libraries must be searched for
I think there is a good reason for the three directories suggested above.
It is important to search both /usr/ and /usr/local/ to provide a
clear separation between default libraries managed by the OS
installation system (apt-get, rpm, or whatever)
and third-party libraries installed by the system admin, plus it is
useful to have a third directory under $HOME so libraries can be
installed without being the superuser.

Ian
Doriano Blengino
2010-04-26 06:19:03 UTC
Permalink
Post by Ian Haywood
Post by svitoos
I think it is better to look for libraries in the directories listed in
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
I think this is a good idea, because gambas should behave like other
POSIX-based interpreted languages (python, ruby, perl, etc.) unless
there is a good reason not to.
I agree too.
Post by Ian Haywood
Post by svitoos
As they are libraries, looking inside <gambas installation prefix>/lib/gambas3
may be a good solution, but Gambas executables are architecture-independant,
so maybe they should go into <gambas installation prefix>/share?
"lib" is where python and ruby libraries go, even though technically
their bytecodes are architecture-independent too, this is probably
because "lib" has all the other
system libraries and its more confusing to make an exception.
Probably I am wrong, but I don't see all this importance about keeping
some files in .../share just because they are architecture independent.
I don't see any advantage in this convention; it would be more logical
if .../share contained files shareable by different applications on the
system (and, in fact, you find many of them: icons, fonts,
translations...). If so, then gambas libraries are not common to
different applications - they are common to gbx3, and .../lib would be
more logical.
Post by Ian Haywood
Post by svitoos
I don't want to multiply the directories where libraries must be searched for
I think there is a good reason for the three directories suggested above.
It is important to search both /usr/ and /usr/local/ to provide a
clear separation between default libraries managed by the OS
installation system (apt-get, rpm, or whatever)
and third-party libraries installed by the system admin, plus it is
useful to have a third directory under $HOME so libraries can be
installed without being the superuser.
Ian
Agreed again.

And now a little curiosity: would be those libraries *true* executable?
I mean - I code a project with some class, and the main class contains
code to test the other ones. Then I can use the project as a library,
and still use it as a standalone program to test the library at any
time. In addition, the project/library can be used to configure it... I
mean - I use, say, an SMTP library. In my final application, instead of
asking the user a lot of parameters about the network, I can simply
SHELL ".../libsmtp.gambas" to let the library ask and store all the
relevant parameters and preferences...

Regards,
Doriano
Benoît Minisini
2010-04-26 09:30:01 UTC
Permalink
Post by Doriano Blengino
Post by Ian Haywood
Post by svitoos
I think it is better to look for libraries in the directories listed in
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
I think this is a good idea, because gambas should behave like other
POSIX-based interpreted languages (python, ruby, perl, etc.) unless
there is a good reason not to.
I agree too.
Post by Ian Haywood
Post by svitoos
As they are libraries, looking inside <gambas installation
prefix>/lib/gambas3 may be a good solution, but Gambas executables are
architecture-independant, so maybe they should go into <gambas
installation prefix>/share?
"lib" is where python and ruby libraries go, even though technically
their bytecodes are architecture-independent too, this is probably
because "lib" has all the other
system libraries and its more confusing to make an exception.
Probably I am wrong, but I don't see all this importance about keeping
some files in .../share just because they are architecture independent.
I don't see any advantage in this convention; it would be more logical
if .../share contained files shareable by different applications on the
system (and, in fact, you find many of them: icons, fonts,
translations...). If so, then gambas libraries are not common to
different applications - they are common to gbx3, and .../lib would be
more logical.
Post by Ian Haywood
Post by svitoos
I don't want to multiply the directories where libraries must be searched for
I think there is a good reason for the three directories suggested above.
It is important to search both /usr/ and /usr/local/ to provide a
clear separation between default libraries managed by the OS
installation system (apt-get, rpm, or whatever)
and third-party libraries installed by the system admin, plus it is
useful to have a third directory under $HOME so libraries can be
installed without being the superuser.
Ian
Agreed again.
And now a little curiosity: would be those libraries *true* executable?
They are.
Post by Doriano Blengino
I mean - I code a project with some class, and the main class contains
code to test the other ones. Then I can use the project as a library,
and still use it as a standalone program to test the library at any
time. In addition, the project/library can be used to configure it... I
mean - I use, say, an SMTP library. In my final application, instead of
asking the user a lot of parameters about the network, I can simply
SHELL ".../libsmtp.gambas" to let the library ask and store all the
relevant parameters and preferences...
Regards,
Doriano
There is no difference at all between a library and a executable. A library is
just an executable that is used as a component by another executable.

So you can do what you want!

Regards,
--
Benoît Minisini
Dimitris Anogiatis
2010-04-26 16:17:06 UTC
Permalink
Benoît,

Will all the controls that are gambas written, be implemented in this
fashion too?
if so how will the IDE distinguish between a library and a control?

Regards,
Dimitris
Post by Ian Haywood
Post by Doriano Blengino
Post by Ian Haywood
Post by svitoos
I think it is better to look for libraries in the directories listed
in
Post by Doriano Blengino
Post by Ian Haywood
Post by svitoos
GB3_LIBRARY_PATH, and if this variable is not defined
then "/usr/lib/gambas3:/usr/local/lib/gambas3":~/.local/lib/gambas3
I think this is a good idea, because gambas should behave like other
POSIX-based interpreted languages (python, ruby, perl, etc.) unless
there is a good reason not to.
I agree too.
Post by Ian Haywood
Post by svitoos
As they are libraries, looking inside <gambas installation
prefix>/lib/gambas3 may be a good solution, but Gambas executables are
architecture-independant, so maybe they should go into <gambas
installation prefix>/share?
"lib" is where python and ruby libraries go, even though technically
their bytecodes are architecture-independent too, this is probably
because "lib" has all the other
system libraries and its more confusing to make an exception.
Probably I am wrong, but I don't see all this importance about keeping
some files in .../share just because they are architecture independent.
I don't see any advantage in this convention; it would be more logical
if .../share contained files shareable by different applications on the
system (and, in fact, you find many of them: icons, fonts,
translations...). If so, then gambas libraries are not common to
different applications - they are common to gbx3, and .../lib would be
more logical.
Post by Ian Haywood
Post by svitoos
I don't want to multiply the directories where libraries must be searched for
I think there is a good reason for the three directories suggested
above.
Post by Doriano Blengino
Post by Ian Haywood
It is important to search both /usr/ and /usr/local/ to provide a
clear separation between default libraries managed by the OS
installation system (apt-get, rpm, or whatever)
and third-party libraries installed by the system admin, plus it is
useful to have a third directory under $HOME so libraries can be
installed without being the superuser.
Ian
Agreed again.
And now a little curiosity: would be those libraries *true* executable?
They are.
Post by Doriano Blengino
I mean - I code a project with some class, and the main class contains
code to test the other ones. Then I can use the project as a library,
and still use it as a standalone program to test the library at any
time. In addition, the project/library can be used to configure it... I
mean - I use, say, an SMTP library. In my final application, instead of
asking the user a lot of parameters about the network, I can simply
SHELL ".../libsmtp.gambas" to let the library ask and store all the
relevant parameters and preferences...
Regards,
Doriano
There is no difference at all between a library and a executable. A library is
just an executable that is used as a component by another executable.
So you can do what you want!
Regards,
--
Benoît Minisini
------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
https://lists.sourceforge.net/lists/listinfo/gambas-user
Benoît Minisini
2010-04-26 16:24:45 UTC
Permalink
Post by Dimitris Anogiatis
Benoît,
Will all the controls that are gambas written, be implemented in this
fashion too?
if so how will the IDE distinguish between a library and a control?
Regards,
Dimitris
Nothing changed for components written in Gambas.

Components can be considered as part of the language, whereas libraries are
there for the final user, so that he can easily share piece of codes between
different projects.

Otherwise, technically, there is almost no difference between a component
written in Gambas and a library. The interpreter loads them the same way. The
only difference is where they are searched for.

Regards,
--
Benoît Minisini
Continue reading on narkive:
Loading...