Leopold Toetsch <[EMAIL PROTECTED]> wrote:
> And it doesn't answer my question at all, sorry. Which HLLs are able to
> divide their symbols into above categories? Further: as this proposals
> deals with the managment of namespaces, a special typed interface for a
> 'namespace' symbol name seems not to be necessary, because if it
> weren't evident, where a namespace is used, we couldn't deal with
> namespaces at all.

I added that interface specifically because of Python. Namespaces in
Python are also variables, so any time a namespace is created, it must
be stored as a variable. This wouldn't be a problem, except that if
anything besides Python itself creates the namespace, it wouldn't be
added as a variable.

Of course, now that I think about it more, it's possible that nothing
else will be adding namespaces for Python. In which case I'd advocate
having Parrot keep track of namespaces in a separate hash.

> Remaining for me is the distiction between a variable and a function
> symbol:
>
> - python: no (all names are just names)

Correct. Variables, functions, and namespaces all collide.

> - tcl: afaik no (all names are strings)

Incorrect. You can have a variable, a function, and namespace with the
same name.

> - perl5: sometimes (via sigil, but $ref_tosub)
> - perl6: maybe (sigil is part of the symbol name, but $ref)

Functions, variables, and namespaces _are_ separate here. Don't let
the fact you can make a variable reference a sub throw you off. They
are separate entries in the symbol table and separate entities.

> To make use of this distinction (var, function) we'd need a pair of
> such languages, one that can do a typed export, and one that can do a
> typed import of symbols.

Not really. It's a useful distinction if one of the languages makes
the distinction. Let's take the case of Tcl and Python. Remember that
functions and variables overlap in Python but don't overlap in Tcl.

If you import a function from Tcl into Python, it should be a
variable. That's fine. add_sub can take care of that. That's the
intention. It'd work the same if you used add_var, but that doesn't
matter. The important thing is that Tcl doesn't need to know anything
about Python.

Importing from Python to Tcl is a different matter. Python's function
may be variables, but Python still knows that they're functions. So
Python can use add_sub to add the function to Tcl's namespace. This is
both useful and necessary because function and variable names don't
overlap in Tcl.

> What am I missing?

I hope this clears things up a bit.

--
matt diephouse
http://matt.diephouse.com

Reply via email to