Re: [RC] Lucius tries to use namespace
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 24, 2003
- 438 views
----- Original Message ----- From: "Lucius Hilley" <l3euphoria at bellsouth.net> To: "EUforum" <EUforum at topica.com> Subject: [RC] Lucius tries to use namespace > > Ok, I'll start with an insult. > Robert Craig, Bite me. > > I tried to make use of namespacing. I had beautiful results while testing from > within the include file that I was creating. I made a nice little wrapper for > somebody elses routine calls. I then decided to inlclude my wrapper and use the > new routines that I had made. That had exact same names as the file they wrapped. > Guess what. I can't use my routines without saying blah:routine() for every > freaking one of them. > > In short, I tried your NameSpaces and hate it. Okay, I'll bite So we now have a situation where there are two global routines called 'xyz' and a program using your wrapper include decides to call a routine called 'xyz'. Now how is Euphoria supposed to know which of those two 'xyz' routines is meant to be called? This is why you need to tell EUphoria which one you are referring to. Is Euphoria suuposed to guess and use the one that was most recently defined? Is that what you were expecting? That behaviour could lead to mistakes being made by Euphoria. On a related issue, the rule of thumb when writing library files is... If you are writting a file that will be 'included', then every reference your file makes to globals that are in files that your file includes, needs a namespace qualifier. For example, I'm writing a file call supersort.e, and it includes the RDS sort.e file. This means that every time my supersort.e code refers to a global in sort.e, that reference needs a namespace qualifier. include sort.e as rdsSort include wildcard.e as rdsWildcard . . . result = rdsSort:sort( rdsWildcard:lower(x) ) -- Derek