FenderLang / Fender

A functional scripting language, intended for string manipulation and general scripting on the command line
MIT License
13 stars 0 forks source link

Create type match macro #88

Closed boxbeam closed 1 year ago

boxbeam commented 1 year ago

Type match macro is used like this:

type_match!(a, b {
  (List(a), List(b)) => Ok(FenderValue::Int(0).into()),
  (Int(a), Int(b)) => Ok(FenderValue::Int(a + b).into())
});

It will work like a normal match statement for the listed branches, and also generates a nice informative error message for invalid argument types image