[plt-scheme] class initialization

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Feb 6 11:08:02 EST 2008

Hi Tom,

I'll attempt to answer 1/2 your post.

> I don't understand what it means to be present, but not accessible.  How
> can a field be inherited if I can't use it?  Can someone help clarify
> that for me?  What do I do if I want to inherit a private field from the
> parent?

Try writing an expression that uses a field declared in the superclass
without an inherit-field declaration -- you'll see you get an error
about an unbound identifier.  If you want to use a name in normal code
you have to declare the name first, using a define or let statement.
During compilation Scheme resolves all names to the place they are
defined, and complains if it can't find a definition for a name.  Ok.
Simple stuff.  What about in the class system? If you use a name
defined in a super class, how does the compiler know how to resolve
the name, or tell you if you've made an error?  What the inherit-field
declaration does is tell the compiler: I want to use this name, and
BTW it is defined in the super class.

Cheers,
Noel


Posted on the users mailing list.