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

Provide a way to invoke generic functions with explicit type arguments #426

Open
gbrgr opened this issue Jan 20, 2022 · 0 comments
Open

Comments

@gbrgr
Copy link

gbrgr commented Jan 20, 2022

Feature Request

Description of Problem:

Suppose I want to define a type that models a bijective Map like so:

Class BiMap<K, V> {
  to: Map<K, V>[1];
  from: Map<V, K>[1];
}

Now I want to provide to users a convenient constructor method that just yields an empty instance of BiMap:

function empty<K, V>(): BiMap<K, V>[1] {
  ^BiMap<K,V>(to=^Map<K,V>(), from=^Map<K,V>());
}

Such a function definition does not work for two reasons: First, PURE tries to find existing types named K and V. Second, there is no way to invoke the empty function by explicitly specifying type parameters at invocation (type parameters are always implicit via supplied function arguments).

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

No branches or pull requests

1 participant