[erlang-questions] I think I wish I could write case Any of whatever -> _ end.
Richard O'Keefe
ok@REDACTED
Mon May 17 04:55:44 CEST 2010
On May 15, 2010, at 7:05 AM, Eric Newhuis (personal) wrote:
> Consider:
>
> X = case Any of
> very_long_pattern_or_whatever ->
> very_long_pattern_or_whatever
> end.
>
>
> I'd rather abbreviate that like this.
>
> X = case Any of
> very_long_pattern_or_whatever -> _
> end.
>
> It also seems more readable to me than:
>
> X = case Any of
> very_long_pattern_or_whatever=Y -> Y
> end.
Abusing the wild-card like that would be very confusing.
It certainly is NOT more readable than
X = case Any
of Y = very_long_pattern_or_whatever ->
Y
end
or
X = case Y = Any
of very_long_pattern_or_whatever -> Y
end
or even
Y = Any,
X = case Y
of very_long_pattern_or_whatever -> Y
end
We already have so many readable ways to do it that
we're much better off not adding an unreadable one.
More information about the erlang-questions
mailing list