[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] (dynamic) lexical extensions



On 11/05/12 12:37 AM, John Cowan wrote:
> All such systems have phasing problems analogous to those created by 
> low-level macros, only worse.
Indeed, these extensions raise problematic evaluation issues, with R7RS 
libraries (and thread considerations) bringing a more complex 
compilation and runtime model than the simpler declarative top-level 
program structure of R5RS.

Hence I was searching for hints in R7RS (library forms, parameters, 
#!case-fold-like syntax) that would allow to get these lexical 
extensions correctly integrated.

> Here's an idea I've been kicking around, though: to generalize 
> quasiquote, which is a lexical syntax that generates a prescribed 
> syntax form. For example, `#foo 32` could be rewritten as (lexical-foo 
> 32). It's then up to you to define a macro named lexical-foo, about 
> which the reader knows nothing, just as it knows nothing about the 
> standard macro `quasiquote`. This would only work in code; to make 
> something similar work for data, you'd need to walk the result 
> returned by `read`. Comments? 

Well, as for #,(foo 2012-05-11), #foo 2012-05-11 implies that the reader 
scan and tokenize 2012-05-11 before passing it to the "foo" (or 
"lexical-foo") macro handler.  It looks to me like a syntactic 
extension, not a lexical one.  I don't see how dates, for example, could 
be made to look like first-class objects with this approach.  Also, the 
"only works in code" part breaks the property that code is a subset of 
data (unlike the lexcial extensions I am using).


Since the number of extensions used over the past years has been quite 
limited (mainly: dates, times, XML fragments), maybe the easiest way to 
correctly integrate these with libraries and environments is to forget 
about the dynamic nature of this experiment and bury the useful 
extensions in the core interpreter (as with extensions about admissible 
symbols, for instance).

Regards,
-- 
Daniel Villeneuve
AD OPT, a Kronos Division


_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports