providing classes from a module

18 views
Skip to first unread message

Tim Meehan

unread,
Oct 2, 2019, 4:09:40 PM10/2/19
to Racket Users
Say for instance, I have a class in "tastyfish.rkt"

#lang racket
(require racket/class)

; What `provide` statement would I put here so that another module
; (like "market.rkt" for instance) can require fish%?

(define fish%
  (class object%
    (super-new)
    (init size)
    (define current-size size)
    (define/public (get-size)
      current-size)))

Jack Firth

unread,
Oct 2, 2019, 4:12:44 PM10/2/19
to Racket Users
(provide fish%) ought to work. Classes created with racket/class are values, just like numbers, strings, and functions, so you can provide them like you would other values.
Reply all
Reply to author
Forward
0 new messages