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 parity with TypeScript? #62

Open
orthoxerox opened this issue May 18, 2015 · 12 comments
Open

Feature parity with TypeScript? #62

orthoxerox opened this issue May 18, 2015 · 12 comments

Comments

@orthoxerox
Copy link

What does TypeScript bring to JavaScript's table that Typed Lua doesn't to Lua's?

  • Tuple types, which are array-like tables with individually-typed members. Do we need them in Lua? We can already return multiple values without any tuples, and for less ephemeral groupings records are more suitable.
  • Generics. This is a big change in the typing system, but I think it might be worth it.
  • Classes. No, everyone rolls their own object system, and I don't think Roberto wants to be a benevolent dictator preferring one to the other.
  • Modules. Maybe? @hishamhm's guidelines sounds sensible, but again there's too much anarchy.
  • Decorators. Too tightly tied to the object model.

Does this leave only generics to be implemented?

@andremm
Copy link
Owner

andremm commented May 22, 2015

Does this leave only generics to be implemented?

Certainly generics is a top priority to be implemented in Typed Lua, but I do not totally exclude the idea of creating specific class and module systems for Typed Lua in the future.

@mascarenhas
Copy link
Collaborator

We listed the class system as a Google Summer of Code project for 2016, and if there are no takers it is certainly something that we are interested in doing ourselves. Having a class system will make implementing generics much easier: a big problem with the current way of defining classes would be inferring generic types for classes.

@mascarenhas
Copy link
Collaborator

@kevinclancy is currently doing classes and generics: https://github.com/kevinclancy/typedlua

@tommitytom
Copy link

@kevinclancy's take on a class system is pretty good! Is any of this stuff being maintained anymore? Very interested in using typed Lua classes!

@andremm
Copy link
Owner

andremm commented Jul 10, 2017

@tommitytom we are migrating to a new project. Please check out our new github link: https://github.com/titan-lang

@orthoxerox
Copy link
Author

@andremm Please consider making the new repo a standalone repo and not a fork. Forked repos have limited functionality.

@hishamhm
Copy link
Contributor

@orthoxerox Interesting! Didn't know that. What kind of limitations are they subject to?

@orthoxerox
Copy link
Author

@hishamhm well, their code cannot be searched via GitHub. I am not sure if there are other limitations, but this one is annoying enough.

@andremm
Copy link
Owner

andremm commented Aug 16, 2017

@orthoxerox we just created a new repo with Typed Lua history instead of creating a fork of it.

@tommitytom
Copy link

So it would appear 'titan-lang' is no longer an optional type system for lua, that compiles to lua, but now something that intends to compile to C? This seems like a completely different project all together! I presume you're aware of other similar projects, such as Ravi and Terra? What is the overall goal of titan?

@mascarenhas
Copy link
Collaborator

We wanted to simplify the type system of Typed Lua, and get a faster typechecker that is both easier to use and easier to add important features that are missing from the master branch, the class and generics system. But the simplifications lead to a system that, while still looking like Lua, also looks like it is relatively straightforward to generate code (the abstraction level is around the same of Go). This is letting us bring more help from Lablua onboard, as they are interested in having a "faster Lua".

We still intend to have generating plain Lua code as a valid use case, just the source language will be neither a superset nor a subset of Lua, but a sister language.

Compared to Ravi, the type system is more fully-featured, and is not just for optimizing number chrunching code. Compared to Terra, the language is higher-level, and uses the Lua garbage collector (Terra has manual memory management, and is about the same level as C).

@tommitytom
Copy link

Hmm this is interesting. I can only presume Lablua have used luajit, which is pretty damn fast.. I'm presuming the issue with luajit is the lack of support on certain platforms?
One of the reasons I am so interested in a typed lua is for interaction with the luajit ffi which offers some very interesting possiblities, especially as far as hotswapping code goes - the fact the whole luajit context can be destroyed and rebuilt in a fraction of a second is very appealing to me, and with type support it means classes can be written in lua, while all data can be persisted in C structs that don't get destroyed with the context. I built my own runtime type library for this very case (written in lua: https://github.com/tommitytom/stronger ), it even has template/generic support and spits out C structs.. but there are many corner cases that make it not very practical for use in large projects. Plus after recenty using TypeScript a lot I am serverly missing out on the joys static type analysis brings to my IDE. In any case, I hope titan will eventually be extensible enough to still allow me to pull off these tricks! I will certainly be following the project closely and hope to maybe be a contributor some day :)

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

5 participants