On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote:
The case when there isn't a value should be handled explicitly,
not implicitly. Propogating a None value
isn't useful
Except when it is useful, and shouldn't be handled explicitly. I
have code in D, C and C++ that looks like this:
On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote:
I feel as though that's it's greatest weakness. It makes the
check whether there is or isn't a value hidden. The case when
there isn't a value should be handled explicitly, not
implicitly. Propogating a None value isn't useful and is
On Saturday, 29 February 2020 at 15:23:02 UTC, Sebastiaan Koppe
wrote:
Like I said, I don't use optionals when I care about errors.
That is not what they are designed for.
If I want to type-guard potential errors I will use SumType!(T,
Error). It forces you to handle both cases, either at
On Saturday, 29 February 2020 at 13:40:11 UTC, Adnan wrote:
On Saturday, 29 February 2020 at 13:03:21 UTC, Sebastiaan Koppe
wrote:
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
* Option!T from the optional package: Has even worse problem
IMO. Not only it allows None + int but
On Saturday, 29 February 2020 at 13:40:11 UTC, Adnan wrote:
On Saturday, 29 February 2020 at 13:03:21 UTC, Sebastiaan Koppe
wrote:
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
* Option!T from the optional package: Has even worse problem
IMO. Not only it allows None + int but
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
I have a struct that has to arrays. Each of those must have the
same sizes.
So while constructing the array, if you pass two arrays of
different sizes the constructor must return nothing.
In Rust I could easily use Option. D has no
On Saturday, 29 February 2020 at 13:03:21 UTC, Sebastiaan Koppe
wrote:
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
* Option!T from the optional package: Has even worse problem
IMO. Not only it allows None + int but also it returns a `[]`.
This API is not to my liking. You could
On Saturday, 29 February 2020 at 12:50:59 UTC, Adnan wrote:
* Option!T from the optional package: Has even worse problem
IMO. Not only it allows None + int but also it returns a `[]`.
This API is not to my liking. You could say well Haskell has
fmap for Optional etc, and I am aware of that, so
I have a struct that has to arrays. Each of those must have the
same sizes.
So while constructing the array, if you pass two arrays of
different sizes the constructor must return nothing.
In Rust I could easily use Option. D has no answer to Optional
types as far as I am concerned. Is