greycat icon indicating copy to clipboard operation
greycat copied to clipboard

[GCM] Sugar syntax suggestion for local index declaration

Open lmouline opened this issue 7 years ago • 3 comments

(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

lmouline avatar Sep 06 '17 08:09 lmouline

I think this is too dangerous, and only useful when you want to have a tree hierarchy (folders for instance).

gnain avatar Sep 06 '17 09:09 gnain

I am sorry but I have difficulties to get you point :/ Why it could be dangerous?

lmouline avatar Sep 06 '17 11:09 lmouline

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.

gnain avatar Sep 06 '17 11:09 gnain