Nathan Sharfi [mailto:nisharfi@...] wrote:
> > My suggestion:
> >
> > true: .+
> > false: .-
> >
> > The dot is already used in several implicits? YAGNI or what?
>
> My personal opinion (as a non-implementer), your mileage may
> vary, void where prohibited:
>
> Yuck.
:-) I tend to agree, however.
> I'd sooner go for
> (+) and (-), but four (hold down shift and press =,9, and 0)
> and five (hold shift, press 9, release both, press -, hold
> shift, press 0) keypresses also stinks in its own way.
Yes, not to mention both variants aren't very intuitive. I suggest that
as an interim step we'll allow y/Y/n/N as Boolean shorthands (that's a
common usage anyway):
true: y
false: N
In addition, I figured out a way that we can keep '-' and '+' as
implicit Booleans (sort of). However it is... Well... Judge for yourself
:-)
We could allow '-' as a plain value only when it is not ambiguous. The
full list of cases where it is not ambiguous is:
As *in-line* value: -
As next line *typed* value:
! -
! - : As a *typed* key
In flow map: { - : false, false: - }
In flow seq: [ -, + ]
It would only be ambiguous when used as non-typed key or non-typed
next-line plain scalar:
- : Ambiguous # Null map-in-seq key)
Ambiguous:
- # Null seq entry?
Neither of these are common use cases. The only common use case we
really care about, for config files etc., is the use as in-line value
above.
So we could leave '-' and '+' in as implicit Booleans by qualifying the
'plain' productions with the appropriate restrictions. I'm not certain
that the undeniable benefits of allowing -/+ for Booleans outweigh the
costs of adding such a complication to the YAML specifications.
Thoughts?
Have fun,
Oren Ben-Kiki
|