Re: Need to change parse-hash in reference implementation Alan Manuel Gloria 05 Apr 2013 04:52 UTC
On 4/5/13, David A. Wheeler <email@example.com> wrote: > I think we need to modify the reference implementation, in particular, > parse-hash's calling conventions. This procedure is called when something > begins with "#", since a whole lot 'o stuff starts with "#". > > Currently, it only returns #f, () for comments, and (value) for values. > That means that only neoteric-expressions can follow them quasisyntax. But > if we're going to allow expressions like this: > #' > ! ... stuff ... > In the same way we handle quote ('), then parse-hash needs to be able to > return something that indicates that it found a #' followed by whitespace. > That way, it can let the sweet-expression processor handle the rest. To do > that, we need to expand what, exactly, parse-hash and friends can return. > > I suggest using the same return convention as existing procedures like > n_expr, which return "(stopper value)". If stopper is 'normal, it's just a > normal value. If stopper is 'abbrevw, then it is an abbreviation followed > by whitespace, and "value" is what the abbreviation stands for (e.g., quote > or quasisyntax). This is how the code *already* works for quote, > quasiquote, and so on, so it should be straightforward. Could be. The intent was to make parse-hash's interface very simple, and that #' #` #, #,@ would be processed by the main parser without calling parse-hash. Either that original intent or your new proposal will work. However it *does* put the onus on the scheme-system-specific code to add #' and friends, and as far as I know most scheme systems would either happily live with #' == syntax or not really care that much about what #' is. I suggest putting #' and friends in the main parser, unless someone strenuously objects on the grounds that #' is being actually *used* to mean something other than (syntax ...) Sincerely, AmkG.