[racket-dev] problem with require and frtime
(Just to be clear, that wouldn't solve the problem this time. The `='
from `scheme' and `racket' are the same, but `frtime' has its own `='.)
At Thu, 19 Jan 2012 08:19:59 -0500, Matthias Felleisen wrote:
>
> Greg, how difficult would it be to migrate frtime to #lang racket? -- Matthias
>
>
>
> On Jan 19, 2012, at 8:13 AM, Matthew Flatt wrote:
>
> > The `frtime' language exports an `=' that isn't the same as `=' in
> > `racket', so that's why the pattern doesn't match. (This seems like a
> > further weakness of the `frtime' docs to specify the exports
> > precisely.)
> >
> > You could avoid bound names like `=' as literals in the macro.
> > Normally, it works best for a form-exporting macro to also export
> > bindings for any literals in the form. Otherwise, this kind of
> > confusion is common.
> >
> > Alternatively, you may want to match literals in your macro
> > symbolically instead of by binding. You can't do that easily with
> > `syntax-rules', but you can use `syntax-case*' and supply `(lambda (a
> > b) (eq? (syntax-e a) (syntax-e b)))' as the literal-comparison
> > function.
> >
> > If it were me and I decided to go in the direction of symbol equality,
> > I'd use keywords instead --- `#:?' and `#:=' instead of `?' and `=' ---
> > which makes clear that there's no question of binding.
> >
> >
> > At Thu, 19 Jan 2012 10:46:37 +0100, Marijn wrote:
> >> On 18-01-12 17:47, Matthew Flatt wrote:
> >>> At Wed, 18 Jan 2012 12:02:10 +0100, Marijn wrote:
> >>>> I would expect both forms to work. This is a reduction of a different
> >>>> problem possibly caused by these issues here.
> >>
> >> So I tried to cut down my program to a reasonably sized test-case which
> >> is attached to this email. model.rkt contains (what's left of) the model
> >> macro, demo1.rkt contains a small model and a (require frtime). If you
> >> do "racket demo1.rkt" then you get the following error:
> >>
> >>
> >> model.rkt:30:17: make-entry: bad syntax in: (make-entry (= profit
> >> (for/hash ((y years)) (values y (- (hash-ref income y 0) (hash-ref
> >> expenses y 0))))) (years income expenses profit))
> >>
> >> === context ===
> >> standard-module-name-resolver
> >>
> >>
> >> but if you comment the (require frtime) then the error goes away. I have
> >> other code that tests this same simple-economy model with the
> >> non-cutdown version of the model macro and supporting code and
> >> everything seems to work fine.
> >>
> >> Any idea what's going on here?
> >>
> >> Marijn
> >>
> >>
> ------------------------------------------------------------------------------
> >> [text/plain "demo1.rkt"] [~/Desktop & open] [~/Temp & open]
> >>
> >>
> ------------------------------------------------------------------------------
> >> [text/plain "model.rkt"] [~/Desktop & open] [~/Temp & open]
> >>
> >>
> ------------------------------------------------------------------------------
> >> [application/pgp-signature "signature.asc"] [~/Desktop & open] [~/Temp &
> open]
> > _________________________
> > Racket Developers list:
> > http://lists.racket-lang.org/dev