[Gambas-user] Share code across projects

Tobias Boege taboege at ...626...
Sun Jan 24 20:27:08 CET 2016


On Sun, 24 Jan 2016, Beno??t Minisini wrote:
> Le 24/01/2016 17:17, Tobias Boege a ?crit :
> > Hi everybody,
> >
> > with the semester break upcoming, I plan to supplement a project of mine
> > with some other applications in which I want to use classes from the
> > project. I have not, if memory serves, written any "local" components yet.
> > By "local" I mean a component which is *not* installed into /usr/lib/gambas3.
> >
> >>From what I remember from other threads, I could:
> >    - symlink source files around,
> >    - copy source files around,
> >    - install the project to /usr/lib/gambas3, or
> >    - create a Library.
> >
> > I don't really want to copy source files as I presume they will change
> > considerably during development. The symlink solution is kind of dirty and
> > makes the projects less easy to give to others. I would prefer not to touch
> > /usr/lib/gambas3 for some private project of very limited scope (i.e. it is
> > way too specific to lie amongst the general components). As I imagine, using
> > a library becomes messy, too, if it should be shared by multiple projects.
> > Also I couldn't really share my project because the library path is absolute
> > and won't work on somebody else's computer (right?).
> >
> > How are you others doing this? Did you notice or can you imagine any problems
> > with your way of doing it? Any arguments in favour of the library approach?
> >
> > I think a user-specific directory for custom components would be nice. It
> > would be a standard path relative to a user's home directory which is
> > taken into account by the IDE (when it lists the installed components) and
> > the interpreter (when it loads components). Or is that considered a security
> > risk, Benoit?
> >
> > Regards,
> > Tobi
> >
> 
> User-specific directory for components was existing before but has been 
> removed.
> 
> I think that custom components (in the sense of Gambas) can be a 
> security risk, but it is above all a management mess.
> 
> Moreover, as I said elsewhere, for me components are part of the 
> language, it's like "interpreter drivers".
> 
> So I'd prefer using libraries for that.
> 

OK.

> But to fit your needs, I have to enhance the libraries support with:
> 
> - The ability to share libraries between different projects without 
> having to put everything in the same directory.
> 
> - The ability to explicitly load a library from any path.
> 
> What do you think?
> 

Thank you for picking this thread up so quickly.

Especially that last point would be cool. As you may remember I have written
(and still work with) a way to insert (user-supplied) Gambas classes at run-
time, into a Gambas process. This works by creating a temporary component
out of the given classes and loading it. Until now this mechanism required a
small patch to the interpreter to allow loading components from an absolute
path. If you could do that last point, I would get rid of this customisation
(provided that Component.Load() would gain this ability, too).

To extended the first point: if I add a library now, its absolute path
(usually including my user name because stuff is in my home directory) is
added to .project. Someone else would have to adjust this path manually to
get the project running. They would have to do that for every update of the
project that does not come in the form of a patch. What may be a better way
to address libraries?

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list