Re: [Rubydotnet-developer] Introduction
Status: Alpha
Brought to you by:
thomas
From: John R. P. <jo...@pi...> - 2003-07-18 11:22:53
|
Hello all, My name is John Pierce. I thought I'd introduce myself as well. I am the friend of Ben's that has been working on the Ruby/.NET bridge with him. I am currently working on the native C extension to make the bridge more performant, but we intend to leave the TCP socket-oriented bridge in tact for flexibility reasons. As far as really cool stuff, I have a live functioning demo on the web of the Ruby/.NET bridge where you can experiment and learn both Ruby and ASP.NET. The only trouble is that I we haven't found a way to sandbox both Ruby and the .NET side of the online demo. So if I tell you where it is at and others find it, they could slay my home machine (which is behind a firewall). I would be willing to send anyone a URL via private email as long as you promise you don't post it publicly and don't hack my home machine. The really nifty thing about the online web demonstration is that you can actually program ASP.NET web pages in Ruby syntax. You can new pages, add buttons, click handlers, content, client-side JavaScript, etc.... This is all possible because the Ruby context in which your Ruby code runs is based in the ASP.NET application that is hosting it. Really crazy -- we have a few sample pages demonstrating what I am saying. You gotta see to believe. Regards, John On Fri, 18 Jul 2003 07:03:44 +0100, "Thomas Sondergaard" wrote: > > Hi Tim > > Thanks for getting in contact. So both you and Ben have something that mostly > works - Excellent. There is a number of other people who are interested in > working on getting ruby/.net integration to work. Would you be interested in > collaborating with us? I think, if you and Ben, are willing a good next step > would be to get your code out in the public, so more people can start > contributing. > > Cheers, > > Thomas > > ---------- Original Message ----------- > From: Tim Sutherland <ti...@ih...> > To: rub...@so... > Sent: Fri, 18 Jul 2003 10:47:23 +1200 > Subject: [Rubydotnet-developer] Introduction > > > A few days ago I posted a message to rubytalk mentioning a library I > > am working on for allowing Ruby and DotNet to call each others' methods > > > > (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/75198) > > > > Since then I've been contacted by Ben Schroeder who told me about the > > similar project he has been working on, and who told me about this list. > > > > Status of my library: It mostly works, need to do more testing / > > documentation. (Well, write *any* documentation!) Ben's project has > > a richer interface e.g. uses Enumerable methods whenever a DotNet > > object supports Count (or Length) and get_Item. There are other > > things I'd like to implement like a "dotnet_methods" methods. > > > > I'll try to make a release soon under a BSD-ish license. > > > > My interface (calling DotNet methods from Ruby) looks like: > > # It would be nicer if this was > > # DotNet::System::Collections::Hashtable. > > hash_class = DotNet::Class.new('System.Collections.Hashtable') > > > > h = hash_class.new # h is an instance of DotNet::Instance > > h['a'] = [1, 2, 'three'] > > > > p(h['a']) # -> "[1, 2, \"three\"]" > > p(h.Count) # -> 1 > > > > # DotNet.new can be used just for type conversions. > > five = DotNet.new(5) # five is an instance of DotNet::Instance > > p(five.to_rb == 5) # -> true > > > > Type conversions: Integers, strings, arrays, nil, true, false are > > automatically converted to DotNet types. Calling 'to_rb' on a > > DotNet::Instance instance converts it to the Ruby type, if the object > > was one of the previously listed types. > > > > All operators/indexers are implemented (I believe). For relational > > operators (==, eql?, <, <=, >=, > ) we force the returned value to > > be a Ruby boolean. (Theoretically a DotNet library could implement > > '<' as returning e.g. an integer.) <=> is implemented using "== and > > <". == is implemented using Equals not op_Equality since e.g. > > System.Int32 only defines the former. > > > > I also implement "hash" in terms of "GetHash". > > > > When calling DotNet methods, if the method name ends in '=', we chop > > off the '=' and treat it as a SetField|SetProperty. Otherwise we use > > InvokeMethod|GetField|GetProperty. (My library uses > > GetType#InvokeMember.) > > > > At the moment I don't have any way to use DotNet delegates from the Ruby > > side. > > > > DotNet exceptions are mapped to DotNet::Exception Ruby exceptions, where > > 'message' is the same as the DotNet 'Message', and the 'dotnet_exception' > > attr_reader provides the original DotNet exception. > > > > >From the DotNet (e.g. C#) side, I can do things like > > RbType a = RbType.Eval('[1, 2, 3]'); > > int size = a.Call("size").ToInteger(); > > > > There are (implicit operator) conversions for integers, strings, > > arrays, null, true, false. > > > > You can use a delegate to represent a Ruby block, although I haven't > > tested this. I've implemented most operators in the usual way, although > > I forgot to do indexers -> [] and []=. > > > > Ruby exceptions are mapped into DotNet RbException types. > > > > Implementation wise, the code for calling Ruby from DotNet and > > calling DotNet from Ruby are mostly separate. They each use > > reference counting, which has the known problems e.g. circular references. > > > > The code is implemented in C# and C (Ruby extension.) There are > > about 8 lines of Microsoft's Extended C++ to allow for initialisation. > > > > The code does not run on Mono yet (http://www.go-mono.com/) because > > of a couple of bugs in that implementation. I intend to support this > > on both Microsoft and Mono implementations of dotnet. > > > > I'd be interested in seeing what other people have developed so we > > can share ideas/code. > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: VM Ware > > With VMware you can run multiple operating systems on a single machine. > > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > > same time. Free trial click here: > > http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > > Rubydotnet-developer mailing list > > Rub...@li... > > https://lists.sourceforge.net/lists/listinfo/rubydotnet-developer > ------- End of Original Message ------- > > > > ------------------------------------------------------- > This SF.net email is sponsored by: VM Ware > With VMware you can run multiple operating systems on a single machine. > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > Rubydotnet-developer mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubydotnet-developer |