Config List Syntax Extension Proposal

61 views
Skip to first unread message

enobayram

unread,
Nov 12, 2015, 12:06:17 AM11/12/15
to orx-dev
As you know, most languages allow an empty element in the last position in comma-separated lists in order to allow long lists to be written like:
int a[] = {
  15,
  23,
  45,
};

The purpose is to be able to remove/move/add lines conveniently, without causing errors and without causing unnecessary merge conflicts.

I've been thinking about how to bring these desirable properties to orxConfig lists, and here's my suggestion:

[SomeSection]
SomeList #= 
  # item1
  # item2 # item3
  # item3
  # ; for an empty last element if desired, or you could still use ## at the end of the previous line.

As far as I can see, this syntax is invalid in current orx, so it won't cause any backward-compatibility issues, and it's also unambiguous.

iar...@orx-project.org

unread,
Nov 12, 2015, 12:39:13 AM11/12/15
to orx...@googlegroups.com
I've never been a big fan or lists ending with a separator, I find it sloppy in the same way missing new lines at the end source files or untrimmed line trailing spaces are. But I'm just a grouchy old fart. :)

That being said, I'm not entirely convinced by the proposal itself, I don't like to have a different assignment operator for that purpose.
How about simply allowing to start a list with # and ignoring it?

SomeList = # item1
# item2 # item 3
# item4

The first item would still need to be on the same line, is that too much a problem? If so, I guess I could modify the parser to look ahead for a # before deciding if it's an empty element or actually a split list.

If one needs an empty element at the beginning of the list, it'd work with a second # naturally:

SomeList = ## item1 ; <= first element is empty
...

also works as:

SomeList = #
#                  ; <= empty element
# item1
...


--
You received this message because you are subscribed to the Google Groups "orx-dev" group.
To post to this group, send email to orx...@googlegroups.com.
Visit this group at http://groups.google.com/group/orx-dev.

Enis BAYRAMOĞLU

unread,
Nov 12, 2015, 1:14:47 AM11/12/15
to orx...@googlegroups.com
The first item would still need to be on the same line, is that too much a problem? If so, I guess I could modify the parser to look ahead for a # before deciding if it's an empty element or actually a split list.
I think the first item on the same line would be a reasonable compromise for practical purposes. 

iar...@orx-project.org

unread,
Nov 13, 2015, 12:12:46 AM11/13/15
to orx...@googlegroups.com

2015-11-12 1:14 GMT-05:00 Enis BAYRAMOĞLU <enisbay...@gmail.com>:
he first item on the same line would be a reasonable compromise for practical purposes. 

Ok, I can even do the look ahead, I don't think it'd be much trouble. Could you open an issue for me?
Reply all
Reply to author
Forward
0 new messages