[plt-scheme] Class methods and class fields

From: Eddie Sullivan (eddieSull at hotmail.com)
Date: Tue Apr 29 08:38:41 EDT 2008

Hi.
I'm another long-time programmer trying out scheme. I have been working with 
PLT's scheme/class module because I am used to
the object oriented way of thinking about programming.

In every other language I have used that has classes (Python and the C++
family, also [incr tcl] but my memory of that is vague), there is the
concept of "class variables", that is, variables that are associated with
the class itself rather than with any particular instance, and the similar
concept of "class methods." (They're also often called "static", but that
term can be confusing, IMO.)

It's easy to imagine scenarios where these concepts would be very useful, 
such as a
shared resource like a database connection, or simply a usage counter.

Perhaps I'm misreading the documentation, but I can't find anything like 
that in scheme/class. Structures have "structure type properties", so the 
idea must be acknowledged to be useful in theory.

Is it there and I'm missing it? If not, is there a simple way to implement 
this functionality that I haven't figured out? Or is there a philosophical 
reason why this was considered a bad idea?

Thanks!
-Eddie Sullivan




Posted on the users mailing list.