New to fantom. Currently evaluating for use in a new project.
Has any thought been given to something of the following syntax:
class MyList { MyItem this[Int itemIndex] { getter... setter... } }
or
class MyMap { MyItem this[Str itemName] { getter... setter... } }
then
class MyObj { MyList childList } class MyObj { MyMap childMap }
This would make the following syntax possible:
myObj.childList[33].propVal myObj.childMap["itemName"].propVal
Or, because I'm new to Fantom, maybe this is possible today.
You already could do this without special syntax:
class MyList { @Operator MyItem get(Int itemIndex) { /* getter */ } @Operator Void set(Int itemIndex, MyItem item) { /* setter */ } } class MyMap { @Operator MyItem get(Str itemIndex) { /* getter */ } @Operator Void set(Str itemIndex, MyItem item) { /* setter */ } }
Cool! Thanks.
Login or Signup to reply.
rhodes Sat 8 Sep 2012
New to fantom. Currently evaluating for use in a new project.
Has any thought been given to something of the following syntax:
or
then
This would make the following syntax possible:
Or, because I'm new to Fantom, maybe this is possible today.
Yuri Strot Sat 8 Sep 2012
You already could do this without special syntax:
rhodes Sat 8 Sep 2012
Cool! Thanks.