[plt-scheme] Field names in the class system
How do I get the names I use when passing in values with new to match
the internal field names?
In other words, I'd like to be able to do
(new foo% [name "blah"])
and then assign the field name the value "blah" inside the class.
My first attempt was:
(define foo%
(class object%
(init name)
(super-new)
(define name name))) ; doesn't work because name is already defined
I tried using the maybe-renamed construct, but the name is backwards
from what I expected:
(define foo%
(class object%
(init (field-name name))
...)
means that I have to do (new foo% [field-name "blah"]), rather than
[name "blah"].
I'm sure I'm just missing something obvious...
Todd