2011-07-05, 10:46
Hi guys,
I'm currently rewriting the way the infomanager works (to make it more efficient) and have come across a whole heap of inconsistent stuff.
Currently we have the following syntax for boolean conditions:
1. Category and info:
2. Category and info, with a single parameter:
3. Category and info with two parameters (second may be optional):
4. Category and two parameters (second may be optional):
5. Category with (optional) id and info:
6. Category with (optional) id and info with id:
7. Category with (optional) id, info with (optional) id, and subinfo:
8. Category, info with id, subinfo:
9. Category with (optional) id, info with string parameter:
10. Category with (optional) parameter, info with string parameter:
11. Category and info with id:
It seems to me that we might be able to clean this up somewhat. In particular, the last one might be better written using syntax #5:
i.e. the basic overriding idea would be that the id or parameter is directly attached to the thing it represents. Similarly the string compare ones (syntax 5) could be rolled into syntax 10 by adding the "string" category:
So we'd basically drop everything down to the form:
Thoughts?
Cheers,
Jonathan
I'm currently rewriting the way the infomanager works (to make it more efficient) and have come across a whole heap of inconsistent stuff.
Currently we have the following syntax for boolean conditions:
1. Category and info:
Code:
player.ispaused
2. Category and info, with a single parameter:
Code:
system.hasalarm(name_of_alarm)
3. Category and info with two parameters (second may be optional):
Code:
system.date(date1[,date2])
skin.string(foo[,bar])
4. Category and two parameters (second may be optional):
Code:
isempty(info1)
stringcompare(info1,info2)
5. Category with (optional) id and info:
Code:
container(2).onnext
listitem(1).isfolder
listitem.isfolder
6. Category with (optional) id and info with id:
Code:
container(10).row(3)
container.column(4)
controlgroup(2).hasfocus(10)
7. Category with (optional) id, info with (optional) id, and subinfo:
Code:
container(10).listitem(offset).isfolder
container.listitem.isfolder
8. Category, info with id, subinfo:
Code:
musicplayer.offset(2).exists
musicplayer.position(3).hasnext
9. Category with (optional) id, info with string parameter:
Code:
listitem(4).property(foo)
listitem.property(bar)
10. Category with (optional) parameter, info with string parameter:
Code:
window.property(foo)
window(Home).property(foo)
11. Category and info with id:
Code:
control.hasfocus(10)
control.isenabled(11)
It seems to me that we might be able to clean this up somewhat. In particular, the last one might be better written using syntax #5:
Code:
control(10).hasfocus
i.e. the basic overriding idea would be that the id or parameter is directly attached to the thing it represents. Similarly the string compare ones (syntax 5) could be rolled into syntax 10 by adding the "string" category:
Code:
string(info1).equals(info2)
So we'd basically drop everything down to the form:
Code:
Category[(cat_params)].Info[(info_params)][.SubInfo[(subinfo_params)]]
Thoughts?
Cheers,
Jonathan