Re: Namespaces

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

David wrote:
> > I don't the namespace solution (hack ?!) of using
> > the filename. Instead, do something like this, to
> > avoid the whole global/local/naming issue:
>
> Wait for the next release. If it's still broken, complain again. smile

Yes, but I just don't want variable names to get any longer than they
already are. I don't want the filename as part of the variable name. Look:

include foo.py do
  def x as x
  def y as y
  def foo_circle as circle
end include

foo_circle (3, 6)

Why ? Because of these advantages:
  - shorter variable names
  - no collision with variables that are not used.
  - you see precizely what variables are "imported"

Secondly, you should only be able to import global variables. Local
variables are "hands-off". Otherwise there is no way to lock an include, and
the type of errors and issues you have to deal with. No way.

>    for i in 10
>
> is probably too much of a hack, though.

Well indeed, its not that nessecary. But I don't consider for-each to be
more than just an easy to use notation. Example:

for each item in call_func () do

end for

PS. How do like:

find each ' ' in "Hello World, how many spaces ?" as pos do
 printf (1, "Found a space at %d \n", {pos})
end find

> > - Where is the { left, middle, right }  = my_func () notation ?
>
> An example, please?

{ eof_status, value } = get (0)

> > And how to procedures work now?
>
> The same as functions, but you ignore the result. For example:

Yes, but what if there is NO result ? Are you forced to return an result ? I
prefer functions & procedures, without enforcing the end user to use the
return value, but also without enforcing the routine to return a value.

Cheers,

Ralf N.
nieuwen at xs4all.nl
UIN: 9389920

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

Search



Quick Links

User menu

Not signed in.

Misc Menu