Syntax consistency for types and calls for `xyz.this`
In nested features
a is
b is
c is
The syntax for a type and a call is the same, with the only exception that a call might need actual arguments and a type may need actual type parameters:
x a.b.c := a.b.c # `a.b.c` as type of `x` and as a call
f(p a.b.c) a.b.c is # `a.b.c` as argument and as result type
if cc then
p
else
a.b.c # `a.b.c` as call
However, the situation is different for this:
a is
b is
c is
f c.this.type is c.this # `c.this.type` vs. `c.this`
g c is c # `c` vs. `c' (the type will be expanded to `a.b.this.type.c`
h b.this.type is b.this # `b.this.type` vs. `b.this`
i b.this.type.c is b.this.c # `b.this.type.c` vs. `b.this.c', type syntax currently not possible
j a.this.type is a.this # `a.this.type` vs. `a.this`
j b.c is b.c # `b.c` vs. `b.c` (the type will be expanded to `a.this.type.b.c`)
j a.this.type.b.c is a.this.b.c # `a.this.type.b.c` vs. `a.this.b.c`, type syntax currently not possible
The idea is to use the same syntax for types, i.e., the previous example would be
a is
b is
c is
f c.this is c.this # `c.this` vs. `c.this`
g c is c # `c` vs. `c' (the type will be expanded to `a.b.this.c`
h b.this is b.this # `b.this` vs. `b.this`
i b.this.c is b.this.c # `b.this.c` vs. `b.this.c'
j a.this is a.this # `a.this` vs. `a.this`
j b.c is b.c # `b.c` vs. `b.c` (the type will be expanded to `a.this.b.c`)
j a.this.b.c is a.this.b.c # `a.this.b.c` vs. `a.this.b.c`
The syntax a.b.type would still exist and, when used as an expression, return the type feature instance for a.b. When used as a type, a.b.type could then be equivalent to just Type, which currently is the type inferred from a.b.type, e.g. in code like t => a.b.type.
Does this make sense, or is this confusing?
Generics would not really change much here, I imagine? It would just be a parameter, e.g.:
a(T type) is
b is
c is
j (a T).this is (a T).this
Currently I can't think of a case where this could be confusing.
@fridis I think this can be closed?