[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] loading classes dynamically as commands

1999-10-28 Thread Thomas McKay
After I asked the question I had some more time to poke around in the Jacl src. No, it was never a feature it just seemed natural to me that it would be, though. I'll include some code snippets below to illustrate what I am doing. This was my thought: When a user types a command, say "MyComman

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Thomas McKay
Well, I was hoping to be able to supply a prefix to use in place of the "java0x". My average user would understand it more if they saw "rect20" or "polygon34". I'll poke around a bit and see how hard this would be to add. I'll try out the namespace commands. I'm not an experienced traditional-

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Moses DeJong
On Thu, 28 Oct 1999, Thomas McKay wrote: Here is a quick code example: % set o [java::new Object] java0x1 % $o toString java.lang.Object@80d05fd % rename $o rect20 % rect20 toString java.lang.Object@80d05fd The catch is that you need to delete this renamed object like so. % rename rect20 {} % u

[Tcl Java] RE: [Tcl Java] RE: [Tcl Java] Re: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Thomas McKay
How would I do it in Java? This is what I have now... tclObject = ReflectObject.newInstance( interp, this.getClass(), this ); tclObject.preserve(); Would it be as simple as interp.renameCommand( tclObject.toString(), "rect20" ); Wou

[Tcl Java] RE: [Tcl Java] Re: [Tcl Java] loading classes dynamically as commands

1999-10-28 Thread Moses DeJong
On Thu, 28 Oct 1999, Thomas McKay wrote: > After I asked the question I had some more time to poke around in the Jacl > src. No, it was never a feature it just seemed natural to me that it would > be, though. Are you saying that this "autoload of commands implemented in Java" feature should be

[Tcl Java] RE: [Tcl Java] loading classes dynamically as commands

1999-10-28 Thread Thomas McKay
I think you're right. If the reload feature to java::load is there, that would be a plus. I'll play around a little bit more with java::load too. I submitted the code snippets more for sharing purposes than to suggest that it should be in a Jacl release. I enjoy learning from other people's ap

[Tcl Java] RE: [Tcl Java] RE: [Tcl Java] Re: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Moses DeJong
On Thu, 28 Oct 1999, Thomas McKay wrote: > How would I do it in Java? This is what I have now... ACK, NO! Do not call this.getClass() to get the second argument to the ReflectObject.newInstance() method. You need to use the actual Java Class object that the instance will be reflected as. For in

[Tcl Java] Re: [Tcl Java] RE: [Tcl Java] loading classes dynamically as commands

1999-10-28 Thread Moses DeJong
On Thu, 28 Oct 1999, Thomas McKay wrote: There is currently no way to unload .classes that were loaded by the Tcl classloader. This was something I wanted to add to the 1.3 versions of Jacl and Tcl Blend. The only real catch is I am not sure how to expose this as a Tcl command. Perhaps a "java::

[Tcl Java] RE: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Thomas McKay
Ahh, I remember hearing this from you in the past. However, as then, I still don't get why it's bad to use the "most derived" class. Why wouldn't you want to give the user access to the DerivedFromHashtable (to use the example in the docs)? What if there are methods or fields in this derived c

[Tcl Java] RE: [Tcl Java] more 1.2.4 questions

1999-10-28 Thread Moses DeJong
On Thu, 28 Oct 1999, Thomas McKay wrote: It just is. This was the biggest and most difficult change made when moving from the 1.0 to 1.1 version. My paper from the Tcl 98 conf goes into more detail about it. See http://www-users.cs.umn.edu/~dejong/tcl/paper.html section 5.1 for a good description