3 ms·
I don't use this but you could argue that it's useful to have a standard encapsulation of failure/missing that isn't null? Where some situation means that null
by zimablue 9y ago
I don't use this but you could argue that it's useful to have a standard encapsulation of failure/missing that isn't null? Where some situation means that null already has a meaning, the alternative is to create a wrapper class for your situation (not general), or a general wrapper class which is basically what this is. So it's not completely useless whilst kind of crippled by no pattern matching?
Edit: although I guess that just using a tuple would be better for this maybe
- catnaroek 9y ago> I don't use this but you could argue that it's useful to have a standard encapsulation of failure/missing that isn't null? I don't see what encapsulation you're talking about. Maybe and Either are very much concrete, not abstract, data types. > Where some situation means that null already has a meaning, the alternative is to create a wrapper class for your situation (not general), or a general wrapper class which is basically what this is. Unless you want to take advantage of existing plumbing infrastructure such as a monad transformer library, custom wrapper classes for your particular situation are precisely the right tool for the job.