oli-lang / oli

Language specification and discussion
http://oli-lang.github.io
MIT License
5 stars 0 forks source link

Document first level lists #12

Open h2non opened 10 years ago

h2non commented 10 years ago

Like in YAML, but use double dash -- to define nested lists at the first level of the document:

--
block: value
- list, of, elements
'string literal'

Other possible tokens would be:

aalda commented 10 years ago

Could you please describe a real use case? I'm not very sure of understanding its intention.

h2non commented 10 years ago

Just take a look to this YAML example.

I want to introduce support to create first level arrays without using brackets

h2non commented 10 years ago

Link updated, sorry!

aalda commented 10 years ago

You mean an array of blocks?

h2non commented 10 years ago

that's it

aalda commented 10 years ago

What's wrong with expression?

[ 
  12, yes, 'cool'
  block: value
  [ John, age: 23 ]
]

It should coincide on the explained in issue #8. Either [] or -- or both.

h2non commented 10 years ago

List expressions explained in #8 only supports one dash -

Here is a representative use case

--
block: cool
yes # boolean
- 1, 2, 3
another block: yes

The above, compiled into JSON with the proposed double dash operator (--), will be:

[
  { "block": "cool" },
  true,
  [ 1, 2, 3 ],
  { "another block": true }
]

With this proposal, you can create first level arrays without wrapping it with brackets. I think this could be useful for common data structure use cases and provides a minor invasive sintax

aalda commented 10 years ago

I agree, but i think it should provide the two options for keeping it consistent.