RE: My not-quite obsolete namespace parser
- Posted by Derek Parnell <ddparnell at bigpond.com> May 15, 2002
- 373 views
irv at take.maxleft.com wrote: > > 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. > > > > As I've written before, Euphoria is perfect already > > > > 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. <<code example SNIPPED>> > 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. Hi Irv, don't get me wrong - I'm with you on this one. RDS has got it wrong. RDS was so concerned to get around the problem one has in C with duplicated definitions that it also removed a perfectly valid use of same-named files. IMHO the clear thing to do is to literally exclude truely duplicated files rather than just files with the same name. If one then goes and tries to 'trick' Euphoria by placing an include file into two directories and attempting to 'include' both, then they'll get what they deserve. This is the same as copying an include file to a new file with a different name and including both. The way I assumed that RDS was doing it was to fully normalize the file's path and file name, and treating '\' and '/' as the same character. Then you could compare two file-path-name strings for duplications. Of course, another way would be just to allow duplicate file references and issue warnings about any duplicated global identifiers while otherwise ignoring them. ------------ Derek.