[racket] Question about fields in Racket OO

From: Mark Engelberg (mark.engelberg at gmail.com)
Date: Wed Dec 15 23:38:19 EST 2010

I'm playing around with the object-oriented subset of Racket, and have a
couple of questions.

Ideally, I'd like to equip a class with a field that is visible only to it
and its subclasses.  As far as I can tell, though, this isn't possible.  It
seems that I have to make a choice between a completely private field
visible only to the class (by just using "define") or making a completely
public field (by using "field").  Correct?

Now, let's say I make the field public.

In the subclass, how do I change the default value of field?

For example, in the superclass, I might have
(field [a 300])

but in the subclass, I want to do something like
(inherit-field [a 200])

However, as far as I can tell, the syntax doesn't support anything other
than
(inherit-field a)

Thanks,

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101215/620bf73a/attachment.html>

Posted on the users mailing list.