[F-Script-talk] Re: defining classes
Brought to you by:
pmougin
From: Philippe M. <pm...@ac...> - 2005-05-21 16:35:44
|
Le 21 mai 05 =E0 17:07, Keith Ray a =E9crit : > The last time I looked at FScript's release notes, it said there was a > way to define classes in FScript code.... but there was no > documentation on how to do it. Is there now? Can someone tell me? The implementation of this feature is still experimental and has some =20= limitations (need to use KVC to access instances variables, no =20 support for "super" yet etc.) but the goal is to eventually have this =20= feature fully implemented and documented (indeed, any help is welcome). Here is an example, I already posted, where we create a new subclass =20 of NSObject, named MyClass, with three instance variables named a, b =20 and c, and define a simple method named method1: > NSObject subclass:'MyClass' instanceVariableNames:'a b c' MyClass > MyClass MyClass > MyClass setFSBlock:[:self :_cmd| 'Method ' ++ _cmd ++ ' called on =20 ' ++ self printString] asInstanceMethod:#method1 > myInstance :=3D MyClass alloc init > myInstance method1 'Method method1 called on <MyClass: 0x4bb69c0>' --- Cheers, Philippe Mougin= |