mkobetic | 4 Jan 2011 15:18
Picon

Re: Namespaces (Was: MNU in tools after loading parcel)

I might be missing something, but AFAICS the proposed change doesn't actually prevent ambiguities. It
just lays down a rule how to resolve them. That however doesn't necessarily mean that the resolution will
always match what you want it to be. You're still open to the problem of someone modifying a namespace
you're importing and suddenly changing the meaning of a name in your namespace, but this time without any
warning. I suspect that what you're proposing was considered in the original design and rejected in favor
of warning about ambiguities and forcing an explicit resolution.

"Reinout Heeck"<vwnclist <at> soops.nl> wrote:
> The current namespace implementation gives us this weird construct of 
> 'Ambiguous reference'.
> It seems this construct introduces a sort of brittleness that we can do 
> without. (If I load a third-party package that is unrelated to my code 
> it may invalidate my code because one of my references suddenly becomes 
> 'ambiguous').
> 
> If the imports mechanism were altered to declare imports as a stack 
> instead of a set, and the lookup rules are altered to stop searching 
> after its first (nearest!) match this class of brittleness goes away. 
> Instead it is replaced with a more manageable one that runs parallel to 
> the brittleness scenarios we know in class inheritance. (Indeed the 
> whole name import mechanism will feel a lot more like the method lookup 
> rules we already know very well).
> 
> So I propose that import declarations be interpreted as an import stack 
> instead of an import set, and note that then technique a) below becomes 
> default/automatic without us needing to know any rules about what 'type 
> of import trumps another type' -- simply because that would be explicit 
> in the ordering in an import declaration.
> 
> There is a silver lining to the 'ambiguous reference' construct: it has 
(Continue reading)

Reinout Heeck | 4 Jan 2011 16:05
Picon
Favicon

Re: Namespaces (Was: MNU in tools after loading parcel)

On 1/4/2011 3:18 PM, mkobetic <at> gmail.com wrote:
> I might be missing something, but AFAICS the proposed change doesn't actually prevent ambiguities. It
just lays down a rule how to resolve them.

IOW, from the perspective of the system ambiguities don't exist: all 
code/classes dealing with detecting ambiguities can be removed.

So we are saying the same thing -- form a different perspective.

To drive it home: the system has no implementation to model 'ambiguous 
method' in a class hierarchy, so why does it have/need a model for 
'ambiguous reference' in a namespace import structure?

>   That however doesn't necessarily mean that the resolution will always match what you want it to be. You're
still open to the problem of someone modifying a namespace you're importing and suddenly changing the
meaning of a name in your namespace, but this time without any warning.
Exactly as could happen when some package extends a superclass of one of 
my application classes.

> I suspect that what you're proposing was considered in the original design and rejected in favor of
warning about ambiguities and forcing an explicit resolution.
Exactly, my comment was intended as feedback on that very decision:
    in practice we find that the system throws non-errors in our face 
long after we coded up a module.
Forcing resolution of non-problems is where this went awry.

If the proposed lookup architecture were used a lot of those purported 
ambiguities would not arise (as in: they would get resolved as 
originally intended),
of course some would still lead to errors.
(Continue reading)


Gmane