From: Steve H. <sh...@zi...> - 2002-02-18 17:35:34
|
> Steve Howell [mailto:sh...@zi...] wrote: > > > > Any reason why it's _in_sigificant on single-line scalars > > > > but significant for multiline forms? Why not just have > > > > it significant everwhere. > > > > > > Same as leading white space... Otherwise you couldn't write: > > > > > > matrix: > > > - [ 1 , 2 , 3 ] > > > - [ 45 , 56 , 78 ] > > > > > > Leading and trailing white space are not part of 'simple' scalars. > > > > > > > Aren't inlines sort of a third case here? You would allow > > trailing white space > > in single-line and multi-line scalars, but not in inlined scalars? > > Nope. Currently, the same simple scalars are used for all in-line forms, > whether or not they are in an in-line list/map or not. Which makes sense; > there's no reason to have even more scalar styles (there are quite a few as > it is). > > If trailing white space was precluded one would have to write it as: > > matrix: > - [ 1, 2, 3] > - [ 45, 56, 78] I totally agree forcing them to write it this way is uncool. > > And the original example would be a matrix of strings '1 ', '2 ' etc. - that > is a rather unintuitive application error: 'matrix elements aren't > integers'. I think anyone seeing the above matrix would expect it to contain > integers... It is pretty strange to trim leading white space and not > trailing spaces. I guess what I was thinking is that inline scalars would get white space trimmed from both sides. Single line and multi-line scalars would not. Once the space got trimmed, you would use the same regexes for all forms of a scalar. Maybe another way of thinking it is that a carriage return can delimit trailing white space, but a comma can't, so you have to quote strings when you're inline. |