Re: Do you currently use namespaces?

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> 
> gshingles wrote:
> > 
> > I saw mention of a default namespace being created by the coder of the
> > include.
> > Well why not make the default namespace the name of the file, without .e[??]
> > at the end?  Even better, why not work out its path relative to the EUINC
> > folder
> > it is in and make that the default namespace?  Even even better (all IMHO of
> > course) provide a function that returns the name (or numeric id) of that
> > default
> > namespace?
> > 
> 
> For several reasons:
> * mylib_v1.e may become mylib_v2.e

I would expect containerised modules to be named sensibly, and probably not
contain version information, so that you could say:

include database.e
include database/mysql.e as mysql
include net/http/useragent.e


... and not have to particularly worry about what version you are including (I
mean, that's what documentation is for).

> * file names may contain invalid characters for an Euphoria identifier,
> including,
> worst of all, spaces;

Fair enough comment, though fairly easily ruled out with a bit of checking by
the include system. eg crash with an error saying "you can't name it that".

In Perl you name your module inside the file and woe betide you if the filename
does not match.

> * What is the name of fileA.e under Windows? Its short 8.3 name? its
> lowercased
> form? its uppercased form?

That's the best objection from your list, in my opinion. Systems like Perl grew
up in strict filesystem environment so it wasn't an issue and I'm not sure how
they deal with that in the Windows or DOS environment.

> * Having all of the above in mind, copy your library from one platform to
> another,
> and have fun.

Yes, another flaw in the idea is the path separation, but that's why Perl uses
'::' in place of '/' or '\' or ':'.

Please note, I'm not suggesting making Euphoria into Perl, but I started using
Perl at the end of version 4 and saw the evolution of its OO system into
something that is really simple, yet very flexible.

Another thing I hadn't thought of is how to call a method via an object, that
may require a new notation, and might rule it out as a viable system anyway
(since I was just thinking at the parsing level).

Gary



Gary

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu