badlogic / quack

If it looks like a duck, walks like a duck... quack!
2 stars 0 forks source link

Add function pointers & anonymous functions #1

Closed badlogic closed 9 years ago

badlogic commented 9 years ago

Declaration syntax, addition to Type() production syntax

"(" ArgumentList() ")" [: Type()]

Definition syntax

val f = "(" ArgumentList() ")" [: Type()] "->" "{" StatementList() "}"

Define semantics.

badlogic commented 9 years ago

Scala maps functioms to classes with a single apply method and one parametric type per argument plus one for the return type. That's quite interesting!

badlogic commented 9 years ago

Also see http://stackoverflow.com/a/9738862