Re: weird symbols in sc-expand output (was Re: defining module from macro)
"Scott G. Miller" <[email protected]>
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 23, 2006 at 06:08:47AM -0700, Dan wrote: > Thanks a lot. That does seem to work. > > I don't understand why in some cases #%quote can be > typed in, and in other cases not. This is what mislead > ne. E.g. Well, first off, these values are totally unsupported items that underpin SISC for implementation purposes only. They exist to provide an unforgeable value that only ever means what the form really means, and can't be redefined. The syntax-expander expands code into these forms for generated code, so that when for example an 'if' is needed to implement a core Scheme macro despite the presence of redefinition by the user, #%if can be emitted and guarantee that. > > #;> (let ((x #%quote)) x) > Error: invalid context for syntax-identifier quote. During syntax expansion, psyntax is not only expanding forms, but checking correctness. In this case, it discovers that what is a core syntactic form (quote) isn't being used as such, and emits an error. > > but > > #;> (eq? 'a #%quote) > #f > #;> (define x #%quote) > #;> x > #%quote In both these cases, #%quote just happens to be in a spot which doesn't get processed as deeply by psyntax and so the error isn't caught. All of this is totally unsupported, so there aren't any guarantees about any specific behavior anyway. Scott > > > --- "Scott G. Miller" <[email protected]> > wrote: > > > On Wed, Aug 23, 2006 at 04:50:20AM -0700, Dan wrote: > > > Scott, please help me out. I just need to go from > > the > > > entities #%quote, #&lambda etc to the symbols > > quote, > > > lambda etc. Nothing complicated, just a > > suggestion. > > > symbol->string doesn't work on them, they can't be > > > typed in... what can I do? > > > > You could create a similar function, for example: > > > > (define (syntoken->symbol token) > > (case token > > ((#%quote) 'quote) > > ((#%begin) 'begin) > > ((#%lambda) 'lambda) > > ((#%define) 'define) > > ((#%letrec) 'letrec) > > ((#%program) 'program) > > ((#%set!) 'set!) > > ((#%if) 'if) > > ((#%annotate) 'annotate) > > (else (error 'syntoken->symbol "Invalid syntax > > token '~s'" token)))) > > > > Or use an association list. > > > > Cheers, > > Scott > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com -- ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642