I thought about that, but given that there are like 15 overloads for Append it
might be an unnecessary code duplication to add them for constructors as well.
You can do it on a single line too:
MutableString str = MutableString.CreateBinary(received).Append(buffer, 0,
received);
Append returns
Hi Peter,
Fantastic point, now that I am understanding the code, it makes perfect sense,
I really appriciate the comments.
Thanks.
- Original Message
From: Peter Bacon Darwin <[EMAIL PROTECTED]>
To: ironruby-core@rubyforge.org
Sent: Sunday, May 11, 2008 7:14:48 AM
Subject: Re: [Ironruby
1. ConvertToString is much more readable.
2. The JITter could theoretically eliminate one or more method calls anyway
(though I can't say that I know for sure that it does).
3. We haven't done anything to optimize this new version of MutableString
yet. In particular, we might find that getting a
The chdir_spec warnings are to do with block-less calls to chdir within a
block attached to another call to chdir.
The following code does not raise a warning...
irb(main):001:0> Dir.chdir("c:\\Windows") do
irb(main):002:1* puts Dir.pwd
irb(main):003:1> Dir.chdir("System32") do
irb
Magic!
Now the next question is should I be using:
mutableString.ConvertToString() or mutableString.GetStringSlice(0)
to get hold of a CLR string for passing to a .NET method.
Both end up calling Content.GetStringSlice(...) anyway but the second one
seems to go through slightly fewer meth
MutableString.ToSymbol()?
On Sun, May 11, 2008 at 5:34 AM, Peter Bacon Darwin <
[EMAIL PROTECTED]> wrote:
> It would be useful to have a helper function to clean up this kind of
> code. Or is there one and I can't find it?
>
>
>
> RubyUtils.GetConstant(context, rubyClass,
> SymbolTable.StringT
It would be useful to have a helper function to clean up this kind of code.
Or is there one and I can't find it?
RubyUtils.GetConstant(context, rubyClass,
SymbolTable.StringToId(mutableString.ConvertToString()), true);
___
Ironruby-core mailing
One thing that MutableString could do with is
public static MutableString/*!*/ CreateBinary(byte[]/*!*/ bytes, int
start, int length) {
At the moment you have to do something like:
MutableString str = MutableString.CreateBinary();
str.Append(buffer, 0, received);
Pete
Hi Unnikrishnan,
Just a couple of points you might find useful:
. A number of overloads have parameters like ..., object/*!*/ path,
... What you are saying to the Specsharp tool is that object should never be
null. Is this what you want? Can you pass nil into the methods in MRI? If
you