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

Feature request: first-class labels for extensible rows / koka #2509

Closed
ziriax opened this issue Mar 26, 2015 · 4 comments
Closed

Feature request: first-class labels for extensible rows / koka #2509

ziriax opened this issue Mar 26, 2015 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@ziriax
Copy link

ziriax commented Mar 26, 2015

It would be very nice have real extensible row polymorphism in Typescript, that also works with generics.

So having type constructions that allow adding and removing 'keys' aka labels.

I tried adding labels using interfaces, but that does not work, since you cannot extend from a generic type?

interface IWithName<T> extends T {
   name: string
}

See Microsoft's research language Koka and also this old paper, both from Daan Leijen

@sophiajt
Copy link
Contributor

I'm a fan of row polymorphism. I actually tried to get this in about six months ago.

Unfortunately, this would mean the type checker would always have to delay type checking interface bodies, and instead stamp them out individually and check them at each unique instantiation. This is pretty inefficient. Separate type checking, where you can reason about the body of the interface separate from its eventual instantiation, is much preferred.

@ziriax
Copy link
Author

ziriax commented Mar 26, 2015

Thanks for the fast reply.

That's too bad, since "runtime row polymorphism" happens a lot in Javascript (by its dynamic nature), and we currently can't model that generically in Typescript IMO.

@danquirk
Copy link
Member

We have this logged already somewhere but I need to find it before I close this as a dupe.

@danquirk
Copy link
Member

#2225

@danquirk danquirk added the Duplicate An existing issue was already created label Mar 27, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants