This repository was archived by the owner on Sep 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 343
Modifying the sources
shri edited this page Sep 13, 2010
·
13 revisions
Before fixing a bug, please make sure that there is a failing RubySpec for the defect. The spec should test for all the corner cases like:
- nil arguments
- arguments that can be converted via
to_<type>methods like to_s - if blocks can be passed even to a method which does not use the block
- missing block for a method which requires a block
- if the return value of the block is returned back
- Use .NET Framework conventions for all identifiers. There is no specific guideline for naming private fields in this document; we prefix field names with underscores (e.g.
private string _fooBar). If you’re not sure about some convention try to find out in the rest of the IronRuby code or ask in the list.
- Use
/*!*/for method parameters and instance fields that should never be null. Spec# annotations.
- Do not use public fields (Base::algorithm, buffer). Use properties if it is necessary to expose the field or private/internal visibility otherwise. Also use readonly if the field is not mutated after the object is constructed.
- You don’t need to declare
Call_Foomethods in order to invoke a dynamic site unless the invocation is somehow more complex (involves some conversions etc.)
- Please test for corner cases, eg whether the methods accept null arguments etc. Mark the parameters appropriately ([NotNull] attribute,
/*!*/etc.), add precondition checks. Here’s an example:
[RubyMethod("*")]
public static RubyArray/*!*/ Repetition(IList/*!*/ self, int repeat) {
if (repeat < 0) {
throw RubyExceptions.CreateArgumentError("negative argument");
}
...
}