- From: Andy Seaborne <andy@apache.org>
- Date: Sun, 14 Sep 2014 10:44:24 +0100
- To: Ivan Herman <ivan@w3.org>
- CC: Dan Brickley <danbri@google.com>, W3C CSV on the Web Working Group <public-csv-wg@w3.org>, Axel Polleres <axel.polleres@wu.ac.at>
On 14/09/14 08:39, Ivan Herman wrote: > The complexity of alt-1 comes from, e.g., flow control. But not only. > If we allow for a, say, replace, we would have to have a syntax (and > processing) of extra parameters. One extra step may be something > like > > {{name.filter1("regexp").filter2}} > > which may still work (and, of course, it may be used for other > purposes, too, like date formats), but would we go again one step > further and say something like > > {{name.filter1({{name2}}).filter2}} > > ie, having some sort of a recursive macro? We are heading, in my > view, back to Alternative 1, ie, a complex language to specify, > implement, test, etc. That is what I called 'floodgates'... That's not recursion :-) just plain function nesting. We may not even want that but it is not a technical problem. Spreadsheets get their complexity because cells themselves can contain formulae and so when one cell can name another cell, it means there can be dependency loops. In a CSV file, the cells are only atomic values and everything bottoms out without dependency loops. Andy if you want an outline proof :-) An evaluation algorithm, not necessarily the best, is: 1/ Find inner most {{}} if none, we're done. 2/ Evaluate that expression. This is not another {{}} because that would be a "more inner". 3/ Replace {{}} by the result. 4/ Goto 1 That is not going to go on forever as you step out one level of {{}} each time. No pointers, no way to write anything other than a tree. And you're not going to encounter an another formula while doing the evaluate because the inner most {{}} does not contains another {{}}. if name2 is "foo" and name is "foobar" {{name.stringafter({{name2}}).uppercase}} --> {{name.stringafter("foo").uppercase}} --> {{"foobar".stringafter("foo").uppercase}} --> {{"bar".uppercase}} --> "BAR" c.f. "let" vs "letrec" => ftp://ftp.cs.utexas.edu/pub/garbage/cs345/schintro-v14/schintro_66.html
Received on Sunday, 14 September 2014 09:44:54 UTC