[Gambas-user] Library and File

Tobias Boege taboege at gmail.com
Thu Nov 15 00:42:18 CET 2018


On Thu, 15 Nov 2018, Christof Thalhofer wrote:
> Hi Tobi,
> 
> Am 14.11.18 um 10:00 schrieb Tobias Boege:
> > [1] https://lists.gambas-basic.org/pipermail/user/2018-August/065319.html
> 
> YES! .../ would be really ugly. Soo ...
> 
> namespaces would be the answer to the problems addressed by this mail.
> 

I wholeheartedly support the namespace request. This topic came up when I
talked about this with Hans in private as well. The attentive reader will
have noticed that my Help.class idea does not work as soon as you have more
than a single library from which you want to get help. In that case you
have to modify the class (or method, because exporting a class that was
already exported from another component extends the old one) names for
getting help depending on the component name that you want to get help from,
so instead of a hypothetical Help.Get() in MyLib, you need to write
Help.GetForMyLib1() in MyLib1 and Help.GetForMyLib2() in Lib2, which
is effectively rolling your own, non-standard namespacing.

I'm not saying that the brokenness of my simplistic suggestion to Hans'
problem makes namespaces mandatory. It can be fixed by providing access
to other archives' files, but to me that feels more like a patch, when
namespaces are a proper solution.

I also want to say that I can imagine the special syntaxes to access
other archives' files to be a proper solution for some tasks, like
serving static content from (future) components which are entangled
with gb.web.form, for example.

[ Disclaimer: Below is me daydreaming a bit, at half past midnight. ]

But in turn, I can also imagine that this functionality can be implemented
when namespaces exist, if you inject a virtual File.Load() function into
every component namespace, which is able to access files inside the component,
so if you load MyLib1, you can MyLib1::File.Load("help.txt") to get a file
from MyLib1's archive.

In the end, I guess what I want to say is:

  I wholeheartedly support the namespace request.

Regards,
Tobi

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


More information about the User mailing list