[Ironruby-core] Implementation plan and a string question...

Joe Chung lists at ruby-forum.com
Wed Nov 7 18:35:45 EST 2007

Lee Culver wrote:
> Lastly, I see the following in the code base: /*!*/.  For example:
>         public MutableString/*!*/ Append(string/*!*/ str, int 
> startIndex, int charCount) {
> What does this mean?  Is there a coding standards document which 
> describes this?  I don't see any documentation in the codebase about it, 
> but I assume that it means roughly the same as it does in ruby (that the 
> method is destructive or somehow changing the object), but I can't 
> reconcile that with some things I see in the code base...(for example, 
> why the ! on the str parameter?).

This is only a guess, but one thing I've noticed that was missing in C# 
is the ability to specify that a nullable type (like string) should 
never be null.


string! foo = null;

would result in a compiler error, and you would be required to cast a 
nullable string explicitly to a non-nullable string like:

string bar;
string! foo = (string!)bar;

One gotcha with my guess is that "as" semantics wouldn't work well with 

string bar = null;
string! foo = bar as string!;
would fail unless the "as" operator is able to set foo to 
default(string!), which might be String.Empty.

This is just a guess though.
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list