On Sat, Sep 7, 2024, at 7:42 AM, Mike Schinkel wrote:
>> On Sep 6, 2024, at 4:45 PM, Larry Garfield <la...@garfieldtech.com> wrote:
>> Aliases can then be used only in parameter, return, property, and instanceof 
>> types.  Extends and implements are out of scope entirely.
>
> Is there a strong technical reason why extends and implements should be 
> out of scope? 
>
> There is definite utility for this, to create a local alias in a 
> namespace that can be used throughout the namespace rather than having 
> to refer to the external namespace in many different places.

Because it quickly can produce nonsensical syntax.

class A {}
class B {}

typealias AB: A|B;

// This is logically nonsensical.
class C extends AB {}

While there are edge cases where that might be logical (if A and B are 
interfaces and &-ed together, then it's kinda sorta the same as C implements A, 
B), separating those out and allowing just that subset sounds like a lot of 
work for dubious gain, and introducing surprise inconsistency.  Better to just 
avoid that entirely.

--Larry Garfield

Reply via email to