Advocacy: Ruby on/with .net

I’d like a minute or two of your time as I try to sell you the idea of ruby
on/with .net :slight_smile:

== Ruby the language rocks, ruby the platform not as much ==
I love ruby the language, but there are often annoying obstructions when
you want to develop an application on ruby the platform, like missing or
immature class libraries and poor threading support (IMHO).

== .net is the future ==
It is my firm belief that .net as a development platform is very powerful. It
has been my main development platform for more than a year and a half and
considering how young it is things just work amazingly well and performance
doesn’t suck, like it at least initially did with Java. Technically the .net
framework and runtime are excellent and with Microsoft pushing it as hard as
possible it will end up on most Windows computers sooner rather than later.
The mono project is doing an excellent job of making sure that the .net
platform will also be available on other OSes than Microsofts. I am not a
Microsoft fanatic, but after having used .net for a long time I must admit it
just works very well. I don’t think it is worth sticking our heads in the
sand, just because we may not approve of Microsofts business methods,
especially as the .net runtime and base framework have been made open
standards.

== Ruby on/with .net ==
Ruby is not a scripting language front-runner, but as a language, not a
development platform, it leaves the front runners in the dust. By relying on
a common and very popular platform we can do away with most of the
disadvantages of ruby and keep the advantages.

== Projects to take ruby to .net ==
After having perused the documentation for the .net CLR runtime and the CLS
and read a white paper on the lessons learned trying to make Python run on
the .net CLR runtime, it is clear to me that the .net runtime is not well-
suited for dynamic languages, such as Python, Perl and indeed ruby. However,
smallscript inc (http://www.smallscript.org) are working on exactly that, and
will soon be releasing a version of smallscript, a smalltalk variant, that is
running on the .net CLR. I think it would be worthwhile to pursue two
projects, one with the objective to allow .net class libraries to be used
from ruby using a dual-runtime approace and another approach that attempts to
run ruby on the .net CLR runtime

=== rubydotnet - dual runtime approach ===
This project will aim to allow any CLS compliant .net assembly to be used
from ruby. This would make all .net class libraries including the entire .net
framework to be used from ruby, without having to implement ruby wrapper
modules.

=== r# - ruby on the .net runtime ===
r# is to ruby, what S# is to smalltalk (http://www.smallscript.org)
This much more ambitious project would aim to run ruby on top of the .net
CLR. I, personally, would be willing to make some adaptions to the ruby
language to facilitate the .net platform integration, and do away with much
of the core ruby platform. Making ruby, or rather r#, fully CLS compliant has
many advantages in terms of distribution and in terms of using ruby/r# with
asp.net and running ruby applets inside browsers etc.

== Status ==
I have just today submitted a project registration with sourceforge.net for
rubydotnet. rubydotnet has a much smaller scope than r# and will allow the
ruby community to see the benefits of ruby/.net interop. Hopefully after that
support can be rallied for the much more ambitious r# project.

Thank you for your time

  • Thomas Sondergaard

Thomas Sondergaard wrote:

== Status ==
I have just today submitted a project registration with sourceforge.net for
rubydotnet. rubydotnet has a much smaller scope than r# and will allow the
ruby community to see the benefits of ruby/.net interop. Hopefully after that
support can be rallied for the much more ambitious r# project.

I know jack about .NET, but for what it’s worth you might want to see
how (or if) your project complements the NETRuby project:

http://raa.ruby-lang.org/list.rhtml?name=netruby

Hope this helps,

Lyle

Thomas, are you actually going to be programming this project?

Thomas Sondergaard wrote:

I’d like a minute or two of your time as I try to sell you the idea of ruby
on/with .net :slight_smile:

== Ruby the language rocks, ruby the platform not as much ==
I love ruby the language, but there are often annoying obstructions when
you want to develop an application on ruby the platform, like missing or
immature class libraries and poor threading support (IMHO).

== .net is the future ==
It is my firm belief that .net as a development platform is very powerful. It
has been my main development platform for more than a year and a half and
considering how young it is things just work amazingly well and performance
doesn’t suck, like it at least initially did with Java. Technically the .net
framework and runtime are excellent and with Microsoft pushing it as hard as
possible it will end up on most Windows computers sooner rather than later.
The mono project is doing an excellent job of making sure that the .net
platform will also be available on other OSes than Microsofts. I am not a
Microsoft fanatic, but after having used .net for a long time I must admit it
just works very well. I don’t think it is worth sticking our heads in the
sand, just because we may not approve of Microsofts business methods,
especially as the .net runtime and base framework have been made open
standards.

== Ruby on/with .net ==
Ruby is not a scripting language front-runner, but as a language, not a
development platform, it leaves the front runners in the dust. By relying on
a common and very popular platform we can do away with most of the
disadvantages of ruby and keep the advantages.

== Projects to take ruby to .net ==
After having perused the documentation for the .net CLR runtime and the CLS
and read a white paper on the lessons learned trying to make Python run on
the .net CLR runtime, it is clear to me that the .net runtime is not well-
suited for dynamic languages, such as Python, Perl and indeed ruby. However,
smallscript inc (http://www.smallscript.org) are working on exactly that, and
will soon be releasing a version of smallscript, a smalltalk variant, that is
running on the .net CLR. I think it would be worthwhile to pursue two
projects, one with the objective to allow .net class libraries to be used
from ruby using a dual-runtime approace and another approach that attempts to
run ruby on the .net CLR runtime

=== rubydotnet - dual runtime approach ===
This project will aim to allow any CLS compliant .net assembly to be used
from ruby. This would make all .net class libraries including the entire .net
framework to be used from ruby, without having to implement ruby wrapper
modules.

=== r# - ruby on the .net runtime ===
r# is to ruby, what S# is to smalltalk (http://www.smallscript.org)
This much more ambitious project would aim to run ruby on top of the .net
CLR. I, personally, would be willing to make some adaptions to the ruby
language to facilitate the .net platform integration, and do away with much
of the core ruby platform. Making ruby, or rather r#, fully CLS compliant has
many advantages in terms of distribution and in terms of using ruby/r# with
asp.net and running ruby applets inside browsers etc.

== Status ==
I have just today submitted a project registration with sourceforge.net for
rubydotnet. rubydotnet has a much smaller scope than r# and will allow the
ruby community to see the benefits of ruby/.net interop. Hopefully after that
support can be rallied for the much more ambitious r# project.

Thank you for your time

  • Thomas Sondergaard

You may be better off contributing to the parrot project
(http://www.parrotcode.org) – the perl 6 interpreter. It is like, like
…NET and Java, a virtual machine. However, it is being built for dynamic
languages. Parrot will eventually run Ruby (along with Python, PHP,
Scheme, and others) anyway. It appears you already now the troubles with
…NET and dynamic languages. But if you want to read more (why they’re
developing parrot), you can check out these two blog entries, by Dan
Sugalski, the lead developer:

http://www.sidhe.org/~dan/blog/archives/000151.html
http://www.sidhe.org/~dan/blog/archives/000152.html

matt

I feel exactly the same way. When do we start coding? :slight_smile:

Rodrigo

···

----- Original Message -----
From: “Thomas Sondergaard” thomass@deltadata.dk
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, July 16, 2003 11:06 AM
Subject: Advocacy: Ruby on/with .net

I’d like a minute or two of your time as I try to sell you the idea of
ruby
on/with .net :slight_smile:

== Ruby the language rocks, ruby the platform not as much ==
I love ruby the language, but there are often annoying obstructions when
you want to develop an application on ruby the platform, like missing or
immature class libraries and poor threading support (IMHO).

== .net is the future ==
It is my firm belief that .net as a development platform is very powerful.
It
has been my main development platform for more than a year and a half and
considering how young it is things just work amazingly well and
performance
doesn’t suck, like it at least initially did with Java. Technically the
.net
framework and runtime are excellent and with Microsoft pushing it as hard
as
possible it will end up on most Windows computers sooner rather than
later.
The mono project is doing an excellent job of making sure that the .net
platform will also be available on other OSes than Microsofts. I am not a
Microsoft fanatic, but after having used .net for a long time I must admit
it
just works very well. I don’t think it is worth sticking our heads in the
sand, just because we may not approve of Microsofts business methods,
especially as the .net runtime and base framework have been made open
standards.

== Ruby on/with .net ==
Ruby is not a scripting language front-runner, but as a language, not a
development platform, it leaves the front runners in the dust. By relying
on
a common and very popular platform we can do away with most of the
disadvantages of ruby and keep the advantages.

== Projects to take ruby to .net ==
After having perused the documentation for the .net CLR runtime and the
CLS
and read a white paper on the lessons learned trying to make Python run on
the .net CLR runtime, it is clear to me that the .net runtime is not well-
suited for dynamic languages, such as Python, Perl and indeed ruby.
However,
smallscript inc (http://www.smallscript.org) are working on exactly that,
and
will soon be releasing a version of smallscript, a smalltalk variant, that
is
running on the .net CLR. I think it would be worthwhile to pursue two
projects, one with the objective to allow .net class libraries to be used
from ruby using a dual-runtime approace and another approach that attempts
to
run ruby on the .net CLR runtime

=== rubydotnet - dual runtime approach ===
This project will aim to allow any CLS compliant .net assembly to be used
from ruby. This would make all .net class libraries including the entire
.net
framework to be used from ruby, without having to implement ruby wrapper
modules.

=== r# - ruby on the .net runtime ===
r# is to ruby, what S# is to smalltalk (http://www.smallscript.org)
This much more ambitious project would aim to run ruby on top of the .net
CLR. I, personally, would be willing to make some adaptions to the ruby
language to facilitate the .net platform integration, and do away with
much
of the core ruby platform. Making ruby, or rather r#, fully CLS compliant
has
many advantages in terms of distribution and in terms of using ruby/r#
with
asp.net and running ruby applets inside browsers etc.

== Status ==
I have just today submitted a project registration with sourceforge.net
for
rubydotnet. rubydotnet has a much smaller scope than r# and will allow the
ruby community to see the benefits of ruby/.net interop. Hopefully after
that
support can be rallied for the much more ambitious r# project.

Thank you for your time

  • Thomas Sondergaard

The modification-date for netruby seems to be more than a year old ?

copyright(c) 2002 arton, Under GPL
Last modified: Sat Mar 02 20:29:03 LMT 2002

Is it abandonned or alive ?

···

On Wed, 16 Jul 2003 10:44:15 +0000, Lyle Johnson wrote:

Thomas Sondergaard wrote:

== Status ==
I have just today submitted a project registration with sourceforge.net for
rubydotnet. rubydotnet has a much smaller scope than r# and will allow the
ruby community to see the benefits of ruby/.net interop. Hopefully after that
support can be rallied for the much more ambitious r# project.

I know jack about .NET, but for what it’s worth you might want to see
how (or if) your project complements the NETRuby project:

http://raa.ruby-lang.org/list.rhtml?name=netruby


Simon Strandgaard

maillist@bestworldweb.homelinux.commaillist@bestworldweb.homelinux.com wrote in message news:1058406226.5005.13.camel@paulsmachine

Thomas, are you actually going to be programming this project?

Yes, that is my intention. I’m currently probing the community to see
what interest there is for the project. I’m currently travelling
around in southeast asia, but in about a month I’ll settle down
somewhere in southern Thailand and start coding.

Would you be interested in contributing, or are you otherwise
interested?

Cheers

Thomas

Maybe i'm completely uninformed but what is the real benefit of .NET.
You can use the Visual Studio .NET IDE (never worked with it, but
Visual Studio 6 is a pain to use).
And it is easier to get alien like looking library wrappers that still
need to be rubyized by hand. I don't see a real advantage here in
contrast to use (and extend) the SWIG tool.

And most libraries are only for windows. The mono project has a complete other
goal then Microsoft when it comes to libraries. Read the announcements carefully
and you will find that they use it to interact other languages more
easy, but they seems not to be interested in realeasing a large and
complete set of libraries. Simply because they don't have to money
that SUN has and can't hire 100 programmers in Bangalore.

So i would recommend to forget about .NET and put our focus directly to the
libraries and the core language implementation. There is enough work
to do.

By the way, if you want to change the threading support you completely break
the language. Can you tell me if .NET supports fibers ?

This is very similar in spirit to what I’m doing w/ Java (through
JNI). If I got it right (I did a quick inspection of your code), you’re
linking to the C# runtime, so you have both parts running on the same
process at a time (as opposed to communicating through sockets for
instance).

BTW, you have achieved about the same (if not more) in < 2Klocs than me
in 8Kloc (although some 4Kloc are auto-generated).

Did you solve the problem w/ threads (does it happen at all w/
C# ?)

In my case, Java threads are spawned as “real” (native) threads, so if
any of them tries to call Ruby code the thing will bomb (Ruby not being
thread safe).

A few more questions:

  • are you doing proper method dispatching on method overload?
    This can be tricky if you perform automatic Ruby → C#/Java type
    conversions as there might be several matching methods
  • do you have metaclasses for static methods or such? Do you think it’s
    sensible to provide them? (I did that in rjni)

I’ll take another look at your code when I have some time but as I know
nothing about .net I don’t know if I will understand it.

And last: is it just me, or C# is insanely easier to interface with than Java?
There’s several things in your code that take many more lines when using JNI…

···

On Wed, Jul 30, 2003 at 11:30:02AM +0900, Tim Sutherland wrote:

In article 007d01c35570$0d1d54b0$a30aa1c8@bambook, Rodrigo B. de Oliveira
wrote:

I feel exactly the same way. When do we start coding? :slight_smile:
[…]

There is a mailing list
http://sourceforge.net/mailarchive/forum.php?forum_id=34312
for discussing all things to do with Ruby and .NET.

I have code right now which allows you to do things like
require ‘dotnet’

DotNet.System.Console.WriteLine(“Hello DotNet World!”)

foo = DotNet.System.Collections.Hashtable.new
foo[‘one’] = 1
puts(foo[‘one’]) # → 1

It also allows C# to call Ruby code.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

what’s the difference between chattr and chmod?
SomeLamer: man chattr > 1; man chmod > 2; diff -u 1 2 | less
– Seen on #linux on irc

Hi,

···

In message “Re: Advocacy: Ruby on/with .net” on 03/07/17, Thomas thomass@deltadata.dk writes:

Thomas, are you actually going to be programming this project?

Yes, that is my intention. I’m currently probing the community to see
what interest there is for the project. I’m currently travelling
around in southeast asia, but in about a month I’ll settle down
somewhere in southern Thailand and start coding.

Rich Kilmer (the FreeRide guy) told me at the OSCON, that he was going
to start the project to bridge Ruby and .NET.

						matz.

Lothar Scholz mailinglists@scriptolutions.com wrote in message news:1173309890.20030719135052@scriptolutions.com

Can you tell me if .NET supports fibers ?

No, it supports real threads.

To my mind, taking advantage of real threads and Unicode would be the
two big advantages to a .NET ruby. I guess a Parrot ruby would also
have these properties, since Perl has real threads and (pretty much)
Unicode?

The third advantage would be the ability to use the .NET libraries,
including winforms, in ruby. Ahh, to think, my windows GUI programs
could be written in ruby! A dream that I doubt will become real in my
lifetime… but perhaps, my grandchildren… or their grandchildren…

Did you solve the problem w/ threads (does it happen at all w/
C# ?)

In my case, Java threads are spawned as “real” (native) threads, so if
any of them tries to call Ruby code the thing will bomb (Ruby not being
thread safe).

No, I did not solve the thread problem. In addition to the problem with
dotnet threads, if you are using Ruby threads then a call to a dotnet
object can block, preventing other Ruby threads from running.

Yes, there’s no easy way to work around the latter until we get Rite.

A few more questions:

  • are you doing proper method dispatching on method overload?
    This can be tricky if you perform automatic Ruby → C#/Java type
    conversions as there might be several matching methods

I only do a few automatic type conversions, e.g. strings. What problems
are you thinking of?

The dotnet method I am using is Type#InvokeMember which claims to choose
the best method.

I think it’s easier to call C# code from C than using JNI to run Java
code… In my case, it’s up to me to find the correct method, with the
appropriate signature, before dispatching. This can be quite slow as I
have to use reflection at run time quite heavily: get the list of
methods of an object, get the return type and parameter types of each
method, check passed arguments and perform type conversions (just String →
java.lang.String, Object → boolean and Numeric → one of char, byte,
short, int, long, float, double)

  • do you have metaclasses for static methods or such? Do you think it’s
    sensible to provide them? (I did that in rjni)

I’m not sure what you mean.

You can do
klass = DotNet.SomeNamespace.SomeClass
klass.SomeStaticMethod(“Hello”)

inst = klass.new(1, 2, 3)
inst.SomeStaticMethod(“World”)
inst.SomeInstanceMethod(42)

When using JNI, I have to implement it myself if I intent to call
static methods (which are like singleton methods in Ruby) on some class,
creating a proxy object to delegate the calls, etc.

Ben Schroeder and John R. Pierce have written a similar library which
uses sockets. It implements an interesting feature (not yet available in
my library) which is to turn Ruby blocks into C# Delegates (these are
like function pointers.)

Ben offers the following example:

 dotNet.loadLibrary('System.Windows.Forms')

 button = dotNet.Button.new

 button.click.add do |sender, args|
         puts "Button clicked!"
 end

 button.performClick # -> prints <<Button clicked!>>

I can do that in my code (implement Java interfaces in Ruby and pass
them to Java code) but this won’t work with GUIs since I face again the
threading issue. That’s why I was thinking of using sockets, too, but
Robert Klemme had an interesting idea I might be able to implement.

What speed are you getting with rubydotnet? I suspect it will be much
faster than RJNI since C#'s C interface seems to be much more sensible
than JNI.

In my case, when using the low-level JNI methods from Ruby I get around
200000 method calls/s on a K7 1.3GHz.
When using the “automagic reflection” (that is the higher-level part
similar to rubydotnet), I get some 20000 method calls/s. But I can
easily make it much faster since

  • it’s using the wrapped JNI calls from Ruby instead of the C JNI API
    directly
  • it’s implemented in Ruby at the moment (this means type checking,
    conversions, etc) using the JNI binding

Once I fix the Ruby code I can reimplement everything in C and I expect
to approach 500000 method calls/s or so.

···

On Thu, Jul 31, 2003 at 08:19:07PM +0900, Tim Sutherland wrote:


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

The state of some commercial Un*x is more unsecure than any Linux box
without a root password…
– Bernd Eckenfels

Check calling conventions. Windows .NET uses STDCALL while the default for
the C compiler is CDECL, this messes things up when a C function calls a
.NET function (and make sure you’re setting the CallingConvention attribute
of P/Invoked functions, too). I had the exact same problem writing a binding
from .NET to Lua. :slight_smile:

The problem goes away with Rotor (the shared source CLR) on FreeBSD… the
default there is CDECL. Why Microsoft didn’t use this more sensible default
for the Windows .NET is beyond me.

Fabio Mascarenhas
mascarenhas@acm.org

···

----- Original Message -----
From: “Tim Sutherland” timsuth@ihug.co.nz
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, August 05, 2003 2:58 AM
Subject: Re: Advocacy: Ruby on/with .net

In article slrnbihkb2.1bv.timsuth@alien.zone, Tim Sutherland wrote:
[…]

Yes, that is how I am doing it. NB: I’m planning to make the first
‘real’ release of my rubydotnetproxy library by the upcoming Monday.
[…]

Monday has passed and I haven’t released…I’ve been battling one bug
for a number of days - when I call one C# method, bad stuff appears to be
happening with the stack pointer. Hopefully it’s just a bug somewhere in
my C
code which can easily be fixed once found.

Lothar Scholz mailinglists@scriptolutions.com wrote in message news:1173309890.20030719135052@scriptolutions.com

Can you tell me if .NET supports fibers ?

No, it supports real threads.

How do you mix the lack of thread safety of Ruby’s interpreter with .NET
real threads? I’m facing that problem with rjni (Java binding).

To my mind, taking advantage of real threads and Unicode would be the
two big advantages to a .NET ruby. I guess a Parrot ruby would also
have these properties, since Perl has real threads and (pretty much)
Unicode?

The third advantage would be the ability to use the .NET libraries,
including winforms, in ruby. Ahh, to think, my windows GUI programs
could be written in ruby! A dream that I doubt will become real in my
lifetime… but perhaps, my grandchildren… or their grandchildren…

I hope your grandchildren won’t use Windows anymore.

···

On Mon, Jul 21, 2003 at 07:20:29PM +0900, Benjamin Peterson wrote:


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

You will not censor me through bug terrorism.
– James Troup

The other advantage is that a native CLR implementation of Ruby would
let you use any .Net code/component (and vice-versa) whether it’s
written in C#, VB.Net, Eiffel.Net, etc. etc.
It might be painful, but I think a .Net implementation would be phenomenal.

···

That’s your choice.

Anyone who has installed the PragProg package, will
have FXRuby and Tcl/Tk for cross-platform use and the
vruby/swin combo which is very powerful for native use.

http://www.threeweb.ad.jp/~nyasu/vruby/vrproject-e.html

Download some samples. They’re not designed to impress,
they’re to illustrate usage where English documentation
is difficult to offer.

At least, when you’ve written your GUI app, you’ll
have impressed yourself.

···

“Benjamin Peterson” bjsp123@imap.cc wrote:

[…] Ahh, to think, my windows GUI programs could be
written in ruby! A dream that I doubt will become real
in my lifetime … but perhaps, my grandchildren …

On Mon, 21 Jul 2003 19:28:48 +0900, Mauricio Fernández
batsman.geo@yahoo.com wrote (more or less):

Lothar Scholz mailinglists@scriptolutions.com wrote in message news:1173309890.20030719135052@scriptolutions.com

Can you tell me if .NET supports fibers ?

No, it supports real threads.

How do you mix the lack of thread safety of Ruby’s interpreter with .NET
real threads? I’m facing that problem with rjni (Java binding).

To my mind, taking advantage of real threads and Unicode would be the
two big advantages to a .NET ruby. I guess a Parrot ruby would also
have these properties, since Perl has real threads and (pretty much)
Unicode?

The third advantage would be the ability to use the .NET libraries,
including winforms, in ruby. Ahh, to think, my windows GUI programs
could be written in ruby! A dream that I doubt will become real in my
lifetime… but perhaps, my grandchildren… or their grandchildren…

I hope your grandchildren won’t use Windows anymore.

Given that over 90% of the installed desktop base uses Windows, and
that it’s been successfully (in terms of market take-up) targetted at
handheld devices and servers, this may be a forlorn hope.

The very first IBM-compatibles almost all used Microsoft OS.

The current IBM compatibles almost all use Microsoft OS.

This creates an enormous network effect that tends to lock in the
Microsoft OS - as long as they maintain adequate
backwards-compatibility for apps.

And even if other folk take over the role of providing a platform for
apps which were built for Microsoft OS, the biggest platform available
will still be platforms that can run apps which were built for
Microsoft OS.

We may bemoan the fact, but facilities which allow Ruby apps to run
and run well on the Microsoft OS platform(s) are good for the
penetration of Ruby apps into the world.

Cheers,
Euan
Gawnsoft: http://www.gawnsoft.co.sr
Symbian/Epoc wiki: http://html.dnsalias.net:1122
Smalltalk links (harvested from comp.lang.smalltalk) http://html.dnsalias.net/gawnsoft/smalltalk

···

On Mon, Jul 21, 2003 at 07:20:29PM +0900, Benjamin Peterson wrote:

You should be able to bridge .NET and Ruby in such a way that Ruby can
use any .Net Type (component), or that should be the true goal of a
bridge…and ultimately to be able to use a Ruby Class in .Net such
that you can have a .Net class subclass a Ruby class, and Ruby subclass
a .Net class. You will not get ‘managed code’ which is more security
related, but you will get real Ruby, with real .Net.

This is possible because the ActiveState folks did it with the Perl 5
native runtime…of course that is not open-source, so we have to
(re)solve the problems ourselves.

-rich

···

On Monday, July 21, 2003, at 11:06 AM, Patrick Bennett wrote:

The other advantage is that a native CLR implementation of Ruby would
let you use any .Net code/component (and vice-versa) whether it’s
written in C#, VB.Net, Eiffel.Net, etc. etc.
It might be painful, but I think a .Net implementation would be
phenomenal.

Saluton!

  • Mauricio Fernández; 2003-07-21, 12:07 UTC:
···

On Mon, Jul 21, 2003 at 07:20:29PM +0900, Benjamin Peterson wrote:

could be written in ruby! A dream that I doubt will become real in my
lifetime… but perhaps, my grandchildren… or their grandchildren…

I hope your grandchildren won’t use Windows anymore.

Even though his name suggests that: How can you be sure that Benjamin
doesn’t already have grandchildren? Life is a permanent violation
of the principle of least surprise.

Gis,

Josef ‘Jupp’ Schugt

N’attribuez jamais à la malice ce que l’incompétence explique !
– Napoléon

Mauricio Fernández batsman.geo@yahoo.com wrote in message news:20030721102840.GA1557@student.ei.uni-stuttgart.de

···

On Mon, Jul 21, 2003 at 07:20:29PM +0900, Benjamin Peterson wrote:

Lothar Scholz mailinglists@scriptolutions.com wrote in message news:1173309890.20030719135052@scriptolutions.com

Can you tell me if .NET supports fibers ?

No, it supports real threads.

How do you mix the lack of thread safety of Ruby’s interpreter with .NET
real threads? I’m facing that problem with rjni (Java binding).

It is just barely possible (but very unusual and perverse) to use
fibers with .NET, as mentioned here:

http://blogs.gotdotnet.com/cbrumme/PermaLink.aspx/9fd9222c-ee65-424d-867e-8e4e52ea394b


However, I wasn’t envisioning using the current Ruby interpreter,
which is problematic in many ways. To enjoy the features we have been
fantasizing about in this thread, I think we would need one of three
major levels of functionality, listed easiest first:

Level 1
Feature: Use .NET libraries
Minimum Requirement: A module in Ruby to load and call .NET
assemblies. It doesn’t seem to be hard to write a C program to load
…NET assembly (and the runtime) and run a method (this is what
assemblies in the form of .exes do all the time). Presumably this C
code could be made into a ruby module.

Level 2
Feature: Take advantage of .NET infrastructure (threads, unicode,
etc)
Minimum Requirement: A ruby interpreter (or bytecode
compiler/interpreter) written in .NET, that reads ruby instructions
and executes .NET code in response. There is one lying around 3/4
built already.

Level 3
Feature: Fully integrate ruby modules with those in other .NET
languages
Minimum Requiremehnt: Compiler that compiles ruby code to .NET
assemblies. This would be quite difficult, as CLI and the .NET type
system are not at all designed for dynamically typed languages such as
ruby. You would have to decide whether to implement types yourself,
or to rely on dynamically adjusting .NET types, which is possible but
might be slow and/or complicated.


Level 1 should be just a matter of using the common language runtime
hosting interface and calling CorBindToRuntimeEx to get an
ICorRuntimeHost, then picking a module and loading it into an app
domain etc etc. Very easy, if all you want to do is call methods one
after another – if you want to switch back and forth between ruby
code and C# code I don’t know what problems would arise.

Level 3 would be a very large project and would probably involve an
industrial amount of work. Although the .NET runtime can support
modifying a type on the fly, I don’t think this would actually allow
ruby types to be represented 1-to-1 by .NET types. Perhaps the .NET
lisp projects have some insight into this.

Level 2, my favorite, would involve:
1–creating and maintaining a ruby grammar with c# or c++ bindings
(antlr?)
2–implementing ruby libraries in .net
3–implementing a ruby interpreter that joins (1) to (2) :slight_smile:
…plus a few other things. Number 1 sounds like the hard part to me.


Given that what I mostly want are the features in level 2, and that
level 3 is probably very hard, I would most like to see a project to
implement level 2, and if there were a live project then I’d try to
join in with it (hint hint). The abandoned one (NETRuby) really
looked good, although keeping the grammar in step with that of ruby
itself is a task I can’t handle.

I hope your grandchildren won’t use Windows anymore.

Of course not, I was just joking. In fact they’ll use Open BeTRON,
the BTRON-based open source version of BeOS which is currently still
secret – oops.