Lee Culver
2007-Nov-07 22:40 UTC
[Ironruby-core] Implementation plan and a string question...
I''ve been playing with IronRuby a bit today, and I notice that the reflection methods are not yet implemented (e.g. running "".methods in the interpreter does not produce the expected result). This is not surprising, given the early stages of development. Is there a plan in place as to which features currently have the highest priority for implementation, and if so what is the priority of reflection? IMO, reflection methods should probably be a moderately high priority, as this would help with implementing most other features. For example, I was trying to see what string functions were missing from the implementation from within the IronRuby interpreter, but got an error when trying to get the methods for strings... Of course I can pull up the source (and did), but I think implementing some of these things would be easier with reflection in place. Just a suggestion... My second question is related to strings... You are currently StringBuilder to implement your MutableString class, though there is a comment about eventually replacing this with byte[]. Is there any ETA on when that might happen? I had wanted to work on implementing some of the string functions to get myself acquainted with the codebase, but I see that the string class is in a state where it might not be the best of ideas to try to add new functionality... Or, if you are willing to accept a patch for it, I may try the StringBuilder -> byte[] conversion myself. 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?). Thanks for your time, -Lee Culver -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ironruby-core/attachments/20071107/0dbf1c79/attachment.html
Joe Chung
2007-Nov-07 23:35 UTC
[Ironruby-core] Implementation plan and a string question...
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. So: 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 this: 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/.
Sanghyeon Seo
2007-Nov-07 23:43 UTC
[Ironruby-core] Implementation plan and a string question...
2007/11/8, Lee Culver <leculver at microsoft.com>:> Lastly, I see the following in the code base: /*!*/. For example: > > public MutableString/*!*/ Append(string/*!*/ str, int startIndex, > int charCount) { > > What does this mean?That the parameters marked are assumed to be non-null. It''s used by Spec#. Full answer here: http://rubyforge.org/pipermail/ironruby-core/2007-October/000258.html -- Seo Sanghyeon
John Lam (DLR)
2007-Nov-10 01:24 UTC
[Ironruby-core] Implementation plan and a string question...
Lee Culver:> Is there a plan in place as to which features currently have the > highest priority for implementation, and if so what is the priority of > reflection? IMO, reflection methods should probably be a moderately > high priority, as this would help with implementing most other > features. > For example, I was trying to see what string functions were missing > from the implementation from within the IronRuby interpreter, but got > an error when trying to get the methods for strings... Of course I can > pull up the source (and did), but I think implementing some of these > things would be easier with reflection in place. Just a suggestion...As we refactor stuff after our RubyConf hacks, we''re adding the method reflection methods. This should show up either early next week when we resync our tree with SVN.> My second question is related to strings... You are currently > StringBuilder to implement your MutableString class, though there is a > comment about eventually replacing this with byte[]. Is there any ETA > on when that might happen? I had wanted to work on implementing some > of the string functions to get myself acquainted with the codebase, > but I see that the string class is in a state where it might not be > the best of ideas to try to add new functionality... Or, if you are > willing to accept a patch for it, I may try the StringBuilder -> > byte[] conversion myself.If you want to try the byte[] conversion, please go for it. You could also take the approach of implementing additional instance methods on String since the interface to StringBuilder should be mostly compatible.> Lastly, I see the following in the code base: /*!*/. For example: > > public MutableString/*!*/ Append(string/*!*/ str, int > startIndex, int charCount) { >These are the Spec# annotations. There is a wiki with some info on Spec#: http://channel9.msdn.com/wiki/default.aspx/SpecSharp.HomePage http://channel9.msdn.com/wiki/default.aspx/SpecSharp.SpecSharpAttributes Research papers are available on http://research.microsoft.com/specsharp. Thanks, -John
John Messerly
2007-Nov-10 01:53 UTC
[Ironruby-core] Implementation plan and a string question...
John Lam:> > Lee Culver: > > > Lastly, I see the following in the code base: /*!*/. For example: > > > > public MutableString/*!*/ Append(string/*!*/ str, int > > startIndex, int charCount) { > > > > These are the Spec# annotations. There is a wiki with some info on > Spec#: > > http://channel9.msdn.com/wiki/default.aspx/SpecSharp.HomePage > http://channel9.msdn.com/wiki/default.aspx/SpecSharp.SpecSharpAttribute > s > > Research papers are available on > http://research.microsoft.com/specsharp. >And, in particular, the /*!*/ means "should never be null". Common things that can''t be null are CodeContext arguments, and the "self" argument in most library methods (however if you''re implementing a Module, self can be null, e.g. class NilClass; include MyModule; end; nil.my_module_method) The /*!*/ is only processed by Spec#, and should not be confused with the [NotNull] attribute that you can use to tell the DLR MethodBinder that null isn''t allowed for that argument. - John