[erlang-questions] Guards syntax for multiple values

Eckard Brauer eckard.brauer@REDACTED
Tue Mar 26 19:24:42 CET 2019


Am Tue, 26 Mar 2019 11:15:28 -0400
schrieb Fred Hebert <mononcqc@REDACTED>:

> On Tue, Mar 26, 2019 at 10:51 AM Florent Gallaire
> <fgallaire@REDACTED> wrote:
> 
> > It's also a good opportunity to make Erlang more modern with a sexy
> > syntactic sugar...
> >
> >
> 
> this should be done very carefully. For example, adding the 'in'
> keyword for 'X in [A,B,C]' syntax will break all existing code out
> there that uses the word 'in' for a function, including the
> `queue:in/2` function call in the standard library. That could ripple
> into inconsiderate breakage in the whole ecosystem.

I don't really prefer lists_member/2 or is_member/2 over 'X in [A,B,C]'
or the other way, but could you please enlight me (rather erlang
beginner) about where/why this would break existing code? If we talk
about a list as the second/right side arg of 'in', I could think of
either having an opening bracket '[' or a variable bound to that list
("when X in List") after the keyword when to be used as a guard, or of
'(' when to be used as the abovementioned function call. So for me,
that looks rather simple, but as already written, I'd like to further
improve knowledge.

Thanks in advance
Eckard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190326/85e612c8/attachment.bin>


More information about the erlang-questions mailing list