Jon Lang elaborated:

> I don't think that there will be a problem.  First, #=> is easy enough
> to distinguish from #=; I don't foresee any confusion.

I'm not so sure. #=> is a lot more like #= that =alias is. And the one
character of difference is on the non-significant (right-hand) side.
Need to think about it and role-play it a little.

> With the ability to attach multiple declarator blocks to a single
> declarator, it should be trivial to replace any one of them with a
> declarator alias:
>    #=>
>    class Foo {
>        #= Class Foo
>        #= a sample class used to illustrate.
>        #= This particular class has nothing in it.
>    }

See that's precisely my problem. I don't think the #=> stands out at all
there as being an alias.

>    #= Class A<class>
>    class Foo {
>        #= a sample class used to illustrate.
>        #= This particular class has nothing in it.
>        #=> X<this assigns to the 'class' declarator alias.>

And this illustrates my other qualm, that the two forms are just too similar.

And, yes, having the aliasing mechanism be something postfix(able) creates
issues of when the aliases come into existence.

> I tend to agree.  I only proposed numbering as a way of being able to
> access different declarators without having to explicitly label them.
> I can definitely understand if this option gets dropped as being too
> error-prone with regard to maintenance.

That's my plan.

>>    =alias
>>    class Database::Handle {
>>        =alias
>>        has IO $!handle;
>>        =alias open
>>        my Bool method open ($filename) {...}
>>        =alias close
>>        my Bool method close() {...}
>>        =for para
>>            Note that the A<open> method of class A<class>
>>            stores the resulting low-level database handle
>>            in its private A<has> attribute, while the A<close>
>>            method closes that handle.
>>    }
> The problem with this example is that '=alias name' isn't a declarator
> alias; it's a block alias.

I'm proposing to change that and allow explicit names on declarator
aliases as well.
Or, rather, to unify the two into a "block-or-declarator" alias.

>        my Bool method open ($filename) {...} #=>[m1] #= Here's a
> block for A<m1>.
>        my Bool method close () {...}         #=>m2
> And given that brief names are going to be preferred, this could
> result in very compact, yet still readable, combinations of declarator
> aliases and blocks.

Yes, this is a definite advantage of the proposal. No question.
But I'm still concerned that the two syntaxes are just so similar.
I'll continue pondering the trade-off.


Reply via email to