I can define a class like so in a racket repl that I start from my shell. I'm using v6.12
(define book-class%
(class object%
(field (pages 5))
(define/public (letters)
(* pages 500))
(super-new)))
Everything works fine. But when I try the same in emacs, executing the expression via C-x C-e
, the output is
; class: undefined;
; cannot reference undefined identifier
Writing the same definition directly in the emacs racket shell shows the same error.
Why is this happening and how can I change my repl to allow the creation of classes?
racket/class
by writing(require racket/class)
. – Alexis Kingracket/class
is part ofracket
, but notracket/base
. An as far as I knowracket-mode
in Emacs defaults toracket/base
. – soegaard