[plt-scheme] Accessing Public Field

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Oct 20 10:54:23 EDT 2002

At Sat, 19 Oct 2002 12:54:09 +0100, "Paulo Jorge O. C. Matos" wrote:
> How can we access a methods public field? I've read about 
> class-field-accessor but it seems extremely awkward. Do we need to use 
> it everytime we need to access a public field?

That's the only way to access a field, currently.

The `class-field-accessor' procedure is intended to be used once for
each field, to generate the accessor function. It's set up this way
because the only reason to use a field (instead of getter and setter
methods) is for performance. The accessor-making step isolates the
expensive part of field lookup.

Matthew



Posted on the users mailing list.