On 6/18/21 12:40 AM, Mathias LANG wrote:
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer wrote:
A final switch on an enum complains if you don't handle all the enum's
cases. I like this feature.
However, sometimes the data I'm switching on is coming from elsewhere
(i.e. a user
On 6/18/21 6:35 AM, Johan wrote:
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer wrote:
However, sometimes the data I'm switching on is coming from elsewhere
(i.e. a user), and while I want to enforce that the data is valid
(it's one of the enum values), I don't want to crash
On 6/17/21 5:54 PM, H. S. Teoh wrote:
On Thu, Jun 17, 2021 at 05:41:28PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[.[..]
Oh, and to throw a monkey wrench in here, the value is a string, not
an integer. So I can't use std.conv.to to verify the enum is valid
(plus, then I'm runn
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
However, sometimes the data I'm switching on is coming from
elsewhere (i.e. a user), and while I want to enforce that the
data is valid (it's one of the enum values), I don't want to
crash the program if the incoming value
On Friday, 18 June 2021 at 04:24:19 UTC, jfondren wrote:
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
A final switch on an enum complains if you don't handle all
the enum's cases. I like this feature.
...
Oh, and to throw a monkey wrench in here, the value is a
string
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
A final switch on an enum complains if you don't handle all the
enum's cases. I like this feature.
However, sometimes the data I'm switching on is coming from
elsewhere (i.e. a user), and while I want to enforce that the
d
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
A final switch on an enum complains if you don't handle all the
enum's cases. I like this feature.
...
Oh, and to throw a monkey wrench in here, the value is a
string, not an integer. So I can't use std.conv.to to verify
th
On Thursday, 17 June 2021 at 21:41:28 UTC, Steven Schveighoffer
wrote:
Any ideas on better ways to handle this?
I've had such a situation before too where I want to switch over
enums I read from an ELF file which can't be assumed to be
correct, but I also don't want to forget one. For a tight
On Thu, Jun 17, 2021 at 05:41:28PM -0400, Steven Schveighoffer via
Digitalmars-d-learn wrote:
[.[..]
> Oh, and to throw a monkey wrench in here, the value is a string, not
> an integer. So I can't use std.conv.to to verify the enum is valid
> (plus, then I'm running a switch twice).
>
> Any ideas
A final switch on an enum complains if you don't handle all the enum's
cases. I like this feature.
However, sometimes the data I'm switching on is coming from elsewhere
(i.e. a user), and while I want to enforce that the data is valid (it's
one of the enum values), I don't want to crash the pr
10 matches
Mail list logo