From: Ken A. <kan...@bb...> - 2004-05-23 21:11:38
|
Here are two proposals: P1: Use as the quasistring delimiter {{ also inside a quasistring expression {{ starts an escape to Scheme. I think i found this approach in another web application and sent email to the group. The advantage is - you can keep the current syntax, if you only see { and use the new one if you see { - Only one character #\{ becomes special. - I'm guessing that "{{" is uncommon. P2: Common Lisp has a very flexible reader controlled by a read-table. (Once i sat down to work on a Lisp Machine that was reading in ALGOL syntax, boy was i suprised.) One way to extend CL was to add reader-macros that had the form #name where name was the name of a macro, typical one character, like #?. These are extensions of #t #f #(). Providing this facility would let anyone add a way of swithching syntax. For example, Rahul could have solved his javascript problem by using #js{....}, say. This proposal is just to add #... extension capability. P3: I've been interested in rewriting the JScheme (read) in Scheme as a finite state machine, and compile it into Java. This should be relatively easy because we only have a relatively small number of types and operations. This could either implement P2 or the full read-table approach. I guess i've vote for P1 as the easiest thing to do at this point. k At 07:12 PM 5/21/2004 -0400, Timothy John Hickey wrote: >That shouldn't be too hard. What delimiters would you suggest? > > >What would you think about some kind of general string delimiter say >like this > > {{+ Here is "some" {javascript} or {CSS} or arrays A[x] or ... > and here is a Scheme escape +[(Date.)]+ > hmmmm? +}} > >where the character following the > {{ >indicates the stop character for the string, in this case > + >and > +[ ]+ >would delimit the quasi-string escapes..... > >So you could equivalently use a period > > {{. Here is "some" {javascript} or {CSS} or arrays A[x] or ... > and here is a Scheme escape .[(Date.)]. > hmmmm? .}} > >or a double quote > > {{" Here is "some" {javascript} or {CSS} or arrays A[x] or ... > and here is a Scheme escape "[(Date.)]" > hmmmm? "}} > >and you could switch midway with each [...] providing an opportunity >to switch delimiters. For example, here we switch from " to * to @ > > > {{" Here is "some" {javascript} or {CSS} or arrays A[x] or ... > and here is a Scheme escape "[(Date.)]* > hmmmm? here is a square bracket "[" see? > maybe just switch for fun *[]@ hmmmm.. @}} > >What do you think? Would this have helped make the code cleaner >and the developers happy? > >What do other JSchemer's think of this notation? >Any other ideas for handling the string delimiter problem? |