I am wondering that whether the current draft have something similar to Scala's extractors, which could be used in pattern matching.
For example, this pattern:
Email(username, host) = ooxx
is defined as
{ let results = Email.unapply(ooxx, 2) if(results !== undefined) [username, host] = results else throw new MisMatchError }
I am wondering that whether the current draft have something similar to Scala's extractors, which could be used in pattern matching.
For example, this pattern:
Email(username, host) = ooxx
is defined as
{ let results = Email.unapply(ooxx, 2) if(results !== undefined) [username, host] = results else throw new MisMatchError }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130725/4421185c/attachment.html>
I am wondering that whether the current draft have something similar to Scala's extractors, which could be used in pattern matching. For example, this pattern: Email(username, host) = ooxx is defined as { let results = Email.unapply(ooxx, 2) if(results !== undefined) [username, host] = results else throw new MisMatchError }