From: Kyle R . B. <mo...@vo...> - 2002-09-09 15:00:45
|
I haven't been able to find anything in the documentaiton talking about how to create an object (or some type of equivaletn construct) in jscheme that effectivly inhertis from a Java class. Is this possible? I beleive that inheriting from a Java class is supported by one or more of the other Java scriping projects. Jython gives an example: http://www.jython.org/docs/subclassing.html IBM's Skij project doesn't seem to support inheritence, and it does not appear to be active, since the maintainer has left IBM and IBM has not released the code under any kind of open license. The behavior I am looking for is to use a Java abstract class or interface, and implement the required methods in scheme to be able to do rapid prototyping. Thank you for your time. Kyle R. Burton -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Ken A. <kan...@bb...> - 2002-09-09 15:29:26
|
There are several ways to do this. see http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.htmlsrc/dclass/dclass.html The closest thing to what Jython does is (define-class). This requires you to declare types for all your methods, so it isn't as nice as Jython's way. I'd like to do it Jython's way at some point. At 11:00 AM 9/9/2002, Kyle R . Burton wrote: >I haven't been able to find anything in the documentaiton talking about >how to create an object (or some type of equivaletn construct) in jscheme >that effectivly inhertis from a Java class. Is this possible? > >I beleive that inheriting from a Java class is supported by one or more >of the other Java scriping projects. Jython gives an example: > > http://www.jython.org/docs/subclassing.html > >IBM's Skij project doesn't seem to support inheritence, and it does not >appear to be active, since the maintainer has left IBM and IBM has not >released the code under any kind of open license. > >The behavior I am looking for is to use a Java abstract class or interface, >and implement the required methods in scheme to be able to do rapid >prototyping. > > >Thank you for your time. > >Kyle R. Burton > >-- > >------------------------------------------------------------------------------ >Wisdom and Compassion are inseparable. > -- Christmas Humphreys >mo...@vo... http://www.voicenet.com/~mortis >------------------------------------------------------------------------------ > > >------------------------------------------------------- >This sf.net email is sponsored by: OSDN - Tired of that same old >cell phone? Get a new here for FREE! >https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |
From: Kyle R . B. <mo...@vo...> - 2002-09-09 17:17:35
|
> There are several ways to do this. see > http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.html > > The closest thing to what Jython does is > (define-class). This requires you to declare types for all your methods, > so it isn't as nice as Jython's way. > > I'd like to do it Jython's way at some point. Thanks for the quick reply. I have been able to create a Scheme class that sub-classes a Java class. I do have another question though. Is it possible to create anonymous clases? Java supports a syntax for declaring anonymous classes: Foo foo = new Foo() { public void bar () { System.out.println("in bar()"); } }; Is there a corresponding construct in JScheme? Thank you, Kyle R. Burton -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Ken A. <kan...@bb...> - 2002-09-09 18:18:18
|
If you need to make inner classes with behavior specialized with scheme, do it by writing a wrapper class that takes the scheme behavior you want in the constructor. Here's your example: (define-class (package foo) (public class MyFoo) (private Procedure action) (public MyFoo (Procedure action) (.action$# this action)) (public void bar () ((.action$# this))) ) Here's a sample use: > (.bar (foo.MyFoo. (lambda () (print 'hi)))) hi #null > At 01:17 PM 9/9/2002, Kyle R . Burton wrote: > > There are several ways to do this. see > > http://jscheme.sourceforge.net/jscheme/src/dclass/dclass.html > > > > The closest thing to what Jython does is > > (define-class). This requires you to declare types for all your methods, > > so it isn't as nice as Jython's way. > > > > I'd like to do it Jython's way at some point. > >Thanks for the quick reply. I have been able to create a Scheme class that >sub-classes a Java class. > >I do have another question though. Is it possible to create anonymous clases? >Java supports a syntax for declaring anonymous classes: > > Foo foo = new Foo() { > public void bar () { > System.out.println("in bar()"); > } > }; > >Is there a corresponding construct in JScheme? > > >Thank you, >Kyle R. Burton > >-- > >------------------------------------------------------------------------------ >Wisdom and Compassion are inseparable. > -- Christmas Humphreys >mo...@vo... http://www.voicenet.com/~mortis >------------------------------------------------------------------------------ > > >------------------------------------------------------- >This sf.net email is sponsored by: OSDN - Tired of that same old >cell phone? Get a new here for FREE! >https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |