From: Brian I. <in...@tt...> - 2001-11-29 18:37:19
|
On 29/11/01 12:40 -0500, Clark C . Evans wrote: > Brian, thank you for humoring in-line collections, let's > try to get a resolution quickly, or come up with a mechanism > where we can defer the decision to a later date. Following > is a proposal that allows us to defer this decision till > later by reserving @ and % indicators. That said, if > we get agreement in the next day or so, I'd rather not defer. OK > The use-case driving us are small sequences, especially ================================= collections Absolutely. > coordinates, well-known tuples, etc. Without in-line > sequences, both of the examples below become multi-line. > > center: !point @ 1,2,3 > price: !currency @ USD,345.23 > > The examples above re-introduce the @ indicator for the > in-line sequence, where all items in an in-line sequence > are separated by a comma. We could even use this as an > implict way to mark an empty sequence; as the in-line > or next-line are just styles. > > empty: @ If we also limit this to a single line, I approve. > I have less sympathy for the in-line mapping. In > my opinion, this can be happliy omitted. However, > if we do decide to go there. I think it could > also have a radically different syntax. Agree on all counts. Especially the point that we are allowed to be different in this case. > in-line: !point % x=34,y=23 > > I don't see why we have to merge our syntaxes for > some hope of consistency. This was my struggle as well. Perl is heavy on the concept of "lexical texture". Making things look different so they are not tiresome on the mind. Trying to reduce things to a single syntax is more of an optimization for computers than humans. > If we go with an in-line sequence; between each > comma would have to be a in-line scalar form. > Otherwise we loose alot of power, as it would be > impossible to have compact use of integers, dates, etc. OK > The only "problem" with the above is that it doesn't > have a similar syntax for to our "next-line" sequence > or mapping styles. First, I'm not so sure that > we want them to have a similar syntax since the rules > are so very different. Second, I'm not positive > that we should re-visit our existing "core" syntax. Agree. Agree. Agree. > > table: > -@ name , rank , serial > -@ John Edwards, Private First Class , '392-283-3828' > -@ Martha Quip , Corporal , '328-383-4823' > -@ Pip Rothe , Sergeant , '248-283-2824' > > I like the different syntax actually... and note > the use of implicit scalar. Serial would have > matched the date format, so it had to be quoted. OK. So we allow *single_line* implicit and single line quoted. Great. > Given that the above syntax should work, and be > backwards compatible addition in the future; I'm > happy to defer till later. Wow. Even better. I hadn't thought of that. Great work. Cheers, Brian |