Re: routine_id() is not working
- Posted by jimcbrown (admin) Apr 12, 2013
- 1574 views
However, loading two procedures or function by the same name (and un-namespaced) being legal, but loading variables of the same name (and un-namespaced) isn't, seems wrong,
It is wrong. Loading variables of the same name (and un-namespaced) is legal.
-- a.e public object ab = 0
-- b.e public object ab = 1
-- main.ex include /dev/shm/a.e include /dev/shm/b.e
because if the programmer didn't namespace them (include blah.e as blah), one or more of them cannot be used.
This makes sense, but on the other hand, there's a good chance that the identifiers with name conflicts won't be used at all in the main program.
I don't read all of win32lib.e or it's many includes, so i might write a procedure of the same name as exists in win32lib. Or perhaps something under std/net (which has happened a few times the last few years). I doubt anyone reads all the proc names in every file they might include to see if that name is already taken.
I doubt anyone uses every sumbol in win32lib.e et al.
For that reason, i suggest Euphoria "understand" transparently and automagically that all procedures and functions in includes are now addressable like filename:procname, if the programmer has not manually done so.
Like peu does?
And if i then include os.e and misc.e and then want to use sleep(), being that it's in two files and i didn't specify which one to use, Euphoria toss an error before it runs, letting me know to choose one.
This already happens...
-- c.e ?-1 include /dev/shm/a.e include /dev/shm/b.e ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ? ab
Running that with the earlier examples in this post gives
/dev/shm/c.e:14 <0074>:: Errors resolving the following references: 'ab' (/dev/shm/c.e:14) has been declared more than once. in /dev/shm/a.e in /dev/shm/b.e ? ab ^

