Op 27 nov. 2013, om 07:25 heeft Faré <fah...@gmail.com> het volgende geschreven:
>> Faré wrote: >>> That's an area where indeed maru could improve on CL, by e.g. >>> specifying a meta-quasiquote protocol for how quoting interacts with >>> user-defined syntax. >> >> It might be worth looking at E's quasiliterals design for ideas there. >> http://erights.org/elang/grammar/quasi-overview.html >> > It has some good ideas, but plenty of bad ideas too. > It makes ${0} ${1}, etc., without providing hygiene for cases where > users would like ${0} as an actual literal in the text (e.g. because > of recursive patterns). A kludgy solution along those lines would at > least use a cryptographic gensym to prevent collisions, and pass that > as argument in the expansion, and/or somehow escape the dollars in the > text. A real solution would have a notion of parametrized extensible > grammars, so that the escaping happens properly at all levels. A > formalization of this extension mechanism is what I'm seeking. > > E also falls short by distinguishing quasiquoting for expressions and > patterns ${x} and @{x}. The two should be dual and disambiguation > should happen from context, and to get the equivalent of E's ${x} in a > pattern context should just be @{kwote(x)}, where (kwote x) is as in > traditional Lisp: (defun kwote (x) (list 'quote x)). Quasiquotes and string interpolation are being added to Scala; these don't seem to have the two drawbacks that you mentioned for E's design. The $ may be escaped just by doubling: scala> val name = "foo" name: String = foo scala> s"my.package.$name$$" res0: String = my.package.foo$ http://stackoverflow.com/questions/16875530/escape-a-dollar-sign-in-string-interpolation As I understand from the links below, the $ variables should also work for pattern matching, but I don't get these to work yet (maybe I need a newer version). http://infoscience.epfl.ch/record/185242/files/QuasiquotesForScala.pdf http://docs.scala-lang.org/overviews/core/string-interpolation.html https://groups.google.com/forum/#!topic/scala-internals/AmZl7VqV_rk http://docs.scala-lang.org/overviews/macros/quasiquotes.html http://scalamacros.org/paperstalks/2013-04-22-LetOurPowersCombine.pdf page 8 http://parleys.com/play/51c16dffe4b0d38b54f46216/chapter0/about Presentation by Eugene Burmako: http://parleys.com/play/51c16dffe4b0d38b54f46216/chapter17/about Presentation by Adam Warski: http://vimeo.com/74553075 from 46:40 http://www.slideshare.net/adamw1pl/scala-macros slide 28
_______________________________________________ fonc mailing list fonc@vpri.org http://vpri.org/mailman/listinfo/fonc