RE: My not-quite obsolete namespace parser

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

Derek Parnell wrote:
> Robert Craig wrote:

> > I'm content with the current way of handling duplicate includes.
> > It's been that way for 9 years and I don't recall anyone complaining
> > about it. There aren't many other features with as clean a record.  smile
> 
> As I've written before, Euphoria is perfect already blink
> 
> As a philosophical diversion: 
>  Are two files the same if their names are the same or if their contents 
> are the same?
> 
> -----------
> Derek

Despite what Rob said earlier, Euphoria's namespacing 
doesn't work as well as C, Pascal, etc. It doesn't work 
as a normal programmer (if there is such a thing) would 
expect.

A simple example in C:

/* Contents of main.c */
#include "./misc.c"
#include "./gtk/misc.c"

int main()
{
 foo();
 bar();
 return 0;
}

/* Contents of misc.c */
void foo()
{
 printf("Foo\n");
}

/* Contents of /gtk/misc.c */
void bar()
{
 printf("Bar\n");
}

Save these three files, compile and execute.
[irv at localhost irv]$ ./main
Foo
Bar

Just what you'd expect, right?

Do the same thing in Euphoria, and you'll get an
error:
[irv@localhost irv]$ exu main
Foo
main.exu:5
bar has not been declared
bar()
  ^

Why hasn't bar() been declared?

Because to Euphoria, ./misc.e and ./gtk/misc.e are 
duplicates, even though the include name and file 
content are different. Our only option is to re-name 
one or the other. You can surely think of reasons why 
this would be undesirable, especially if we want 
to distribute programs using other peoples' includes.

I can see absolutely no reason that Euphoria should 
function in this manner.

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu