<html><head><meta http-equiv="Content-Security-Policy" content="script-src 'self'; img-src * cid: data:;"></head><body style="background-color: rgb(255, 255, 255); background-image: initial; line-height: initial;"><div id="response_container_BBPPID" style="outline:none;font-size:initial;font-family:"Calibri","Slate Pro",sans-serif,"sans-serif"" dir="auto" contenteditable="false"> <div name="BB10" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">A question though, would this be equivalent to == or === matching for specific values? </div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"><br></div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">Namely does {b: 5} match with a passed in object that has {b:'5'}?</div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"><br></div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">Sebastian </div>                                                                                                                                      <div name="BB10" dir="auto" style="width: 100%; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"> <br style="display:initial"></div>                            <div id="blackberry_signature_BBPPID" name="BB10" dir="auto">     <div name="BB10" dir="auto" style="padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div> </div></div><div id="_original_msg_header_BBPPID" dir="auto">                                                                                                                                             <table width="100%" style="background-color: white; border-spacing: 0px; display: table; outline: none;" contenteditable="false"> <tbody><tr><td colspan="2" style="padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">                           <div style="border-right: none; border-bottom: none; border-left: none; border-image: initial; border-top: 1pt solid rgb(181, 196, 223); padding: 3pt 0in 0in; font-family: Tahoma, "BB Alpha Sans", "Slate Pro"; font-size: 10pt;">  <div id="from"><b>From:</b> henrik.sommerland@gmail.com</div><div id="sent"><b>Sent:</b> June 30, 2017 11:22 AM</div><div id="to"><b>To:</b> sebastian@malton.name</div><div id="cc"><b>Cc:</b> es-discuss@mozilla.org</div><div id="subject"><b>Subject:</b> Re: Pattern matching?</div></div></td></tr></tbody></table><div style="border-right: none; border-bottom: none; border-left: none; border-image: initial; border-top: 1pt solid rgb(186, 188, 209); display: block; padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div> <br> </div><!--start of _originalContent --><div name="BB10" dir="auto" style="background-image: initial; line-height: initial; outline: none;" contenteditable="false"><div dir="auto">Yes :) <div dir="auto"><br></div><div dir="auto">This is roughly what I had in mind:</div><div dir="auto"><br></div><div dir="auto">match obj with </div><div dir="auto">  {a, b : 5} -> return a + b</div><div dir="auto">  {a, c : {d, e : true}} -> return a + d</div><div dir="auto">  'rof' -> return 'lol'</div><div dir="auto"><br></div><div dir="auto">Where the first clause matches if obj has the property a and the property b that has the value 5.</div><div dir="auto">The second clause works the same but recursively.</div><div dir="auto">And the third simply checks if obj is equal to 'rof'.</div><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">Den 30 juni 2017 16:46 skrev "Sebastian Malton" <<a href="mailto:sebastian@malton.name">sebastian@malton.name</a>>:<br><blockquote class="m_-3016798789026122312quote" style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="background-color:rgb( 255 , 255 , 255 )"><div id="m_-3016798789026122312m_-5447200774817782278response_container_BBPPID" style="outline:none;font-family:'calibri' , 'slate pro' , sans-serif ," dir="auto"> <div dir="auto" style="width:100%;background-color:rgb( 255 , 255 , 255 )">Are you thinking kind of like Rust's match statement? I think that something like that would be quite a good addition.</div><div id="m_-3016798789026122312m_-5447200774817782278BB10_response_div_BBPPID" dir="auto" style="width:100%;background-color:rgb( 255 , 255 , 255 )"><br></div><div id="m_-3016798789026122312m_-5447200774817782278BB10_response_div_BBPPID" dir="auto" style="width:100%;background-color:rgb( 255 , 255 , 255 )">Sebastian </div>                                                                                                                                      <div dir="auto" style="width:100%;background-color:rgb( 255 , 255 , 255 )"> <br></div>                            <div id="m_-3016798789026122312m_-5447200774817782278blackberry_signature_BBPPID" dir="auto">     <div dir="auto" style="background-color:rgb( 255 , 255 , 255 )"></div> </div></div><div id="m_-3016798789026122312m_-5447200774817782278_original_msg_header_BBPPID" dir="auto">                                                                                                                                             <table width="100%" style="background-color:white;border-spacing:0px;display:table;outline:none"><tbody><tr><td colspan="2" style="background-color:rgb( 255 , 255 , 255 )">                           <div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb( 181 , 196 , 223 );padding:3pt 0in 0in;font-family:'tahoma' , 'bb alpha sans' , 'slate pro';font-size:10pt">  <div id="m_-3016798789026122312m_-5447200774817782278from"><b>From:</b> <a href="mailto:henrik.sommerland@gmail.com">henrik.sommerland@gmail.com</a></div><div id="m_-3016798789026122312m_-5447200774817782278sent"><b>Sent:</b> June 30, 2017 9:55 AM</div><div id="m_-3016798789026122312m_-5447200774817782278to"><b>To:</b> <a href="mailto:es-discuss@mozilla.org">es-discuss@mozilla.org</a></div><div id="m_-3016798789026122312m_-5447200774817782278subject"><b>Subject:</b> Pattern matching?</div></div></td></tr></tbody></table><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb( 186 , 188 , 209 );display:block;background-color:rgb( 255 , 255 , 255 )"></div> <br> </div><div class="m_-3016798789026122312elided-text"><div dir="auto" style="outline:none"><div dir="ltr">Why is there no support for pattern matching in JavaScript?<br>I would guess that it has been proposed before, and if so why hasn't it been included?<br><br>I have been thinking about it and I think it would integrate nicely into JavaScript.<br>If it hasn't been proposed already I would propose it, and I would gladly look into it more and try to examine what kind of semantics would be suitable.<br clear="all"><div><br>Peace!</div>-- <br><div class="m_-3016798789026122312m_-5447200774817782278gmail_signature"><div dir="ltr">Henrik "TheGrandmother" Sommerland</div></div>
</div>
</div></div></div></blockquote></div><br></div></div>
<!--end of _originalContent --></div></body></html>