Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST changes for function and type bindings #117

Open
j14159 opened this issue Jan 30, 2017 · 0 comments
Open

AST changes for function and type bindings #117

j14159 opened this issue Jan 30, 2017 · 0 comments

Comments

@j14159
Copy link
Collaborator

j14159 commented Jan 30, 2017

@danabr raised a point about type definitions vs types themselves in PR #116 , e.g.

type opt 'a = Some 'a | None
type int_opt = opt int

The name in the left-hand side of each of these could be viewed in a similar manner as function names in let bindings, that is, independent of their variables and members/bodies whereas opt int is a concrete type. Similarly as raised by @ypaq and others elsewhere:

let f x = x + x

could be viewed as syntactic sugar for

let f = fun x -> x + x

or something to that effect.

We might then add an alpaca_type_def node that binds variables and members to a type name while a member of a type binding stays as an alpaca_type AST node since it is in fact a concrete type. Functions then might be decomposed into two things as well:

  • an alpaca_fun node that lists function versions, each of which has their associated variables and bodies.
  • alpaca_fun_def that binds a name and arity (the latter for convenience) to a single alpaca_fun AST node.

This should make lambdas fairly simple to implement and makes types, functions, and values all operate in a similar manner.

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant