[#20675] RCR: non-bang equivalent to []= — Tobias Reif <tobiasreif@...>

Hi,

49 messages 2001/09/01
[#20774] Re: RCR: non-bang equivalent to []= — Tobias Reif <tobiasreif@...> 2001/09/03

I wrote:

[#20778] Re: RCR: non-bang equivalent to []= — Kevin Smith <kevinbsmith@...> 2001/09/03

--- Tobias Reif <tobiasreif@pinkjuice.com> wrote:

[#20715] oreilly buch von matz - website online — markus jais <info@...>

hi

43 messages 2001/09/02
[#20717] Re: OReilly Ruby book has snail on cover — ptkwt@...1.aracnet.com (Phil Tomson) 2001/09/02

Actually, thanks for posting it here. I was trying to search OReilly's

[#20922] Re: OReilly Ruby book has snail on cover — Paul Brannan <pbrannan@...> 2001/09/05

On Mon, 3 Sep 2001, Phil Tomson wrote:

[#20768] Minor cgi.rb question — "Hal E. Fulton" <hal9000@...>

I don't have much experience with

25 messages 2001/09/03

[#20770] Calling member methods from C++ — jglueck@... (Bernhard Glk)

Some quetsions have been solved for me, but my message system does not

12 messages 2001/09/03

[#20976] destructor — Frank Sonnemans <ruby@...>

Does Ruby have a destructor as in C++?

25 messages 2001/09/07

[#21218] Ruby objects <-> XML: anyone working on this? — senderista@... (Tobin Baker)

Are there any Ruby analogs of these two Python modules (xml_pickle,

13 messages 2001/09/15

[#21296] nested require files need path internally — Bob Gustafson <bobgus@...>

Version: 1.64

29 messages 2001/09/18
[#21298] Re: nested require files need path internally — David Alan Black <dblack@...> 2001/09/18

Hello --

[#21302] Re: nested require files need path internally — Bob Gustafson <bobgus@...> 2001/09/18

On Tue, 18 Sep 2001, David Alan Black wrote:

[#21303] Re: nested require files need path internally — matz@... (Yukihiro Matsumoto) 2001/09/18

Hi,

[#21306] Re: nested require files need path internally — Lars Christensen <larsch@...> 2001/09/18

On Tue, 18 Sep 2001, Yukihiro Matsumoto wrote:

[#21307] Re: nested require files need path internally — matz@... (Yukihiro Matsumoto) 2001/09/18

Hi,

[#21331] Re: nested require files need path internally — Paul Brannan <pbrannan@...> 2001/09/18

> The big difference is C++ search done in compile time, Ruby search

[#21340] Re: nested require files need path internally — matz@... (Yukihiro Matsumoto) 2001/09/18

Hi,

[#21353] Re: nested require files need path internally — Paul Brannan <pbrannan@...> 2001/09/18

On Wed, 19 Sep 2001, Yukihiro Matsumoto wrote:

[#21366] Re: nested require files need path internally — matz@... (Yukihiro Matsumoto) 2001/09/19

Hi,

[#21368] Re: nested require files need path internally — "Julian Fitzell" <julian-ml@...4.com> 2001/09/19

On 19/09/2001 at 10:12 AM matz@ruby-lang.org wrote:

[#21376] Re: nested require files need path internally — matz@... (Yukihiro Matsumoto) 2001/09/19

Hi,

[#21406] Re: nested require files need path internally — Paul Brannan <pbrannan@...> 2001/09/19

On Wed, 19 Sep 2001, Yukihiro Matsumoto wrote:

[#21315] Suggestions for new CGI lib — anders@... (Anders Johannsen)

From the comp.lang.ruby thread "Minor cgi.rb question" (2001-09-03), I

21 messages 2001/09/18

[#21413] Ruby/objects book in style of The Little Lisper — Brian Marick <marick@...>

I fell in love with Lisp in the early 80's. Back then, I read a book called

36 messages 2001/09/19
[#21420] Re: Ruby/objects book in style of The Little Lisper — Christopher Sawtell <csawtell@...> 2001/09/20

On 20 Sep 2001 06:19:44 +0900, Brian Marick wrote:

[#21479] Re: Ruby/objects book in style of The Little Lisper — Kevin Smith <kevinbsmith@...> 2001/09/21

--- Christopher Sawtell <csawtell@paradise.net.nz> wrote:

[#21491] SV: Re: Ruby/objects book in style of The Little Lisper — "Mikkel Damsgaard" <mikkel_damsgaard@...> 2001/09/21

[#21494] Re: SV: Re: Ruby/objects book in style of The Little Lisper — Kevin Smith <kevinbsmith@...> 2001/09/21

--- Mikkel Damsgaard <mikkel_damsgaard@mailme.dk> wrote:

[#21510] Re: SV: Re: Ruby/objects book in style of The Little Lisper — Todd Gillespie <toddg@...> 2001/09/22

On Sat, 22 Sep 2001, Kevin Smith wrote:

[#21514] Re: SV: Re: Ruby/objects book in style of The Little Lisper — Kevin Smith <kevinbsmith@...> 2001/09/22

--- Todd Gillespie <toddg@mail.ma.utexas.edu> wrote:

[#21535] irb — Fabio <fabio.spelta@...>

Hello. :) I'm new here, and I have not found an archive of the previous

15 messages 2001/09/22

[#21616] opening a named pipe? — "Avdi B. Grimm" <avdi@...>

I'm having trouble reading from a named pipe in linux. basicly, I'm

12 messages 2001/09/24

[#21685] manipulating "immutable" objects such as Fixnum from within callbacks & al... — Guillaume Cottenceau <gc@...>

Hello,

15 messages 2001/09/25

[#21798] Ruby internal (guide to the source) — "Benoit Cerrina" <benoit.cerrina@...>

Hi,

22 messages 2001/09/28

[ruby-talk:21250] request for help

From: theschof@... (TheSchof)
Date: 2001-09-16 04:00:55 UTC
List: ruby-talk #21250
For a few days now I've been toying with a pet project I came up with when I
read about Tcl Blend.  Tcl Blend is a Tcl extension which allows you to script
Java components, but it is not a pure Java interpeter (which was the benefit in
this case, Jacl is a pure java Tcl interpreter).  At any rate I got to thinking
that Tcl blend could be used (since most ruby installations also have Tcl on
the same machine) to bridge Java and Ruby (especially since I knew Tcl
already).  As the code started to take shape so did my general expectations of
what was possible and how to do it, and Tcl's simple procedural structure has
turned out to be a great asset here rather than a hindrance, allowing me to
impose my own OO structure.  Before I provide facilities for events and
exceptions however, I need to get the object behavior right.  Until now, I have
been able to figure out the behavior of the tcltk interface Ruby provides,
despite the fact that there seem to be some very strange (at least from my
point of view, since I can't read the documentation), string interpolation
happening in the background.  But I've run into something I can't explain, or
figure out despite my best attempts when I've been filling in the JArray class
(specifically line 177 in the getrange method).  These are primitives which I
will use in the forthcoming [], and []= methods.

Which leads me to ask for help from anyone who knows just what is going on here
with tcltk.

I suppose I should give a quick little summary (very quick) of this project
just to get any good samaritan started.  Essentially Ruby interacts with Java
via Tcl (through it's Tcl blend extension).  The basic premise of my system is
to encapsulate the procedures in the java package within three things, the Java
module, which provides a namespace for procs which don't belon anywhere else,
and JObject and JArray, which act as the foundation of the object system.  When
you start up a JObject it uses the introspection capabilities provided by tcl's
java package to gather information about the methods of the Java class you are
initializing (through some very cumbersome parsing code I might add, which is
very open to suggestions by people who grok regular expressions and understand
the string representation of Tcl lists).  Once it has this information, it
defines those methods within the instantiated JObject, so each JObject,
although sharing some base functionality, has different methods depending on
what Java class it was initialized to.  (note: once I have JArray up and
running I'll also do the same for attributes, which will be implemented via
defining name, and name= method much the same way I've done for methods).  This
allows for code such as:

frame = Java.create 'java.awt.Frame'
#to_j is a convenience method I added to String, 
#instantiates a Java string which is passed as the arg to setTitle
#necessary because I don't understand the tcltk interface
frame.setTitle 'hello from Ruby!'.to_j
frame.setVisible true

And will, in the future allow for conveniences such as using [], and []= on
JArray's (with and without Ruby ranges), once I have the primitive methods
(same name as in tcl's java module) filled in.  The default behavior is for
java methods which return a value to always return a String object, but this
can be changed by supplying a few prebuilt procs provided by the Java module as
blocks to whatever the name of the Java method was eg:

#ok since returns a Java string which automatically becomes a Ruby string
title = frame.getTitle
#otherwise it will return a string representation of an integer
width = frame.getWidth &(Java.integer)
#you need this whenever you expect to get a handle to a Java object, otherwise
it will return a string
#representation (example: "java0x4") from Tcl of the Java object, and since no
reference to that Java
#object will exist in Tcl it is subject to garbage collection
size = frame.getSize &(Java.noconvert)

Later on I might use David Alan Black's behaviors package to clean this whole
system up a bit, maybe introducing &(Java.noconvert) as simply &nc for example?
 But that's after I have a more complete system operational, since I don't
believe in having rigid top down models (read Paul Graham's "ANSI Common
Lisp").  Which leads me to some final points:

1) This system is *highly* incomplete, so don't use it in *anything* for now.
2) I mean it, this is not beta, or alpha or anything close, it's a request for
help at the moment.

Whenever this does get released, Ruby Blend as a name seems appropriate, since
it's just a thin layer of Tcl Blend, and its license will be whatever Ruby
uses.  I know there is another project in the works for Ruby-Java integration,
but with any luck this could be in beta stage within a few weeks, so it should
give people something to tide them over until the real thing arrives.  That's
it for now and I appreciate anyone who can help.
best regards,
Alexander Schofield

PS:
get Tcl Blend from dev.scriptics.com, also the documentation for it.  They also
have a whitepaper which describes a bunch of very cool things like embedding
Java awt componenets in Tcl widgets, and if someone knows where there are
examples of this it would be a very cool thing to consider in Ruby Blend.
I warn you though, for unices it's only available as source code, which
souldn't be a problem except on two boxes (solaris 2.8 and a Linux on a 2.4
kernel) I've had no luck getting it to work, after hacking out much obsolete
material from the Makefile I got it to compile, but never to work, which is why
against my will this was all developed on win32, since it was simpler to just
download the binaries and a copy of vim than it was figuring that one out.

In This Thread

Prev Next