I stand enlightened. I hadn’t ever tried… I would be a fan of having the names alias and newtype. Though alias isn’t that descriptive either, maybe type is just fine.
(EDIT: iopq’s suggestion to have both seems good, but I haven’t yet touched associated types, either.)
Like @Nemikolh pointed out alias looks quite bad in context of associated items maybe there is a name witch clearly says that it is not a new type without making associated types look bad
What do you think about typename witch clearly points out that it’s just a additional type name and nothing more?
the specific choice of name for this keyword really doesn’t matter. there’s precedent for the current version but however it’s spelled it has the same meaning. people will learn either way.
pursuing apparent syntactic consistency at the cost of overloading semantics, such that “use” meant multiple different things in different contexts, would be counterproductive.
I was thinking about a new type definition syntax:
turn
struct Foo;
struct Bar<T> { value: T }
into
type Foo: ();
type<T> Bar: struct { value: T };
.
It’s just like bounds,
fn foo<T: Trait>() {}
means T is not as type Trait but fits the limitation of Trait.
So we don’t change much to unify the enum/struct definition syntax, and we find a new way to distinguish alias type and defining new type.
Current struct/enum definition syntax can remain as syntax sugar.