[erlang-questions] I think I wish I could write case Any of whatever -> _ end.

Robert Virding rvirding@REDACTED
Fri May 14 22:11:20 CEST 2010


The trouble with this is that _ already has a very specific meaning,
it s the don't care variable. It will always match anything and never
be bound and it is used as a place holder when you know there is
something there but you don't care what it is. Using it in a context
where it gets a value would cause much confusion and lead to funny
inconsistent cases.

Robert

On 14 May 2010 21:05, Eric Newhuis (personal) <enewhuis@REDACTED> 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.
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list