Re: Namespace clobbering internals

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

Matt Lewis wrote:
> 
> How many built-ins are we talking about overriding?
>

Here are some common ones that would make libraries easier if we can override
them. The reason I say this, is why come up with 20 creative names for the same
task just to prevent collisions. Now, if I want to delete a record from a
database I have to use delete, then to remove something from a map, I have to use
vanish, then to delete an item in a sequence I have to remove, etc... If diff
libs could all use remove or delete to remove or delete something, then it makes
things easier.

append, prepend, remove, length, compare, equal, find, match, sort, open, close.

That's just real quick off the top of my head. Again, being able to use these
function names makes programming libraries and using libraries simpler.

map:length() for instance. Instead of coming up with map:size(),
map:length_of(), map:mass(), map:volume(), map:extent(), map:porpotion(), etc...

or...

map:remove() instead of map:delete(), map:take(), map:take_off(),
map:withdraw(), etc...

Again, this creates a simpler API. One problem with programming in Forth is the
requirement of every single word has to be a new name, so when programming
anything sizeable in forth you wind up becoming an English scholar and your
dictionary becomes your greatest tool in programming. You then come up with names
that are so very similar that later you even question what it does.

> 
> Yes.  But also consider your hypothetical pgsql.e.  It couldn't use its
> own close() function, unless it defines a namespace for itself.  This
> fails the principle of least surprise.
>

Yes, that's a problem. I wonder if in addition to a eu: namespace if we should
borrow a good idea from the OO people (not to make Euphoria OO, and not to
suggest that I like Java better than Euphoria, but why not learn from other
languages? To not learn from other languages is not very smart), self:, this:,
current:, me: or something like that.

Just more thinking about the subject.

Matt, I think the eu: namespace is a critical addition, even if we do or do not
use it to solve some of these problems we are speaking of right now. What it will
do is give, in example, the pgsql.e file the ability to call the built-in close()
or it's own close(). I do not think anyone will complain if we add the eu:
namespace as it will not break a thing and will only help in situations. Can you
give me a pointer or direction in implementing this?

--
Jeremy Cowgar
http://jeremy.cowgar.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu