Thanks for the insight.
With my short experience with JACL, I feel the need to have a mode where java
variables will be automatically "locked". No doubt, this will prevent garbage
collection and will be memory intensive but it will typically be useful for
quick and short interactive sessions. This makes for less typing and is more
intuitive.
In some cases when you issue a command you realize that the result looks
interesting only after issuing the command. You have to prefix the command
with set <variable> [....] and run it again if you want to do anything with
the return value.
Does anyone else out there feels the need for "autolock" mode?
Thanks,
-Sachin
[EMAIL PROTECTED]
Moses DeJong wrote:
> This is one of the implementation details that you just have to learn.
> The only reason you might want to do this is to quickly type in commands
> without using variables. If you really need to do this you can use
> the java::lock command to save a reference that is not stored in a
> variable. If you do not save a java object reference in a tcl variable
> it will be garbage collected by the JVM because there are not "active"
> refrences. What I typically do is to just use a variable with a single
> letter which takes less typing then the "java0x..." type of command.
>
> set s [java::new String "I am a java string"]
>
> set c [$s charAt 0]
>
> puts "c is $c"
>
> (output is "c is I")
>
> Mo DeJong
> dejong at cs.umn.edu
>
> On Thu, 11 Mar 1999, Sachin Thatte wrote:
>
> > When a java::* method returns a java variable, it only works when I do a
> > "set" of that variable into a local tcl variable. If I just use the
> > variable returned by java::* command then it does not work in TCL.
> > Following example illustrates this. Is this supposed to work any other
> > way?
> >
> > Why does the following not work?
> >
> > % java::new String "aa"
> > java0x1
> > % java0x1 equals "AA"
> > invalid command name "java0x1"
> > %
> >
> > Where as the following works:
> >
> > % set some_var [java::new String "aa"]
> > java0x1
> > % $some_var equals "AA"
> > 0
> > %
> >
> >
> > Thanks,
> >
> > -Sachin
> > [EMAIL PROTECTED]
> >
> >
> > ----------------------------------------------------------------
> > The TclJava mailing list is sponsored by WebNet Technologies.
> > To subscribe: send mail to [EMAIL PROTECTED]
> > with the word SUBSCRIBE as the subject.
> > To unsubscribe: send mail to [EMAIL PROTECTED]
> > with the word UNSUBSCRIBE as the subject.
> > To send to the list, send email to '[EMAIL PROTECTED]'.
> > A list archive is at: http://www.findmail.com/listsaver/tcldallas/
> >
>
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by WebNet Technologies.
> To subscribe: send mail to [EMAIL PROTECTED]
> with the word SUBSCRIBE as the subject.
> To unsubscribe: send mail to [EMAIL PROTECTED]
> with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'.
> A list archive is at: http://www.findmail.com/listsaver/tcldallas/
----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.
A list archive is at: http://www.findmail.com/listsaver/tcldallas/