Skip to content

Add explicit polymorphism #225

@SebastianMestre

Description

@SebastianMestre

Right now, there is no way to explicitly mark anything as polymorphic. There really should be.

I was thinking it could look like this (I made up the syntax for function types. see #226):

first : newvar(a){ (a, a) => a } = fn(x, y) => x;

this should also work.

first := newvar(a){ fn(x : a, y : a) => x };

and some sugar to make it nicer:

first := fn<:a:>(x : a, y : a) => x;

Functionally, newvar expressions would function as a scoped declaration, and evaluate to what's between the braces.

Actually, they wouldn't quite be expressions, because they can appear in type terms. They are more like 'meta expressions', which would be evaluated during ct_eval, I suppose.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions