so, is there any plan to do fancy structural decom...
# language-proposals
g
so, is there any plan to do fancy structural decomposition a le scala or is the reciever type and
with
satisfactory? scalas example:
Copy code
def printTerm(term: Term) {
    term match {
      case Var(n) =>
        print(n)
      case Fun(x, b) =>
        print("^" + x + ".")
        printTerm(b)
      case App(f, v) =>
        print("(")
        printTerm(f)
        print(" ")
        printTerm(v)
        print(")")
becomes
Copy code
fun printTerm(term: Term) {
    match(term) {
      is Var -> with(term){
        print(n)
      }
      is Fun -> with(term){
        print("^" + x + ".")
        printTerm(b)
      }
      case App -> with(term){
        print("(")
        printTerm(f)
        print(" ")
        printTerm(v)
        print(")")
      }
1