# Re: digest.so implemented

**URL:** <https://www.ruby-forum.com/t/re-digest-so-implemented/132803>\
**Category:** IronRuby\
**Created:** [March 24, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/re-digest-so-implemented/132803 "2008-03-24T21:15:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [March 24, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/re-digest-so-implemented/132803/1 "2008-03-24T21:15:31Z")

</div>

Wayne K.:

> Attached is an implementation of the methods and classes from external

> library digest.so that are used by some simple Rails use cases.

Thanks for the contribution! Sorry for such a long delay. It required  
some additional work on our side and we also had some issues with TFS to  
SVN sync tool. John fixed that last week, so your contribution have  
finally been checked-in.

I’ve reviewed the code. While this feedback is specific to your  
contribution, this is general advice that other contributors should  
follow as well.

Check out the latest code in SVN - all my suggestions are reflected  
there.

1. Coding conventions:

2. 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.

1. You don’t need to declare Call\_Foo methods in order to invoke a  
dynamic site unless the invocation is somehow more complex (involves  
some conversions etc.)

2. 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");

 }

 ...

```

}

Thanks,

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [March 24, 2008, 9:49pm UTC](https://www.ruby-forum.com/t/re-digest-so-implemented/132803/2 "2008-03-24T21:49:44Z")

</div>

This was just dying out for a wiki page:  
[http://ironruby.rubyforge.org/wiki/wiki.pl?ContributionGuidelines](http://ironruby.rubyforge.org/wiki/wiki.pl?ContributionGuidelines)

Pete

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tomas M.  
Sent: Monday,24 March 24, 2008 20:14  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] digest.so implemented

Wayne K.:

> Attached is an implementation of the methods and classes from external

> library digest.so that are used by some simple Rails use cases.

Thanks for the contribution! Sorry for such a long delay. It required  
some  
additional work on our side and we also had some issues with TFS to SVN  
sync  
tool. John fixed that last week, so your contribution have finally been  
checked-in.

I’ve reviewed the code. While this feedback is specific to your  
contribution, this is general advice that other contributors should  
follow  
as well.

Check out the latest code in SVN - all my suggestions are reflected  
there.

1. Coding conventions:

2. 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.

1. You don’t need to declare Call\_Foo methods in order to invoke a  
dynamic  
site unless the invocation is somehow more complex (involves some  
conversions etc.)

2. 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");

 }

 ...

```

}

Thanks,

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [March 24, 2008, 9:54pm UTC](https://www.ruby-forum.com/t/re-digest-so-implemented/132803/3 "2008-03-24T21:54:35Z")

</div>

Or crying out, even!

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Tomas M.  
Sent: Monday,24 March 24, 2008 20:14  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] digest.so implemented

Wayne K.:

> Attached is an implementation of the methods and classes from external

> library digest.so that are used by some simple Rails use cases.

Thanks for the contribution! Sorry for such a long delay. It required  
some  
additional work on our side and we also had some issues with TFS to SVN  
sync  
tool. John fixed that last week, so your contribution have finally been  
checked-in.

I’ve reviewed the code. While this feedback is specific to your  
contribution, this is general advice that other contributors should  
follow  
as well.

Check out the latest code in SVN - all my suggestions are reflected  
there.

1. Coding conventions:

2. 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.

1. You don’t need to declare Call\_Foo methods in order to invoke a  
dynamic  
site unless the invocation is somehow more complex (involves some  
conversions etc.)

2. 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");

 }

 ...

```

}

Thanks,

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [March 24, 2008, 11:03pm UTC](https://www.ruby-forum.com/t/re-digest-so-implemented/132803/4 "2008-03-24T23:03:36Z")

</div>

Thanks!  
-John
