Re: A Problem with v2.4 (for Rob)

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

Hello Derek, you wrote:

> On Wed, 14 May 2003 02:37:25 +0000, Al Getz <Xaxo at aol.com> wrote:
>
>>
>> Hello again Rob,
>>
>> While working with v2.4 i came upon a problem that has
>> quite profound consequences.  The problem centers around
>> the new implementation of 'include as'.
>>
>>
>> --in file SomeoneElsesExistingFuncs.ew--------
>> procedure DoSomething()
>> ?{1}
>> end procedure
>> -- and 100 other procedures already named.
>> ----------------------------------------------
>>
>> --in file MyNewFuncs.ew-----------------------
>> procedure DoSomething()
>> ?{2}
>> end procedure
>> -- and 99 other procedures, a lot with the same
>> -- names as in SomeoneElsesExistingFuncs.ew
>>
>> ----------------------------------------------
>>
>> -- MyNewFuncs.ew DoSomething() does something slightly different
>> -- then that which is in SomeoneElsesExistingFuncs.ew
>>
>>
>> -- all the following in file Test.exw ...
>>
>> include SomeoneElsesExistingFuncs.ew
>> include MyNewFuncs.ew as MF
>>
>>
>> -------Someone elses existing .exw code section---------
>> DoSomething()
>> -- and call 100 other functions already named in
>> -- SomeoneElsesExistingFuncs.ew
>> ---------------------------------------------------
>>
>> -------My new code section (also in Text.exw)---------
>> MF:DoSomething() --<----flags a name qualifier required error.
>> -- and call 99 other functions already named in
>> -- both MyNewFuncs.ew
>> -------------------------------------------------------
>>
>> The interpreter flags a name qualifier required error because
>> it doesnt see that "MF:DoSomething()" is different then simply
>> "DoSomething()".  This is exactly the same as Euphoria 2.2.
>
> That is not quite what is happening. Euphoria sees "DoSomething()" so it
> looks for a local routine with this name. If it can't find one, it looks
> for a global routine with this name. In this case it finds two global
> routines with this name.

Maybe I'm wrong, but in my understanding the two global routines have
*different* names: One name is 'DoSomething()', and the other name is
'MF:DoSomething()'.

> Now, which one did you actually mean to use? How
> would Euphoria know? For example, if it assumes that because you didn't use
> the namespace qualifier that it should use the routine in a file that
> wasn't namespaced?

Yes. Isn't this situation similar to that one, when you start a program
say 'myprog.exe' from the command line? If the program is in the current
directory or in a directory on the PATH, and you want to run this one,
you just have to type 'myprog.exe'. If you want to run another program
with this name in another directory that is not on the PATH, you can do
this by typing the full qualified name, e.g. 'C:\test\myprog.exe'.

> Maybe, but that assumes you INTENDED to leave off the
> namespace qualifier.

Yes.

> Rather than second guess you, Euphoria raises an error
> so that you can disambiguate the situation.

[big snip]

> Maybe a warning might be
> useful in case the coder just forgot to qualify a reference or two. It
> would also potentially break existing code - but maybe not that much.

Yes, IMHO a warning -- instead of an error -- would be the appropriate
reaction here (if it doesn't break too much existing code).

Best Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu