Re: Namespace Proposal

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

One thing that Euphoria doesn't handle gracefully is large libraries. You
currently have two options:

1. Use a large file, and have local names.
2. Use several smaller files, and have global names.

Option 1 leads to things like the monolithic Win32Lib file. Option 2 leads
to pollution the global namespace with what rightfully should be locals.

I was hoping the namespace solution would address this, but it doesn't,
really. So I'd like to propose a modest addition:

   include <filename> as <alias>

For example, if Win32Lib was broken up into 3 parts, you could write:

   include win32lib1.ew as win32lib.ew
   include win32lib2.ew as win32lib.ew
   include win32lib3.ew as win32lib.ew

and it would treat these as if they were part of the same file. This would
allow local routines to remain local, instead of becoming global and
'polluting' the global namespace.

Likewise, if you wanted to override the namespace provided by Robert's
option, you could write:

   include math_pkg.ex as math

and the routines could be prefixed as 'math' instead of 'math_pkg'.

Finally, I'm a bit concerned about using filenames to provide namespaces. As
people have mentioned, there are issues about case sensitivity on different
platforms. Plus, filenames don't necessarily make good prefixes.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu