<div dir="ltr"><div dir="ltr"><div dir="ltr" class="gmail_attr">On Fri, Oct 23, 2020 at 7:32 AM Björn Gustavsson <<a href="mailto:bjorn@erlang.org">bjorn@erlang.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
We have handled the addition of new keywords in the past by having an<br>
option to disable them (keeping the new keywords as atoms). That we<br>
will allow the compilation of old code that uses the keyword as an<br>
atom. (We did that when we introduced try/catch.)<br></blockquote><div> </div></div><div dir="ltr">Sounds good to me. <br></div><div dir="ltr"><br></div><div>I'd be fine speccing the addition of an 'else-style' keyword for <span style="font-family:monospace">begin ... end</span>. A funny thing to consider is that if we add '<span style="font-family:monospace">else</span>', people will be really confused about why<span style="font-family:monospace"> begin ... end</span> has it but not <span style="font-family:monospace">if ... end</span>. I figure this is out of scope for this specific RFC, but worth pointing out regardless.</div><div><br></div><div>I'll try to find slack time over the next week or two to edit EEP-49, including the quoted workaround and possibly some additional research. But to do a tl:dr;, this is heading for:</div><div><ul><li><span style="font-family:monospace">begin ... end</span> with an optional <span style="font-family:monospace">begin ... else ... end</span> variant</li><li>The "unwrap expression" is replaced by a "match or return" mechanism.<br></li><li>since there is no longer any unwrapping we can switch form <span style="font-family:monospace"><~</span> to <span style="font-family:monospace"><-</span> as an operator and keep rather familiar semantics</li><li>the <span style="font-family:monospace">else</span> keyword (or anything else that takes its place) would require compiler options that specify using it as an atom to allow compilation of older modules which do not use the construct and rely on the same keyword. <br></li></ul></div><div>I'm gonna have to look into whether this can still be safely emulated with simple case expression being shifted around or if it requires fancier a lower-level rewrite. I doubt it can be that easy to do because we have to intersperse non-conditional code in there and a goto-like mechanism could make more sense (an option would also be to use a ref with a throw/catch, but I'd rather avoid the cost of generating a ref per block of conditionals). Anyway, while I look into this, that'll give time to get more potential feedback or information from the OTP team, which Kenneth has hinted at.<br></div></div>