higgsjs / Higgs

Higgs JavaScript Virtual Machine
875 stars 62 forks source link

Add Array.of method #198

Closed pselle closed 9 years ago

pselle commented 9 years ago

Referencing #179, adds Array.of method

This is my first PR to this project, so please let me know how to improve this! This adds the Array.of method and a test for it where it appeared to make sense to do so.

maximecb commented 9 years ago

Thanks for contributing :)

In terms of improvements, I would suggest testing corner cases like calling the method with zero or one element.

Also, we're going away from

    if(!array_eq(Array.of(2,3), [2,3]))
        return 1;

In favor of:

assert (array_eq(Array.of(2,3), [2,3]))

The return codes date back to a time where Higgs didn't yet have support for exceptions.

pselle commented 9 years ago

Thanks for the feedback! Updated.

maximecb commented 9 years ago

Merged. Sorry for not responding faster, I'm at ECOOP and it's taking most of my time! Thanks for contributing :)

pselle commented 9 years ago

YAYY No worries, thanks for checking it out! :tada: