Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Feature request: Anonymous functions #69

@tealeg

Description

@tealeg

Commit: f2107d4

Currently, one must always name a function when defining it, but in the case where we wish to return a function from within a function (or otherwise utilse first class functions) this is inelegant.

Consider the following definition (which will get through codegen, but won't compile - see #68 )

fun areaOfCircle(pie: f64) -> fun(f64) -> f64 {
  fun f(r: f64) -> f64 {
    return pie * (r * r)
  }
  return f
}

Ideally it would look like this:

fun areaOfCircle(pie: f64) -> fun(f64) -> f64 {
  return fun (r: f64) -> f64 {
    return pie * (r * r)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions