Open h2non opened 10 years ago
Could you please describe a real use case? I'm not very sure of understanding its intention.
Just take a look to this YAML example.
I want to introduce support to create first level arrays without using brackets
You mean an array of blocks?
that's it
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.
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
I agree, but i think it should provide the two options for keeping it consistent.
Like in YAML, but use double dash
--
to define nested lists at the first level of the document:Other possible tokens would be:
>>
(overloading the operator)::
->
^^