Re: Data hiding

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

Matt Lewis wrote:

[snip]

> It's an admittedly minimalist approach, but that's part of what I like
> about it (and why I think it's particularly suited for euphoria).
> 
> ex:
> }}}
<eucode>
> -- myapp.ex
> include libMatt.e
>     import libPete.e
>         global object PETE
> 
> -- PETE is visible from libMatt.e
> -- PETE is not visible from myapp.ex
> 
> --myapp.ex
> include libMatt.e
>     import libPete.e
>         global object PETE
> 
> include libPete.e
> 
> -- PETE is visible from libMatt.e
> -- PETE is visible from myapp.ex
> </eucode>
{{{


[snip]

There is one strange thing in Euphoria, namely the "as" word.
Rob considers it as not a key word, but just as an element,
so to say, of the second form of the 'include' command.

Good, why not?

But that famous "as" could to be the powerful metacommand.
Really it already is that metacommand, but with too little
duty.

To resolve the examples like to above one, I'd suggest some
new parameter for the "as" metacommand - "sublibrary":

-- lib_a.e
   global object A, Z
      A = "aa"
      Z = "zz"
-- eof
-- lib_b.e
   include lib_a.e as sublibrary -- all globals of lib_a.e
   global object B, C            -- are visible just in lib_b.e
      B = "bb"                   -- 'sublibrary' is a parameter, not
      C = "cc"                   -- a prefix of namespace
      A = "AA" & C
-- eof
-- my_app.ex
   include lib_b.e without C  -- global C of lib_b.e is invisible
   global object C            -- in my_app.ex
      C = "CC"
   
   include mu_app_plugin.e -- global C of my_app.ex is visible
                           -- in my_app_plugin.e
-- eof


I think, we can implement some useful things using new
parameters for old good key words 'with', 'without' and 'as'.
For now, I do not see any need of new keywords in Euphoria.

> I'd be interested in hearing from people other than us 3. :)

OK, did you listen to me, may I continue ?    smile


Regards,
Igor Kachan
kinz at peterlink.ru

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

Search



Quick Links

User menu

Not signed in.

Misc Menu