# Something has changed

**URL:** <https://www.ruby-forum.com/t/something-has-changed/169667>\
**Category:** IronRuby\
**Created:** [June 6, 2009, 3:26pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667 "2009-06-06T15:26:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [June 6, 2009, 3:26pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667/1 "2009-06-06T15:26:07Z")

</div>

Hi  
Since this weeks updates to ironruby ironrubymvc is completely broken.

The way overloads are selected now is different.

for example [asp.net](http://asp.net) mvc has a bunch of methods defined on Controller  
that  
are protected internal ie. protected internal void View(string, string)  
it also has an overload View(string, object)

Then it selects the one with object for example in some cases

also I used to be able to call that view method in a ruby subclass of  
Controller with view nil, ‘layout’

but now I have to call that with with view ‘’,‘layout’ for it to work  
for  
example. It doesn’t know that nil can also count as a string object.

There are a bunch of other things that are breaking for example it  
doesn’t  
like protected internals as much as it used to anymore either.

codeplex?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [June 6, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667/2 "2009-06-06T17:02:45Z")

</div>

Just curious, but why should nil count as a string object? In C Ruby,  
nil is  
an object, and an empty string object is not nil:

irb(main):001:0\> n = nil  
=\> nil  
irb(main):002:0\> s = String.new  
=\> “”  
irb(main):003:0\> n.nil?  
=\> true  
irb(main):004:0\> s.nil?  
=\> false  
irb(main):005:0\> s == n  
=\> false  
irb(main):006:0\> n.class  
=\> NilClass  
irb(main):007:0\> s.class  
=\> String  
irb(main):008:0\> s.eql? n  
=\> false

–  
Will G.  
[http://willgreen.mp/](http://willgreen.mp/)

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [June 6, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667/3 "2009-06-06T17:06:51Z")

</div>

In C# you can pass null to a string parameter and it won’t complain I  
expected this to work from ironruby too because it did before. So I want  
to  
find out if that is going to be a permanent change or if it is a bug 🙂

## so i’m not talking about an empty instance of String being nil but it’s about interop with CLR stuff

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [June 6, 2009, 5:16pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667/4 "2009-06-06T17:16:15Z")

</div>

It would be good to be more specific about the example.

Consider class Foo {  
public void Bar(int, object);  
public void Bar(int, string);  
}

If I call “Foo.new.Bar 1, nil”, then this is an ambiguous call and you  
should be forced to specify which overload you want.

In statically-typed languages, variables have types and the declared  
type of the variable is used to select an overload at compile time. This  
obviously doesn’t work for a dynamically-typed language calling into a  
statically-typed API, so we have to use the runtime types to select the  
overload. C# dynamic calls face the same issue.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Saturday, June 06, 2009 8:05 AM  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] something has changed

## In C# you can pass null to a string parameter and it won’t complain I expected this to work from ironruby too because it did before. So I want to find out if that is going to be a permanent change or if it is a bug 🙂 so i’m not talking about an empty instance of String being nil but it’s about interop with CLR stuff

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

On Sat, Jun 6, 2009 at 4:52 PM, Will G.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Just curious, but why should nil count as a string object? In C Ruby,  
nil is an object, and an empty string object is not nil:

irb(main):001:0\> n = nil  
=\> nil  
irb(main):002:0\> s = String.new  
=\> “”  
irb(main):003:0\> n.nil?  
=\> true  
irb(main):004:0\> s.nil?  
=\> false  
irb(main):005:0\> s == n  
=\> false  
irb(main):006:0\> n.class  
=\> NilClass  
irb(main):007:0\> s.class  
=\> String  
irb(main):008:0\> s.eql? n  
=\> false

–  
Will G.  
[http://willgreen.mp/](http://willgreen.mp/)

On Sat, Jun 6, 2009 at 9:23 AM, Ivan Porto C.  
\<removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:  
Hi

Since this weeks updates to ironruby ironrubymvc is completely broken.

The way overloads are selected now is different.

for example [asp.net](http://asp.net)[http://asp.net](http://asp.net) mvc has a bunch of methods defined  
on Controller that are protected internal ie. protected internal void  
View(string, string)  
it also has an overload View(string, object)

Then it selects the one with object for example in some cases

also I used to be able to call that view method in a ruby subclass of  
Controller with view nil, ‘layout’

but now I have to call that with with view ‘’,‘layout’ for it to work  
for example. It doesn’t know that nil can also count as a string  
object.

There are a bunch of other things that are breaking for example it  
doesn’t like protected internals as much as it used to anymore either.

codeplex?

* * *

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [June 6, 2009, 6:18pm UTC](https://www.ruby-forum.com/t/something-has-changed/169667/5 "2009-06-06T18:18:28Z")

</div>

So the signatures I’m talking about look like this:  
protected internal void UpdateModel(TModel model) where  
TModel : class {  
UpdateModel(model, null, null, null, ValueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix) where TModel : class {  
UpdateModel(model, prefix, null, null, ValueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, 

```

string[]  
includeProperties) where TModel : class {  
UpdateModel(model, null, includeProperties, null,  
ValueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix, string[] includeProperties) where TModel : class {  
UpdateModel(model, prefix, includeProperties, null,  
ValueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix, string[] includeProperties, string[] excludeProperties) where  
TModel  
: class {  
UpdateModel(model, prefix, includeProperties,  
excludeProperties,  
ValueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model,

```

IDictionary\<string, ValueProviderResult\> valueProvider) where TModel :  
class  
{  
UpdateModel(model, null, null, null, valueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix, IDictionary\<string, ValueProviderResult\> valueProvider) where  
TModel  
: class {  
UpdateModel(model, prefix, null, null, valueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, 

```

string[]  
includeProperties, IDictionary\<string, ValueProviderResult\>  
valueProvider)  
where TModel : class {  
UpdateModel(model, null, includeProperties, null,  
valueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix, string[] includeProperties, IDictionary\<string,  
ValueProviderResult\>  
valueProvider) where TModel : class {  
UpdateModel(model, prefix, includeProperties, null,  
valueProvider);  
}

```
    protected internal void UpdateModel<TModel>(TModel model, string

```

prefix, string[] includeProperties, string[] excludeProperties,  
IDictionary\<string, ValueProviderResult\> valueProvider) where TModel :  
class  
{  
bool success = TryUpdateModel(model, prefix,  
includeProperties,  
excludeProperties, valueProvider);  
if (!success) {  
string message =  
String.Format(CultureInfo.CurrentUICulture,  
MvcResources.Controller\_UpdateModel\_UpdateUnsuccessful,  
typeof(TModel).FullName);  
throw new InvalidOperationException(message);  
}  
}

The methods above are defined in [ASP.NET](http://ASP.NET) MVC but with the current git  
build  
I can’t call these methods in an inheriting ruby class it will give me  
an  
error.

when I work around it with:  
public new virtual void UpdateModel(TModel model) where  
TModel : class  
{  
UpdateModel(model, null, null, null, ValueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, string

```

prefix) where TModel : class  
{  
UpdateModel(model, prefix, null, null, ValueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string[]  
includeProperties) where TModel : class  
{  
UpdateModel(model, null, includeProperties, null,  
ValueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string  
prefix, string[] includeProperties) where TModel : class  
{  
UpdateModel(model, prefix, includeProperties, null,  
ValueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string  
prefix, string[] includeProperties, string[] excludeProperties) where  
TModel  
: class  
{  
UpdateModel(model, prefix, includeProperties,  
excludeProperties,  
ValueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model,

```

IDictionary\<string, ValueProviderResult\> valueProvider) where TModel :  
class  
{  
UpdateModel(model, null, null, null, valueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string  
prefix, IDictionary\<string, ValueProviderResult\> valueProvider) where  
TModel  
: class  
{  
UpdateModel(model, prefix, null, null, valueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string[]  
includeProperties, IDictionary\<string, ValueProviderResult\>  
valueProvider)  
where TModel : class  
{  
UpdateModel(model, null, includeProperties, null,  
valueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string  
prefix, string[] includeProperties, IDictionary\<string,  
ValueProviderResult\>  
valueProvider) where TModel : class  
{  
UpdateModel(model, prefix, includeProperties, null,  
valueProvider);  
}

```
    public new virtual void UpdateModel<TModel>(TModel model, 

```

string  
prefix, string[] includeProperties, string[] excludeProperties,  
IDictionary\<string, ValueProviderResult\> valueProvider) where TModel :  
class  
{  
base.UpdateModel(model, prefix,  
includeProperties,excludeProperties,valueProvider);  
}

things work again in the inheriting controller

def save\_user(act)  
_self.method(:update\_model).of(User).call(@user, “user”)_

```
if @user.is_valid
  @membership_service.save @user
  redirect_to_action('index', 'users')
else
  view act.to_s, :layout
end

```

## end

Met vriendelijke groeten - Best regards - Salutations  
Ivan Porto C.  
Blog: [http://flanders.co.nz](http://flanders.co.nz)  
Twitter: [http://twitter.com/casualjim](http://twitter.com/casualjim)  
Author of IronRuby in Action ([http://manning.com/carrero](http://manning.com/carrero))
