I think eksperimental was dead on when he said what you really want is 
`cond`.

```
cond do
val in ?a..?z
val in ?A..?Z
```

Changing `case` to have an implicit `where` in certain special cases is 
going to make it behave inconsistently compared to other places that take 
patterns. Optimizing the characters for this specific case isn't worth the 
implicit magic ImHO.

On Sunday, March 14, 2021 at 10:15:06 AM UTC-4 [email protected] 
wrote:

> I understand, how about it?
>
> case ?a do
>   in ?a..?z -> # code
>   in ?A..?Z -> # code
>   _ -> # code
> end
>
> Goiás ou Vila Nova?
>
> Em sábado, 13 de março de 2021 às 09:46:56 UTC-3, José Valim escreveu:
>
>> Thanks for the proposal,
>>
>> However, ?a..?z in a pattern should match on a range from ?a..?z. 
>> Similarly, x..y can be used to match on any range and extract its values.
>>
>> Those are all valid and correct today, and introducing this proposal 
>> would break said semantics.
>>
>> On Sat, Mar 13, 2021 at 13:44 Amos King <[email protected]> wrote:
>>
>>> Would this match on an element in a range and on an equivalent range? ?a 
>>> or ?a..?z would both match with ?a..?z
>>>
>>> The proposed code looks nice and I thought was simpler at first. 
>>> Considering it further made me think of the situation above. I want the 
>>> explicitness of the current behavior to reduce the ambiguity.
>>>
>>> Amos King
>>> CEO
>>> Binary Noggin
>>>
>>> On Mar 13, 2021, at 06:26, Igor Silva <[email protected]> wrote:
>>>
>>> Current behavior
>>>
>>>
>>>
>>> case ?a do
>>>   x when x in ?a..?z -> # code
>>>   x when x in ?A..?Z -> # code
>>>   _ -> # code
>>> end
>>>
>>> Desired behavior
>>>
>>> case ?a do
>>>   ?a..?z -> # code
>>>   ?A..?Z -> # code
>>>   _ -> # code
>>> end
>>>
>>> #GoiásouVilaNova
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/elixir-lang-core/61ea5a90-6e3b-49a0-ad58-377959dd6aabn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/elixir-lang-core/61ea5a90-6e3b-49a0-ad58-377959dd6aabn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/elixir-lang-core/F40F773D-8636-4040-826A-D75EF9C35734%40binarynoggin.com
>>>  
>>> <https://groups.google.com/d/msgid/elixir-lang-core/F40F773D-8636-4040-826A-D75EF9C35734%40binarynoggin.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/d6ede81a-c490-4892-bfb0-4e5fbe7435f5n%40googlegroups.com.

Reply via email to