Rust already does this by default, I think. Compilation unit A can define a trait and implement it on a struct from compilation unit B.
EDIT: Is ‘refinements’ a term chosen by the ruby developers? When I came up with something similar myself I called them ‘overlays’. It would be nice to know how to find more resources about this concept.
They were added as an experimental feature in Ruby 2.0 (released in February 2013), saw a few changes in 2.1, and the documentation dropped its note about experimental-ness in 2.2. The current ruby release’s documentation on refinements is here: http://ruby-doc.org/core-2.2.3/doc/syntax/refinements_rdoc.html
“Overlays” may be a better term, given that “refinements” already has several definitions in computing, including “refinement types,” which are types endowed with a predicate that holds for all their inhabitants.
Rust already does this by default, I think. Compilation unit A can define a trait and implement it on a struct from compilation unit B.
EDIT: Is ‘refinements’ a term chosen by the ruby developers? When I came up with something similar myself I called them ‘overlays’. It would be nice to know how to find more resources about this concept.
They were added as an experimental feature in Ruby 2.0 (released in February 2013), saw a few changes in 2.1, and the documentation dropped its note about experimental-ness in 2.2. The current ruby release’s documentation on refinements is here: http://ruby-doc.org/core-2.2.3/doc/syntax/refinements_rdoc.html
“Overlays” may be a better term, given that “refinements” already has several definitions in computing, including “refinement types,” which are types endowed with a predicate that holds for all their inhabitants.