adobe / ferrum

Features from the rust language in javascript: Provides Traits/Type classes & a hashing infrastructure and an advanced library for working with sequences/iterators in js
https://www.ferrumjs.org
Apache License 2.0
515 stars 24 forks source link

Provide documentation in readme for standard traits #22

Open koraa opened 5 years ago

Sweta271097 commented 4 years ago

@koraa Can I know more about this issue?

koraa commented 4 years ago

Sure, feel free to take it! Thanks for taking interest in this project!

Ferrum provides a few standard traits in the stdtraits.js file; most notably eq for content based comparisons. Most languages provide such a trait as an overloadable part of their standard lib (.equals in Java, eq in python, operator ==() in C++…similar traits exist in rust & haskell). Js provides === (value based comparison) and libraries like lodash provide content based comparison for a limited number of types (meaning it may not work for custom types).

The eq trait in ferrum is extensible for custom traits.

A short introduction to the standard traits provided by this lib and an explanation why a trait/overloadable approach is superior should be added to the readme.