From: Ken A. <kan...@bb...> - 2003-01-07 14:29:10
|
I was aware of Chiba's work, but hadn't played with it. This is a good example, thanks! k At 10:00 PM 1/6/2003, david may wrote: >I found this today, and it seems usefull. >are there any gotchas to this method oc creating >new class in jscheme? > >Sometimes you want to make a subclass just to >override the paint method. > >the jar file is here.. >http://www.csg.is.titech.ac.jp/~chiba/javassist/ > >------------ a simple test ----------- >(import "javassist.*") >(define pool (javassist.ClassPool.getDefault)) >(define cc (.makeClass pool "Silly")) >(define m (CtNewMethod.make > "public int silly(int dx) { return 2+dx; }" cc)) >(.addMethod cc m) > >(define cloader (Loader. pool)) >(define anewclass (.loadClass cloader "Silly")) >(define ss1 (.newInstance anewclass)) > >(.silly ss 1) > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Jscheme-user mailing list >Jsc...@li... >https://lists.sourceforge.net/lists/listinfo/jscheme-user |