racket/draw: clean up object name hacks
The only observable impact of this change is that `the-color-database` will now print as `(object:color-database% ...)` instead of `(object:color-database<%> ...)`. The former makes more sense anyway, given that you can't have an instance of an interface. If we really want the latter though, we can add `object-rename` for this purpose.
This commit is contained in:
parent
839f971912
commit
80ca36e6ab
|
@ -8,7 +8,7 @@
|
|||
color-green
|
||||
color-blue
|
||||
color-alpha
|
||||
(rename-out [color-database-intf color-database<%>])
|
||||
color-database<%>
|
||||
the-color-database
|
||||
color->immutable-color)
|
||||
|
||||
|
@ -98,13 +98,10 @@
|
|||
|
||||
(define color-objects (make-hash))
|
||||
|
||||
(define color-database-intf
|
||||
(let ([color-database<%> (interface ()
|
||||
find-color
|
||||
get-names)])
|
||||
color-database<%>))
|
||||
(define color-database<%>
|
||||
(interface () find-color get-names))
|
||||
|
||||
(defclass* color-database<%> object% (color-database-intf)
|
||||
(defclass* color-database% object% (color-database<%>)
|
||||
(super-new)
|
||||
(def/public (find-color [string? name])
|
||||
(let ([name (string-downcase name)])
|
||||
|
@ -120,7 +117,7 @@
|
|||
(def/public (get-names)
|
||||
(sort (hash-map colors (lambda (k v) k)) string<?)))
|
||||
|
||||
(define the-color-database (new color-database<%>))
|
||||
(define the-color-database (new color-database%))
|
||||
|
||||
(define colors
|
||||
#hash(("aliceblue" . #(240 248 255))
|
||||
|
|
Loading…
Reference in New Issue
Block a user