On Fri, Mar 11, 2005 at 03:58:13PM +0100, Thomas Sandlaß wrote:
: Int @i;
: Num @n = @i; # type error?

I think the naive user is going to expect that to work, and I also
suspect the naive user is right to expect it, because it makes sense.
This may be one of those areas where we can successfully hide the
high-falutin' theory from mere mortals simply because it maps onto
what they expect already.

On the other hand, that's an assignment, which presumably copies
value types.  Binding is another matter--I wouldn't necessarily expect
this to work:

    Num @n := @i;

But these might be made to DWIM since copying is allowed:

    Num @n is copy := @i;
    Num @n is constant := @i;

On the other hand, the plain rw binding *could* be made to work under the
view that @n is providing a view of @i.  It's just that @n could provide
only the Int subset of semantics.  As such, it's acting as a kind of tie
on @n, so I expect it wouldn't be allowed unless you declared @n to
be some kind of tyable that allows delegating @n to @i.  Plus the variable
type would have to capture the binding semantics and force the delegation
past the compiler (presuming the compiler cares about the type mismatch).

But it's okay to disallow some things now on the basis that they're just
not implemented yet, as long as people don't mistake such restrictions
for strong typing.

Larry

Reply via email to