[racket] class variables in racket

From: Christian Wagenknecht (c.wagenknecht at hs-zigr.de)
Date: Fri Jan 20 07:30:04 EST 2012

I am very thankful for the advices of all contributors which help me to rethink my goals. There are only some quite simple rules the students have to apply when defining classes, for example: employ an internal definition (represented by 'define' / 'define-values') to implement a (private) instance variable; put the variable into an enclosing 'let' in case of a class variable.

Nevertheless there are obviously also other people looking for appropriate syntactical representations of the OOP terms (mainly for teaching purposes as I guess): Right now I found http://www.google.de/url?sa=t&rct=j&q=oop%20extensions%20of%20scheme&source=web&cd=4&ved=0CEgQFjAD&url=http%3A%2F%2Finst.eecs.berkeley.edu%2F~cs47a%2Foop.pdf&ei=yVIZT9CECYKf-wb5p6i4Cg&usg=AFQjCNGuaNDt293VtMmDVT4O_dR5rw9ouw&sig2=X47LnwLEdhMy-oS2QcTy2w&cad=rja. Within the text you will find the forms class-vars, instance-vars, ...

Thanks again,
Christian

Am 20.01.2012 00:00, schrieb Matthias Felleisen:
>
> Of course.
>
>
>
> On Jan 19, 2012, at 5:56 PM, Grant Rettke wrote:
>
>> In Java for example which doesn't have modules you would create a
>> class whose sole purpose in life was to hold those constants. Did you
>> guys make that choice consciously?
>>
>> On Thu, Jan 19, 2012 at 3:58 PM, Robby Findler
>> <robby at eecs.northwestern.edu>  wrote:
>>> But is this style of OOP thinking because of a weakness in the design
>>> of the OOP that Racket (as it famously inherits from Scheme (ala
>>> Clinger's intro to the RnRS reports)) avoids?
>>>
>>> Robby
>>>
>>> On Thu, Jan 19, 2012 at 1:41 PM, Christian Wagenknecht
>>> <c.wagenknecht at hs-zigr.de>  wrote:
>>>> I expected to find some special-form, like 'class-variable' or something
>>>> like that.
>>>>
>>>> For pedagogical reasons I'd prefer to implement two syntactically different
>>>> programs representing the oop thinking style quite obvious: the first one
>>>> makes absolutely no use of the bindings provided by the 'class' library that
>>>> comes with Racket whereas the second one is mainly limited to take them. The
>>>> first one helps the students to understand lots behind the scene of how oop
>>>> works and why. The second one abstracts of that and really allows for oo
>>>> programming.
>>>>
>>>> What I mean is that the terms describing the basic concepts of object
>>>> oriented programming should be mapped to related code. Using 'let' to get
>>>> the right variable scope causes to mix both levels of thinking /
>>>> abstraction. Thats exactly what I like to avoid.
>>>>
>>>> Am 19.01.2012 18:09, schrieb Matthias Felleisen:
>>>>
>>>>>
>>>>> On Jan 19, 2012, at 11:57 AM, Christian Wagenknecht wrote:
>>>>>
>>>>>> How class variables/methods (instead of instance variables/methods) can
>>>>>> be implemented be means of Racket's class definition expressions? An
>>>>>> unsatisfying way I found is by using a let expression enclosing the whole
>>>>>> definition of the class.
>>>>>
>>>>>
>>>>> What's unsatisfying about it?
>>>>
>>>> ____________________
>>>>   Racket Users list:
>>>>   http://lists.racket-lang.org/users
>>>
>>> ____________________
>>>   Racket Users list:
>>>   http://lists.racket-lang.org/users
>>
>>
>>
>> --
>> http://www.wisdomandwonder.com/
>> ACM, AMA, COG, IEEE
>
>

Posted on the users mailing list.