How do you control the way objects of a class are printed out in
BSL/ISL/etc.? I tried implementing the 'printable' interface but all that
shows up in BSL is
   (instantiate (class ...) ...)

Here's what I tried:

;;; thingy.rkt   ===========================

#lang racket

(provide make-thingy)

(define (make-thingy i)
  (new thingy%))

(define thingy%
  (class* object% (printable<%>)
    (super-new)

    (define/public (custom-print out quote-depth)
      (fprintf out "foo"))

    (define/public (custom-write out)
      (fprintf out "foo" ))

    (define/public (custom-display out)
      (fprintf out "foo" ))))

;;; if you run just this and type (new thingy%) it displays   foo


;;; thingy-bsl.rkt   ===========================
;;; BSL language level

(require "thingy.rkt")
(make-thingy 0)

;;; this shows    (instantiate (class ...) ...)   instead of foo

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to