简体   繁体   中英

Scala match syntax: What is the block like structure

What is the structure delineated by curly brackets in a pattern match expression. It seems to be neither a Block nor a Template.

Reflecting a bit on the question,

http://www.scala-lang.org/api/2.11.1/scala-reflect/#scala.reflect.api.Trees$MatchExtractor

the API also just calls them "cases".

The spec doesn't have a special name for it:

http://www.scala-lang.org/files/archive/spec/2.11/08-pattern-matching.html#pattern-matching-expressions

Maybe there is a more theoretical name for the patterns against which a match is performed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM