My solution, when I am going to be using the class name a lot, is to put an 
alias at the top of the file, for example, SArray = System::Array. That allows 
me to save some characters, and come close to what include System would have 
done.

JD

...there is no try

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Shri Borde
Sent: Thursday, June 11, 2009 2:32 PM
To: Tomas Matousek
Cc: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Math module after "include System"

 So only constants and classes that did not already exist are copied? The docs 
don't mention this. Oh well. Something for folks to be aware of if they do 
"include System". Names like Math, Thread, etc which clash between Ruby and the 
System namespace will not be copied...

From: Tomas Matousek
Sent: Thursday, June 11, 2009 2:06 PM
To: Shri Borde
Subject: RE: Math module after "include System"

Yes, that is expected. The Ruby equivalent would be:

module S
  class Math
  end
end

include S
p Math.singleton_methods

["atan", "frexp", "sin", "exp", "tanh", "erf", "asin", "sqrt", "cos", "atanh", 
"sinh", "hypot", "acos", "log10", "atan2"
, "asinh", "cosh", "ldexp", "tan", "log", "acosh", "erfc"]

Tomas

From: Shri Borde
Sent: Thursday, June 11, 2009 1:31 PM
To: Tomas Matousek
Subject: Math module after "include System"

After doing "include System", I was expecting System.Math to be directly 
accessible. However "Math" still refers to the Ruby builtin module. Is this 
expected?

c:\vsl\Merlin\Main\Languages\Ruby\Samples\Tutorial>rbx
IronRuby 0.5.0.0 on .NET 2.0.50727.3053
Copyright (c) Microsoft Corporation. All rights reserved.

>>> Math.methods(false).sort
=> ["acos", "acosh", "asin", "asinh", "atan", "atan2", "atanh", "cos", "cosh", 
"erf", "erfc", "exp", "frexp", "hypot", "
ldexp", "log", "log10", "sin", "sinh", "sqrt", "tan", "tanh"]
>>> include System
=> Object
>>> AppDomain
=> System::AppDomain
>>> Math
=> Math
>>>


















Thanks,
Shri

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to