[plt-scheme] class.ss: init-field - renamed-id w/o default gives error, while ranamed-id w/default does not.

From: Kyle Smith (airfoil at bellsouth.net)
Date: Sun Apr 29 11:38:49 EDT 2007

Hi folks,

I'm using an svn build from yesterday.
I'm noticing the folllowing behavior with class.ss:
Definitions Textual (Mzscheme, includes R5RS)-----------
(require (lib "class.ss"))

(define test%
  (class object%
    (init-field
     int-id)
    (super-new)
    ))
;must supply the named int-id argument
(define t (new test% (int-id 'foo)))
(define test%
  (class object%
    (init-field
     ((int-id ext-id) #f))
    (super-new)
    ))
;need not supply any parameter
(define t (new test%))
;but you may optionally supply the re-named ext-id as an argument
(define t1 (new test% (ext-id 'foo)))
(define test%
  (class object%
    (init-field
     (int-id ext-id))
    (super-new)
    ))
; need to supply the renamed ext-id as an argument
(define t (new test% (ext-id 'foo)))
; => reference to undefined identifier: ext-id
; with arrow drawn from `ext-id' in class to `new'.
----------------------------------------------
I'm fairly certain that I shouldn't have to define ext-id within the
context of a (new test% ....) form.  Note it did not complain, when
the init-field was given a default value and we supplied an overriding
value.

Please comment on your experience with class.ss, and let me know 
wether this is new behavior.  Either way, I think this constitutes a bug?  
Comments please?

Thanks,

--kyle
airfoil at bellsouth dot com
schemekeys.blogspot.com
www.schemkeys.net



Posted on the users mailing list.