Skip to content

re: Flexible Ruby Value Object Initialisation VIEW POST

re: I am saying refinements depend on the type. 3 types in your example were explicitly checked and extended with some functionality. Other types, no m...

Refinements depend on the type

Everything in some way depends on the type, because the type defines the messages that can be received and the responses. That is not type checking, though, that is just code.

Other types, no matter whether they respond to / implement this functionality are rejected

If they respond to the correct message then they are not rejected by my ISBN class, because my ISBN class is not type checking. The refinements are just a way of adding the required responses that is safer than monkey patching, but ultimately they just define behaviour.

I would be keen on hearing other opinions, though.

code of conduct - report abuse