Re: Question on scope
- Posted by jzeitlin at cyburban.com Dec 18, 2001
- 426 views
On Tue, 18 Dec 2001 12:40:11 -0800, Robert Craig <rds at RapidEuphoria.com> wrote: >Jeff Zeitlin writes: >> If I have >> include foo.e >> include bar.e >> include baz.e >> in a Euphoria source file, the public routines of foo.e are _not_ available >> to routines in bar.e or baz.e _unless_ those files include foo.e, correct? >You could make a good case for that behavior, but in fact, >the globals of foo.e are available automatically to bar.e and baz.e, >whether namespaces are defined or not. This is good to know; it just made part of the project even simpler. I was prepared to write the project assuming the behavior in my question, but it would have been more complicated. >Kat writes: >> If you include foo more than >> once, or in a nested include, you get an error. >You can include foo.e again if you want. >All subsequent includes of foo.e will be ignored (no error), >except that you can specify a namespace identifier on >any include statement, and even have multiple identifiers >refering to the same include file. Good to know. Leads to a new question: Suppose I have included foo.e as bar and as baz. Is it possible to write a procedure that overrides one of the publics in one of the namespaces? IOW, can I define namespaces other than by includes? If this is answered in the docs, tell me so - I haven't had the chance to read them thoroughly, only glanced through them. -- Jeff Zeitlin jzeitlin at cyburban.com (ILink: news without the abuse. Ask via email.)