Skip to content

Instantly share code, notes, and snippets.

@takikawa
Created May 24, 2012 22:41
Show Gist options
  • Save takikawa/2784657 to your computer and use it in GitHub Desktop.
Save takikawa/2784657 to your computer and use it in GitHub Desktop.
Inits are weird
Welcome to Racket v5.3.0.8.
-> (define c (class object% (init [x 0]) (super-new)))
-> (define d (class c (init [x 0] [y 0]) (super-instantiate () [x x])))
-> (make-object d 1)
(object:d ...)
-> (make-object d 1 2)
(object:d ...)
-> (make-object d 1 2 4)
; instantiate: unused initialization arguments: (x 4) for instantiated class: d
; [,bt for context]
-> (make-object d 1 2 4 5)
; instantiate: too many initialization arguments: 1 2 4 5 for class: d [,bt for
; context]
@samth
Copy link

samth commented May 30, 2012

@sstrickl, when you do that, Racket should reach out and slap you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment