Thanks for the ref, Chris. I'll take some time to absorb it. On Tue, Sep 24, 2013 at 1:46 AM, Chris Warburton <[email protected]>wrote:
> David Barbour <[email protected]> writes: > > > Text is also one of the problems I've been banging my head against since > > Friday. Thing is, I really hate escapes. They have this nasty geometric > > progression when dealing with deeply quoted code: > > > > {} -> {{\}} -> {{{\\\}\}} -> {{{{\\\\\\\}\\\}\}} -> > > {{{{{\\\\\\\\\\\\\\\}\\\\\\\}\\\}\}} > > > > I feel escapes are too easy to handle incorrectly, and too difficult to > > inspect for correctness. I'm currently contemplating a potential > solution: > > require all literal text to use balanced `{` and `}` characters, and use > > post-processing in ABC to introduce any imbalance. This could be > performed > > in a streaming manner. Inductively, all quoted code would be balanced. > > The geometric explosion comes from the unary nature of escaping. It > wouldn't be too difficult to add a 'level', for example: > > {} -> {{\0}} -> {{{\1}\0}} -> {{{{\2}\1}\0}} -> > {{{{{\3}\2}\1}\0}} > > The main problem with escaping is that it is homomorphic: ie. it is > usually "String -> String". This is basically the source of all code > injection attacks. It wouldn't be too bad if escaping were idempotent, > since we could add extra escapes just in case, but it's not so we end up > keeping track manually, and failing. > > There's a good post on this at > > http://blog.moertel.com/posts/2006-10-18-a-type-based-solution-to-the-strings-problem.html > > It would be tricky to implement a solution to this in a way that's open > and extensible; if we're be passing around first-class functions anyway, > we could do Haskell's dictionary-passing manually. > > Cheers, > Chris > _______________________________________________ > fonc mailing list > [email protected] > http://vpri.org/mailman/listinfo/fonc >
_______________________________________________ fonc mailing list [email protected] http://vpri.org/mailman/listinfo/fonc
