4 ms·
> On a separate note, why is "contract" becoming a keyword instead of "type foo contract {}"? I was wondering about this too. It also just feels really weird s
by dilap 7y ago
> On a separate note, why is "contract" becoming a keyword instead of "type foo contract {}"?
I was wondering about this too. It also just feels really weird since it's a different construction than any of the other types.
Maybe the thinking is because a contract is not a type? But so what...
On first blush, it also feels weird that type is coming _before_ the type arguments, rather than after -- since types for normal arguments come after the argument.
E.g.,
Map(T, U type)(t []T, f func(T) U) []U
feels much more consistent than
Map(type T, U)(t []T, f func(T) U) []U
no? (Perhaps it complicates parsing, though?)
- DangitBobby 7y agoI think calling it a type would be confusing. It's not a type, it's a description of a behaviors of potential types.
- ithkuil 7y ago"var n int" means "in this scope, declare variable n to be if type int". "type T adder" means "in this scope, declare T to be a type adhering to the adder contract"
- dilap 7y agoGood way to think of it.