Hey Paul,

On Aug 2, 2006, at 3:08 AM, Paul Battley wrote:

> On 01/08/06, Brian Palmer <rubytalk / brian.codekitchen.net> wrote:
>> What it is: Replicant is a Ruby library for automatically converting
>> methods on Ruby classes to Javascript classes, and serializing
>> instances of those classes from Ruby to Javascript using #to_json.
>> I've been developing it mostly in conjunction with some Rails
>> projects, but it works just fine outside of Rails, too, as long as
>> Prototype.js is available.
>>
>> Replicant is in a pre-alpha state, though I'm using it in a couple
>> production apps online already.
>
> I've been doing a bit of work on the something similar. Did you see  
> this?
> http://po-ru.com/diary/convert-ruby-to-javascript/
> http://po-ru.com/diary/thoughts-on-ruby-to-javascript-conversion/

That's cool, I wish I'd caught your original announcement to the  
list. I've been out of the loop, working to finish up my degree for  
the last month.

> That was a quick hack that pointed out some obvious shortcomings (the
> languages are similar, but not *that* similar), so I decided to take
> another tack and implement something close to Ruby's object model in
> JS, so that a wider range of idiomatic Ruby code will work:
> http://rb2js.rubyforge.org/

So far my development has been more about "describing" Javascript in  
Ruby code, not directly supporting every part of Ruby. I make no  
attempt to support Ruby-style inheritance and message dispatching,  
for example. I've been much more concerned with making the generated  
Ruby code as compatible as possible with existing Javascript code and  
libraries. You seem to be aiming for a more general solution, perhaps  
something that people could use without even knowing Javascript. My  
code stems directly from how I've been utilizing it in my recent  
projects, but maybe that's why I'm having trouble conceptualizing  
where I should take it next, how I can use the same code on client  
and server in more cases.

I see that you've been focusing on builtin classes like String,  
Kernel and Class so far, but are you planning to support some of the  
standard library as well? I wanted to translate a method that used a  
Time object the other day, and that tripped me up a bit -- it was  
hard to justify porting the Time class to Ruby when it'd be so much  
simpler to write the code directly in Javascript.

How are you planning support for integrating with existing Javascript  
code and libraries, by the way? I don't see any mention of that.

>
> I'll take a closer look over your code later on. Perhaps we might be
> able to collaborate...?

Yeah, I'd be totally willing. Like I mentioned, I've been skeptical  
about how useful my approach is, so I really released this version to  
gauge whether anybody else would find my approach useful, or whether  
it just happened to work well in the particular projects I used it  
on. I'd love to discuss it more, if you want. You can reach me at  
brian <> codekitchen * net.

-- Brian

> Regards,
> Paul.
>
> Paul.
>