This whole namespace thing

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

It's nice that the Euphoria community is growing so well that we have to =
worry about conflicting include files written by the community.  In no =
other language I can think of has the language itself developed by the =
users of the language. =20

So here's my humble contribution to this thread.  We don't want to =
change the core of Euphoria any more than we have to.  Adding namespace =
would mean changing the core, if handled internally as most people have =
been suggesting.  Why not make a consistent format for include files =
that would prevent conflicts almost entirely.  For example:

-- foobar.e

global constant FOO1 =3D 1
global constant FOO2 =3D 2
global constant BAR1 =3D 3
global constant BAR2 =3D 4

procedure foo1 (...) -- note that this is a LOCAL procedure

function foo2 (...)

procedure bar1 (...)

procedure bar2 (...)

global function foobar(atom code,sequence data)

  object returnable

  returnable =3D 0

  if code =3D FOO1 then
    foo1(data)
  elsif code =3D FOO2 then
    returnable =3D foo2(data)
  elsif code =3D BAR1 then
    bar1(data)
  elsif code =3D BAR2 then
    bar2(data)
  else
    returnable =3D -1   -- which could be read as an error message

  return returnable     -- obviously procedures return nothing, so this 0 =
would
                        -- be discarded.

end function

--------

        This would keep the general efficiency of the language by avoiding the
need for a preprocessor, keep Rob from having to modify the language, =
and solve the namespace problem. =20
        Of course this presents the two drawbacks of existing code (would =
reverse compatibility be possible with the other suggestions?)  and =
slightly more work for the programmer (but only in that it forces us to =
be a little more organized with our libraries).  This also resembles OOP =
a little, because all procedures/func's would be called as part of a =
class: junk =3D foobar(BAR2,{}) using the tools already available as =
opposed to a dot method. =20
Because of the wild nature of the recent threads on structures and OOP,
        =
I'm going to avoid any further comments on that subject ;)

        NB: for the Christians on the list, I'm interested in any Euphoria =
Bible tools you might have (except Bibles, I've already got 12MB worth). =
=20

Serving Christ,
Michael J. Sabal
mjs at osa.att.ne.jp
http://home.att.ne.jp/gold/mjs/index.html

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

Search



Quick Links

User menu

Not signed in.

Misc Menu