On Fri, 2009-12-04 at 19:27 -0800, Derick Eddington wrote: > I think I like the idea of making the lexical syntax extensible via > continuable exceptions raised by the read procedure. (IIRC, this was > mentioned at r6rs-discuss before R6RS was ratified, but I don't know how > much it was discussed.) If read encounters a string it doesn't > understand, it raise-continuable's a condition which contains the string > consumed so far and the port (whose position is immediately after the > string). The lexical syntax can be extended by having an exception > handler use the condition to process the custom syntax and return > whatever type of value it wants. read will place that value in the > being-constructed data structure corresponding to where the custom > syntax started and continue trying to read more from where the handler > left the port's position.
Note that this is more powerful than readtables where all extensions must be prefixed with the # character (which Aziz hates). With the above idea, any non-standard lexical syntax could be used (I think), because read can be parsing something which so far looks standard but then encounters a non-standard character and delegates to the handler, giving it the string (whose last character is the non-standard one) and port. I.e., things like +1 could be read as the symbol equal to (string->symbol "+1") -- : Derick ----------------------------------------------------------------
