[Ironruby-core] How to extend builtin classes?

Krishna Krishnamaneni kitti.k at gmail.com
Sun Oct 7 15:00:24 EDT 2007


Curt,

  Thank you for the reply. Looks like this is something that should be
commited. Can you commit your changes to the SVN repository so that
every one can get the changes? Thanks a lot.

On 10/7/07, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> On 10/6/07, Krishna Krishnamaneni <kitti.k at gmail.com> wrote:
> >
> > How do we extend inbuilt classes. For example Float doesn't have *
> > method implemented. I tried adding this method:
>
>
> It's not sufficient to add the method to the class definition.  You also
> have to force the method information to be initialized by updating the file
> Initializer.Generated.cs.  As its name suggests, this file is automatically
> generated from the source code by running the "ClassInitGenerator" program
> -- a batch file that does this is at
> Builtins\GenerateInitializers.cmd.
>
> Unfortunately, the version of the source that's checked into RubyForge has a
> bunch of broken paths for this purpose -- at least when not using Visual
> Studio.  I tried to use msbuild directly to build ClassInitGenerator.exe ,
> and found that I had to make the following edits for things to work
> correctly:
>
> utils\ironruby.classinitgenerator\ClassInitGenerator.csproj
>   add reference to
> ..\..\build\debug\Microsoft.Scripting.dll
>   add reference to ..\..\build\debug\Ruby.dll
>   fix the reference path for Microsoft.Scripting.csproj
>   fix the reference path for Ruby.csproj
> src\ironruby\Ruby.csproj
>   fix the reference path for Microsoft.Scripting.csproj
> src\ironruby\Builtins\GenerateInitializers.cmd
>   fix the path to ClassInitGenerator.exe
>
> After making these changes, I ran GenerateInitializers.cmd and rebuilt
> IronRuby using the Rakefile.  Your change then worked:
>
> F:\IronRuby>build\release\rbx.exe
> IronRuby Pre-Alpha (1.0.0.0) on .NET 2.0.50727.312
> Copyright (c) Microsoft Corporation. All rights reserved.
> >>> 1.2 + 1.2
> => 2.4
> >>> 1.2 * 1.2
> => 1.44
>
> --
> Curt Hagenlocher
> curt at hagenlocher.org
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


-- 
Regards,
krishna krishnamaneni.


More information about the Ironruby-core mailing list