1. Re: Namespaces (3)

Irv wrote:

> If [you] use a lot of "includes" written by other
> people, import <file> as <namespace>
> will prevent collisions, and so be useful.

As Robert noted a while back, don't expect it to do anything more.

> What needs to happen, I believe, is for namespacing to
> expand names within a given block of code. Perhaps this
> is familiar (from Pascal)
>
> with customer .record do
>    NAME = "Joe"
>    ADDR = "123 Walnut Ave"

I had coded something like that with PP (my pre-processor). I can't recall
exactly how it worked; I think that you could write something like:

   using customer

   the[NAME] = "Joe"
   the[ADDR] = "123 Walnut Ave"

It may not look like much, but when I was writing EE, I was dealing with
some monster structures like:

   my[Dialog][Control][Text]

and it was a lifesaver. The alternative would be to write something like:

   the = my[Dialog][Control][Text]

   the[NAME] = "Joe"
   the[ADDR] = "123 Walnut Ave"

   my[Dialog][Control][Text] = the

which was a poor substitute at best. The biggest problem was the sometimes
the string replacements would cause the line length to exceed Euphoria's
maximum!

To some extent, that's been alleviated by the introduction of '+=' sort of
constructs. But I agree; there are times when a 'with' sort of construct
would make the code much easier to read and maintain.

-- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu