[racket] eval in a module language

7 views
Skip to first unread message

Joop Ringelberg

unread,
May 31, 2012, 3:36:55 PM5/31/12
to us...@racket-lang.org
Hello all,

I write a program in Racket that I subsequently compile with Bigloo. So I restrict myself to forms and functions known to Bigloo. In order to ease the transition between the two, I've created a module language that recognizes (a subset of) Bigloo module statements. This works well enough: in Racket, the Bigloo modules are converted to plain racket modules and Bigloo recognizes its modules, too.

However, I run into a problem with eval. 

When I use the following sequence in such a module:

(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))
(eval (x 1) ns)

I get the message:
procedure application: expected procedure, given: #<void>;

The same example would work in a context where racket is used (no error messages).

This is part of the module language file:

(define-syntax-rule (module-begin (module moduleName clause ...) stmt ...)
  (#%module-begin
   clause ...
   stmt ...))

The above three expressions would wind up in the stmt's.
I think that the namespace anchor is not defined in the right phase. However, I don't know how to change that. But maybe I am wrong.

Any suggestions?

Thanks in advance,

Joop Ringelberg

Matthias Felleisen

unread,
May 31, 2012, 5:34:22 PM5/31/12
to Joop Ringelberg, us...@racket-lang.org

On May 31, 2012, at 3:36 PM, Joop Ringelberg wrote:

>
> (define-namespace-anchor a)
> (define ns (namespace-anchor->namespace a))
> (eval (x 1) ns)
>
> I get the message:
> procedure application: expected procedure, given: #<void>;
>


This is not enough code. What is x? Do you mean '(x 1)? -- Matthias

____________________
Racket Users list:
http://lists.racket-lang.org/users

Joop Ringelberg

unread,
Jun 1, 2012, 3:39:29 AM6/1/12
to Matthias Felleisen, us...@racket-lang.org
Matthias,
I apologise for the incomplete example.
And I apologise, too, for the email: it turns out to be a false alarm.
On stripping my module language file to make a small and complete example I noticed that I had included a syntax-rule for the bigloo module expression keyword "eval" - effectively ignoring it which of course explains what happens.
Thank you.
Joop


On Thu, May 31, 2012 at 11:34 PM, Matthias Felleisen <matt...@ccs.neu.edu> wrote:

On May 31, 2012, at 3:36 PM, Joop Ringelberg wrote:

>
> (define-namespace-anchor a)
> (define ns (namespace-anchor->namespace a))
> (eval (x 1) ns)
>
> I get the message:
> procedure application: expected procedure, given: #<void>;
>


This is not enough code. What is x? Do you mean '(x 1)? -- Matthias




--
06 26 148 310
Postbus 126
6950 AC Dieren

Parkweg 27, 
6994 CM De Steeg



Reply all
Reply to author
Forward
0 new messages