greycat
greycat copied to clipboard
[GCM] Sugar syntax suggestion for local index declaration
(cc @thomashartmann )
IMHO, it could be cool to allow this (in addition to the current declaration):
class A {
att name: String
index idxA using name
}
The default local index type could be the class type in which it is declared
I think this is too dangerous, and only useful when you want to have a tree hierarchy (folders for instance).
I am sorry but I have difficulties to get you point :/ Why it could be dangerous?
Dangerous in the sens that, if the type is not mandatory, developers might get troubles finding why the index is not generated properly (in the case they just forgot the Type)
It can moreover be Ambiguous. Consider this
class A {
att name: String
index idxA using name
}
class B extends A {
}
What would be the type of objects in the index in Class B ?
Another point is that you want to "locally" index instances from another class in the general case. For simplicity (of grammar and checkers) and uniformity, I would not recommend this feature.