Re: Namespace clobbering internals

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

I saw the idea of keeping symbols out of the global scope necessary for 
porting existing EUPHORIA applications and libraries to the new standard
library.
Imagine you have 12,000 lines of code and you wish to use this new standard 
library.  Can you imagine having to do a search and replace for every builtin 
to include an eu: namespace qualifier?

Perhaps it is just better to avoid the names of builtins in the first place
unless
you really want to override them.  Instead of open and close, the same kind of
thing could be called connect() and disconnect().

Shawn Pringle


Arthur Crump wrote:
> 
> 
>  "include db.e as d, without global"
> in a module looks more like a syntax to prevent a program which called 
> this module from receiving db.e, rather than this module not receiving 
> it without its namespace; an option I would like to see, incidentally.
> 
> Perhaps:
>  "include db.e as d only"
> might be sufficient.
> 
> However, Jeremy Cowgar's suggestion of a standard namespace such as eu 
> for builtin routines is equally good.
> 
> Arthur Crump, in Cheshire, England.
> 
> Shawn Pringle wrote:
> > 
> > This is what I tried to explain in the chat room.  We would like to put
> > included modules into a namespace exclusively so that a function such as
> > close could ONLY be referenced through its name space: d:close() but not
> > close().  You see when functions are included by namespace you set a name
> > for they also go into a global local namespace.
> > 
> > Right now:
> > include db.e -- includes into the global name space
> > 
> > include db.e as d -- includes into global namespace and namespace 'd'.
> > 
> > -- no way to put include db.e into a namespace 'd' exclusively.
> > 
> > 
> > Perhaps you could use existing keywords in a new way:
> > 
> > include db.e as d, without global
> > -- includes db.e into d but close() will call the builtin.  
> > -- Even if there is a function called insert in db.e, calling insert() will
> > fail,
> > -- you must type d:insert().
> > 
> > Jeremy Cowgar wrote:
> > > 
> > > I create a db.e file that defines the word close. I then:
> > > 
> > > }}}
<eucode>
> > > include db.e as d
> > > 
> > > --- do things
> > > f = open(filename, "w")
> > > 
> > > -- later
> > > close(f)
> > > </eucode>
{{{

> > > 
> > > It called the database's close function, not the internal. So, even if you
> > > use
> > > a namespace, your included files cannot define functions by the same name
> > > as
> > > an internal and you expect to continue to use an internal function?
> > > 
> > > --
> > > Jeremy Cowgar
> > > <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu