From benjaminkeeping at gmail.com Tue Apr 3 15:13:54 2012
From: benjaminkeeping at gmail.com (Ben Keeping)
Date: Tue, 3 Apr 2012 16:13:54 +0100
Subject: [Ironruby-core] mixing in a C# interface which declares generic
return types
Message-ID:
Hi,
I'm trying to mixin a C# interface into a ruby class, in order to use it as
a mock.
My Ruby class :
class MockFoo
include IFoo
end
The C# interface :
public interface IFoo {
T Get(); // this is OK
IEnumerable GetAll(); // this fails
}
When calling MockFoo.new, I get the following error :
Method
System.Runtime.CompilerServices.CallSite`1[System.Func`4[System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,System.Object,System.Collections.Generic.IEnumerable`1[T]]]
Create(System.Runtime.CompilerServices.CallSiteBinder) contains generic
parameters (ArgumentError)
System.Core:0:in `ValidateMethodInfo'
System.Core:0:in `Call'
System.Core:0:in `BindCore'
./features/registration/send_verification_email/send_verification_email_steps.rb:18
features\registration\send_verification_email\send_verification_email.feature:9:in
`When I register'
Its OK for methods like :
T Get()
or
T DoStuff(T bla)
But whenever I try to return a collection of T :
IEnumerable GetAll();
it fails.
Any ideas ?
Cheers,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From Orion.Edwards at gallagher.co Tue Apr 3 21:03:45 2012
From: Orion.Edwards at gallagher.co (Orion Edwards)
Date: Wed, 4 Apr 2012 09:03:45 +1200
Subject: [Ironruby-core] mixing in a C# interface which declares
generic return types
In-Reply-To:
References:
Message-ID:
As far as I can tell, this is simply not supported. I don't know the
reason why.
My guess is that when calling Get, IronRuby has to do some work to
figure out what the return value of T should be.
When calling GetAll, There's even more work that has to be done to
propagate the T back into IEnumerable... I've done this kind of
reflection work in C# before and it kind of sucks, so I'm not super
surprised it's not handled.
It's a bit of an odd thing to be doing in IronRuby anyway, because the
ruby language has no concept of generics, and therefore no way to express
the extra type data they provide... it's kind of a mismatch.
Given
public interface IFoo
{
T Get();
}
public static void CallGet(IFoo foo)
{
Console.WriteLine(foo.Get());
}
and a ruby mock object:
class MockFoo
include IFoo
def get
puts "get called... but we have no idea what T is"
return 12 # hopefully T was a fixnum or something convertible
end
end
-- the code does work, you can invoke CallGet or CallGet from
C# supplying the ruby mock object, but the ruby get method has no way to
know what T is, which will likely lead to other problems.
FYI, hoisting the generic up to the interface declaration works fine in
all situations, because ruby no longer has to infer the generic T on the
fly for every method call.
public interface IFoo
{
T Get();
IEnumerable GetAll();
}
class MockFoo
include IFoo.of(Fixnum)
def get
puts "get called..."
12
end
def get_all
puts "get all called..."
System::Array.of(Fixnum).new( [1,2,3] )
end
end
______________________________________________________
Orion Edwards | Technical Leader
PHONE +64 7 838 9800 | FAX +64 7 838 9801 |
EMAIL orion.edwards at gallagher.co | WEB www.gallagher.co
From: Ben Keeping
To: ironruby-core at rubyforge.org
Date: 04/04/2012 03:24 a.m.
Subject: [Ironruby-core] mixing in a C# interface which declares
generic return types
Sent by: ironruby-core-bounces at rubyforge.org
Hi,
I'm trying to mixin a C# interface into a ruby class, in order to use it
as a mock.
My Ruby class :
class MockFoo
include IFoo
end
The C# interface :
public interface IFoo {
T Get(); // this is OK
IEnumerable GetAll(); // this fails
}
When calling MockFoo.new, I get the following error :
Method
System.Runtime.CompilerServices.CallSite`1[System.Func`4[System.Runtime.CompilerServices.CallSite,IronRuby.Runtime.RubyContext,System.Object,System.Collections.Generic.IEnumerable`1[T]]]
Create(System.Runtime.CompilerServices.CallSiteBinder) contains generic
parameters (ArgumentError)
System.Core:0:in `ValidateMethodInfo'
System.Core:0:in `Call'
System.Core:0:in `BindCore'
./features/registration/send_verification_email/send_verification_email_steps.rb:18
features\registration\send_verification_email\send_verification_email.feature:9:in
`When I register'
Its OK for methods like :
T Get()
or
T DoStuff(T bla)
But whenever I try to return a collection of T :
IEnumerable GetAll();
it fails.
Any ideas ?
Cheers,
Ben_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 3465 bytes
Desc: not available
URL:
From lists at ruby-forum.com Thu Apr 5 12:08:53 2012
From: lists at ruby-forum.com (Eric Kramer)
Date: Thu, 05 Apr 2012 14:08:53 +0200
Subject: [Ironruby-core] IronRuby 1.1.1 IIRB failing
In-Reply-To:
References:
Message-ID:
Hmmm, same problem here after installing 1.1.1 (after a previous 1.0
install). I tried resetting sizes and still no success. It would be
neat to have this work :-)
--
Posted via http://www.ruby-forum.com/.
From lists at ruby-forum.com Sun Apr 8 14:36:13 2012
From: lists at ruby-forum.com (Kevin McCaughey)
Date: Sun, 08 Apr 2012 16:36:13 +0200
Subject: [Ironruby-core] Trouble getting started - some basic questions
Message-ID:
Hi,
I have read through a few pages of the list and read what I can on the
internet, but I am struggling to find answers to a couple of very basic
questions. I have just learned ruby using Notepad++ and the windows
package of Ruby 1.9.3. I used to be a systems programmer in assembly
language and C. I have a basic knowledge of .NET and a good knowledge of
Windows. I have IR 1.1 installed with VS 2010.
These questions are what I am confused about:
1. Can I write a Ruby application that uses .NET for system stuff
(Windows, forms, networking) and package that as an installation that
end users can install on their computer without going through the whole
(for users) Ruby installation rigmarole? i.e. Can I write a GUI
applications and distribute them with a few DLL's packaged and a
requirement for .NET 4?
2. Is the IR implementation any faster/slower than the standard?
3. Can Ironruby use JRuby as for the VM? Or maybe that is an irrelevant
question and I am misunderstanding how IronRuby works?
4. Is IR with Mono very bloated? I was going to use wxRuby, but it seems
dead and I am now thinking of working in IR instead.
Basically I am wanting to write simple GUI stuff in Ruby to help me
learn Ruby better and also learn a bit of .NET. I will be using Rails
for my main server app, but I am not moving on to that until I learn
Ruby much better. I have gotten fed up writing console apps and want a
simple way to get some GUI going.
Thanks very much for any help or advice you can give :)
Kevin McCaughey
--
Posted via http://www.ruby-forum.com/.
From lists at ruby-forum.com Sun Apr 8 15:38:34 2012
From: lists at ruby-forum.com (Kevin McCaughey)
Date: Sun, 08 Apr 2012 17:38:34 +0200
Subject: [Ironruby-core] Installing gems into IronRuby
In-Reply-To: <3855318c7329a62df09a9fe3f9da8d1c@ruby-forum.com>
References: <3855318c7329a62df09a9fe3f9da8d1c@ruby-forum.com>
Message-ID:
Yes - admin mode for cmd is essential for any of this scripting stuff. I
used to run into all sorts of errors, even with normal Ruby updates. I
now have a cmd shortcut on the desktop that asks for admin and has a
couple of other tweak (consolas font, wider window etc)
--
Posted via http://www.ruby-forum.com/.
From rob.s.brit at gmail.com Sun Apr 8 15:43:02 2012
From: rob.s.brit at gmail.com (Rob Britton)
Date: Sun, 8 Apr 2012 11:43:02 -0400
Subject: [Ironruby-core] Trouble getting started - some basic questions
In-Reply-To:
References:
Message-ID:
> 1. Can I write a Ruby application that uses .NET for system stuff
> (Windows, forms, networking) and package that as an installation that
> end users can install on their computer without going through the whole
> (for users) Ruby installation rigmarole? i.e. Can I write a GUI
> applications and distribute them with a few DLL's packaged and a
> requirement for .NET 4?
Yes, sorta. While you can technically just have .rb files for your app
and execute those directly, it might be easier to have a C# .exe file
and load the Ruby files from that. That way you can have an .exe for
people to open rather than them having to find the correct Ruby file.
It will also make it easier to do some of the things I mention later
in this email.
A while back I did up a little post on how to get IronRuby working
from a C# app: http://lovehateubuntu.blogspot.ca/2010/12/embedding-ruby-repl-in-net-app.html
> 2. Is the IR implementation any faster/slower than the standard?
Not sure, but if you're using Ruby for a GUI app it doesn't really
matter which version of Ruby you use: it will be slow or fast
depending on what you're doing, the difference between the different
Rubies is just noise. If a particular thing is too slow, write it in
C# and expose it to your Ruby code.
> 3. Can Ironruby use JRuby as for the VM? Or maybe that is an irrelevant
> question and I am misunderstanding how IronRuby works?
No. IronRuby is Ruby, but running in the .NET VM. JRuby is Ruby, but
running in the Java VM. C Ruby is Ruby, running in the Ruby VM. All of
the languages are the same, just running in different environments.
The difference is when you start using libraries: if you use
System.Windows.Forms, then you can't use your code in MRI or JRuby
because they don't have that library (it's a .NET library). Likewise
if you use C libraries written for MRI, you can't use JRuby or
IronRuby, and if you use Java libraries then you can't use MRI or
IronRuby.
> 4. Is IR with Mono very bloated? I was going to use wxRuby, but it seems
> dead and I am now thinking of working in IR instead.
Ruby in general uses up a lot more memory than the equivalent C#
program, has nothing to do with using Mono or wxRuby or whatever. It's
one of the costs you pay to be able to have Ruby's expressiveness.
>From my experience converting code between IronRuby and C# it can be
as much as a 10x difference in memory usage.
> Basically I am wanting to write simple GUI stuff in Ruby to help me
> learn Ruby better and also learn a bit of .NET. I will be using Rails
> for my main server app, but I am not moving on to that until I learn
> Ruby much better. I have gotten fed up writing console apps and want a
> simple way to get some GUI going.
One thing to note: Rails is a web application framework designed for
building websites, not GUI apps. If you want to build a GUI app, then
you don't need Rails at all.
Hope this helps!
-Rob
From lists at ruby-forum.com Sun Apr 8 17:16:55 2012
From: lists at ruby-forum.com (Kevin McCaughey)
Date: Sun, 08 Apr 2012 19:16:55 +0200
Subject: [Ironruby-core] Trouble getting started - some basic questions
In-Reply-To:
References:
Message-ID:
Rob, thanks a million for your very helpful reply - it has really
clarified things for me :)
I am writing a server based system but, in addition to the web based
front end (Rails), I want a GUI application which talks to the server. I
am also wanting to play around with GUI programming. I know C# is
probably easier in some respects, but I have really fallen in love with
Ruby and would like it to do some prototyping and for quicker
development of some things. And also just to play with!
Thanks again for your timely reply - I am sat here all day trying to
make my mind up which way to go and you have saved me hours of reading!
Kevin
--
Posted via http://www.ruby-forum.com/.
From perlun at gmail.com Mon Apr 30 20:10:33 2012
From: perlun at gmail.com (Per Lundberg)
Date: Mon, 30 Apr 2012 23:10:33 +0300
Subject: [Ironruby-core] Installing gems extremely slow?
Message-ID:
Hi!
Is it just me, or is installing gems with IronRuby extremely slow? (at
least compared to other Ruby platforms, like JRuby)
It seems to pretty much halt here:
C:\Work\git\rayak\examples\sinatra>igem install --verbose sinatra
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
After quite some time, it proceeded and went on with the install as
expected.
With JRuby 1.6.7 it looks like this. Very similar as with the above, but a
*lot* faster. Is there a significant performance bottleneck with the
current IronRuby, or is it caused by some form of timeout or similar?
C:\Work\git\rayak\examples\sinatra>gem install --verbose sinatra
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
Installing gem sinatra-1.3.2
Downloading gem sinatra-1.3.2.gem
GET http://rubygems.org/gems/sinatra-1.3.2.gem
302 Moved Temporarily
GET http://production.cf.rubygems.org/gems/sinatra-1.3.2.gem
Fetching: sinatra-1.3.2.gem (100%)
200 OK
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/.yardopts
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/AUTHORS
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/CHANGES
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/Gemfile
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/LICENSE
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.de.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.es.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.fr.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.hu.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.jp.rdoc
[ snip ]
Best regards,
Per
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From jschementi at gmail.com Mon Apr 30 20:14:27 2012
From: jschementi at gmail.com (Jimmy Schementi)
Date: Mon, 30 Apr 2012 16:14:27 -0400
Subject: [Ironruby-core] Installing gems extremely slow?
In-Reply-To:
References:
Message-ID:
Try running with the --no-ri and --no-rdoc flags, I suspect generating
documentation is what is taking the time.
~Jimmy
On Apr 30, 2012, at 4:10 PM, Per Lundberg wrote:
Hi!
Is it just me, or is installing gems with IronRuby extremely slow? (at
least compared to other Ruby platforms, like JRuby)
It seems to pretty much halt here:
C:\Work\git\rayak\examples\sinatra>igem install --verbose sinatra
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
After quite some time, it proceeded and went on with the install as
expected.
With JRuby 1.6.7 it looks like this. Very similar as with the above, but a
*lot* faster. Is there a significant performance bottleneck with the
current IronRuby, or is it caused by some form of timeout or similar?
C:\Work\git\rayak\examples\sinatra>gem install --verbose sinatra
GET http://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET http://rubygems.org/specs.4.8.gz
302 Moved Temporarily
GET http://production.s3.rubygems.org/specs.4.8.gz
200 OK
Installing gem sinatra-1.3.2
Downloading gem sinatra-1.3.2.gem
GET http://rubygems.org/gems/sinatra-1.3.2.gem
302 Moved Temporarily
GET http://production.cf.rubygems.org/gems/sinatra-1.3.2.gem
Fetching: sinatra-1.3.2.gem (100%)
200 OK
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/.yardopts
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/AUTHORS
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/CHANGES
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/Gemfile
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/LICENSE
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.de.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.es.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.fr.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.hu.rdoc
c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.jp.rdoc
[ snip ]
Best regards,
Per
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
From per at solfnet.fi Mon Apr 30 20:16:44 2012
From: per at solfnet.fi (Per Lundberg)
Date: Mon, 30 Apr 2012 23:16:44 +0300
Subject: [Ironruby-core] Installing gems extremely slow?
In-Reply-To:
References:
Message-ID:
Hehe, that was a prompt reply. :-)
Generating the rdoc is taking some time yes, but this was actually before
it even managed to start downloading the .gem file. It's sitting and
generating up the rdocs right now as we're speaking...
What is your general perception of IronRuby, performance-wise? Comparable
to other platforms or lagging slightly behind?
Best regards,
Per
On Mon, Apr 30, 2012 at 11:14 PM, Jimmy Schementi wrote:
> Try running with the --no-ri and --no-rdoc flags, I suspect generating
> documentation is what is taking the time.
>
> ~Jimmy
>
>
> On Apr 30, 2012, at 4:10 PM, Per Lundberg wrote:
>
> Hi!
>
> Is it just me, or is installing gems with IronRuby extremely slow? (at
> least compared to other Ruby platforms, like JRuby)
>
> It seems to pretty much halt here:
>
> C:\Work\git\rayak\examples\sinatra>igem install --verbose sinatra
> GET http://rubygems.org/latest_specs.4.8.gz
> 302 Moved Temporarily
> GET http://production.s3.rubygems.org/latest_specs.4.8.gz
> 200 OK
> GET http://rubygems.org/specs.4.8.gz
> 302 Moved Temporarily
> GET http://production.s3.rubygems.org/specs.4.8.gz
> 200 OK
>
> After quite some time, it proceeded and went on with the install as
> expected.
>
> With JRuby 1.6.7 it looks like this. Very similar as with the above, but a
> *lot* faster. Is there a significant performance bottleneck with the
> current IronRuby, or is it caused by some form of timeout or similar?
>
> C:\Work\git\rayak\examples\sinatra>gem install --verbose sinatra
> GET http://rubygems.org/latest_specs.4.8.gz
> 302 Moved Temporarily
> GET http://production.s3.rubygems.org/latest_specs.4.8.gz
> 200 OK
> GET http://rubygems.org/specs.4.8.gz
> 302 Moved Temporarily
> GET http://production.s3.rubygems.org/specs.4.8.gz
> 200 OK
> Installing gem sinatra-1.3.2
> Downloading gem sinatra-1.3.2.gem
> GET http://rubygems.org/gems/sinatra-1.3.2.gem
> 302 Moved Temporarily
> GET http://production.cf.rubygems.org/gems/sinatra-1.3.2.gem
> Fetching: sinatra-1.3.2.gem (100%)
> 200 OK
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/.yardopts
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/AUTHORS
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/CHANGES
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/Gemfile
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/LICENSE
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.de.rdoc
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.es.rdoc
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.fr.rdoc
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.hu.rdoc
> c:/jruby-1.6.7/lib/ruby/gems/1.8/gems/sinatra-1.3.2/README.jp.rdoc
> [ snip ]
>
> Best regards,
> Per
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
--
mvh,
Per Lundberg
Arbetsgruppen Fiber till Solf | www.solfnet.fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: