DEV Community

Discussion on: Returning type-safe & non-nil failure in Crystal?

Collapse
 
itr13 profile image
Mikael Klages

Well, it depends on what the user object will be used for. If you only use it for displaying values then it should be fine.

If there's a chance the caller will be comparing a field to another, there may be unexpected behaviour if they don't check the error.

If the user plans on changing the object them storing it somewhere, then they may end up with lots of near-empty fields.

I must admit I haven't tried crystal, and I don't know the extent of what you're making, so I'm just listing issues that may occur with stuff that seems similar :-P