On Mon, Mar 23, 2020 at 05:55:14PM -0400, George Neuner wrote: > On Mon, 23 Mar 2020 16:57:26 -0400, Hendrik Boom > <[email protected]> wrote: > > >On Mon, Mar 23, 2020 at 02:46:53PM -0400, George Neuner wrote: > >> On Mon, 23 Mar 2020 01:45:40 -0700 (PDT), Yongming Shen > >> <[email protected]> wrote: > >> > >> >I have the following as `module-that-defines-fib`: > >> > > >> > #lang racket > >> > (provide fib) > >> > (define fib "fib") > >> > > >> >And this is the error that I got (using Racket 7.6): > >> > > >> > ; application: not a procedure; > >> > ; expected a procedure that can be applied to arguments > >> > ; given: "fib" > >> > ; [,bt for context] > >> > >> > >> I've run into this problem before ... I don't recall the official > >> explanation, but my takeaway was that Racket does not permit you to > >> directly *export* a value - you have to export a function or macro > >> that produces the value. > > > >That seems like an extremely arbitrary restriction. > > Well, Racket considers exported objects to immutable. You can export > a simple value (e.g., "foo" or 42) but it can only be used as a > constant. If what you need is a module variable then the only way to > expose it is via an access function.
That makes sense. Or I suppose you could build a one-element mtable array and export that. The you still can't change the variable, but can change teh value inside it. -- hendrik > > AFAIHS, the OP has not shown us the code which uses the provided > object, so we really don't know what it was trying to do when the > error occurred. > > George > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/p9bi7fpigiqm3tc3togm4vmontlv5v70ti%404ax.com. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200324001128.u5rp6pw677lbhleg%40topoi.pooq.com.

