- From: Ivan Herman <ivan@w3.org>
- Date: Sun, 14 Sep 2014 14:49:50 +0200
- To: Andy Seaborne <andy@apache.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>
- Message-Id: <92076FC4-D9C5-489B-BEC0-5B1FBCF88FBB@w3.org>
On 14 Sep 2014, at 11:44 , Andy Seaborne <andy@apache.org> wrote: > 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. True, I stand corrected:-) I still find it too complex for what we want to achieve... Ivan > > 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 > > ---- Ivan Herman, W3C Digital Publishing Activity Lead Home: http://www.w3.org/People/Ivan/ mobile: +31-641044153 GPG: 0x343F1A3D WebID: http://www.ivan-herman.net/foaf#me
Received on Sunday, 14 September 2014 12:50:31 UTC