jamiebuilds / ghost-lang

:ghost: A friendly little language for you and me.
302 stars 10 forks source link

Match against a variable / Operators in match blocks #3

Closed aleclarson closed 6 years ago

aleclarson commented 6 years ago

Thoughts on other operators in match blocks?

let foo = null
let result = match (value) {
  == foo { foo }
  > 0 { 0 }
  is true { 'true' }
  is false { 'false' }
  else { 'other' }
}
jamiebuilds commented 6 years ago

I would not put other tokens there no. Pattern matching is meant to create highly optimized code based on static types