Re: Euphoria To C Translator - Official Release
- Posted by Jiri Babor <jbabor at PARADISE.NET.NZ> Jun 06, 2001
- 398 views
Dear Robert, > I intend to work on the namespace issue and > some other things now ... Let me tell you - now that you have finally decided to do something really useful for a change (insert obligatory smilie here) - about a scheme I am using in one of my private, incredibly slowly moving projects. I do not think it's anything terribly new - the same or very similar schemes were probably proposed often enough in the past - but I like it a lot. It is very simple, it requires just two or three new words and it does not break any existing code... To import a file into the current namespace I use this simple extension of the include statement: include <filename> as <label> For example: include myfont.e as font In the imported file, the elements intended for export (constants, variables, functions and procedures are marked as such by 'export' label, the same way as 'global' is used. For example: export integer x, y, z export function abc(...) ... end function Then, in the 'current' namespace, the common enough dot notation can be used to import these elements, e.g.: x1 = font.x x2 = font.abc(...) ... The beauty of the scheme is, apart from its simplicity, the global identifiers can still be used in their traditional sense. But, of course, it would be sensible to restrict their future use to 'system' items only, things like get(), value(), true, false, etc. By the way, an embellishment of the form using <label> ... end using so that the previous example becomes using font x1 = x x2 = abc(...) ... end using would also be a nice convenience. jiri