Replies: 9 comments 10 replies
-
|
Hello @mtdowling, it is great that you created this thread although if we want to discuss each thing in detail it could become a bit unwieldy. Responding to your points one by one:
I agree with you 100%. I discussed this with @hishamhm at last FOSDEM. Given that Teal and LuaRocks have the same author I think there should just be first class support for Teal packages in LuaRocks.
It probably depends on the project a bit. In general I think the
Once LuaRocks has proper Teal support I think this should be dealt with at LuaRocks-level, i.e. if a user installs a Lua package in a Teal project and that package does not provide its own .d.tl files, it should have the option to fallback to teal-types.
Same here, I think I don't use Busted for my projects, I have my own test helper that I have converted to Teal, but I agree Busted should be the default.
Not real opinion, I used LDoc a lot with Lua and even contributed to it a bit (I am still a maintainer technically). With typed languages I rely on docstrings a lot less (same in Python by the way) so I do not use a documentation generator anymore.
You may have noticed from my responses earlier but my feeling is most of those features should become part of LuaRocks rather than Cyan. I think it is important to have good tooling (package manager, linter, etc) that is "centralized", similar to what Astral is doing in the Python world. I love Astral tools as a user but something I do not like that the tools are written in Rust. I think most of the performance gains could be kept with a Python codebase (and maybe a few modules in a lower-level language). The DX is super important though, especially that it is distributed as a single binary. In Lua, I would like the centerpiece of that tooling to be LuaRocks. If it does not gain features like this people will keep launching other projects etc, you may have seen this recently which is in Rust and very reminiscent of Astral. I would prefer we do not go this route and provide a good DX for Lua and especially Teal in LuaRocks while we can. |
Beta Was this translation helpful? Give feedback.
-
|
Hello @mtdowling
I'm happy to read it's working for you! Busted-tl was some kind of experimentation to write tests with teal directly, as opposed to running busted with the Lua generated files. To allow a better experience, we need to solve issues #532. As long as we can't redefine the standard library with Teal, luassert type definitions are useless. It means only the basic
While it could work, I don't think tests/busted should be managed by Cyan. It seems out of scope to me. The way forward should be to submit the loader I wrote to busted directly. But I was seeking more tests and feedback before going to upstream. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @mtdowling ! All of these points are super valid! I think I'll reply to each point on a separate post to make threading easier (also for others to jump in)
Oh, it doesn't? I think I thought that by pulling in But I think what everyone wants is first-class Teal support in LuaRocks (as per @catwell's comment). I refrained myself from adding it at first precisely because I'm the maintainer of both (and there are other languages out there which compile to .lua) but I think at this point no one would complain. The LuaRocks repo is very much "in flux" right now so I'm not sure if we'll get a major release adding features very soon, so I guess getting |
Beta Was this translation helpful? Give feedback.
-
This was something I did early on as a "bootstrap" measure since nobody had Teal-aware environments in their Lua projects in the beginning. Ultimately that's something that's up to each project to decide so we can move way from that if we feel it's time. I guess point 2 depends on point 1, as in, how easy it is to get runnable .lua modules out of your .tl files. For the Teal compiler itself, to avoid chicken-and-egg situations, I think I still want to ship a |
Beta Was this translation helpful? Give feedback.
-
Yes. The boundary gets a bit confusing between Cyan and LuaRocks there, and I remember discussing this with @euclidianAce in some issue in the past. Even if LuaRocks handles the dependency tracking / file management side of this, Cyan will need to be aware of it. My personal idealized view of this is that I'd like to see As a first step, we could make Another technical problem related to teal-types is that the repo itself does not account for versioning. (Mea culpa: I set it up this way, for simplicity, and based on the design of other similar repos such as the ones for Python and TypeScript.) I think this could be fixed if it becomes a practical problem (nobody ever complained about versioning mismatches between libraries in the LR tree and teal-types definitions), but I thought I'd raise it here as a known thing. |
Beta Was this translation helpful? Give feedback.
-
LuaRocks almost-sorta-kinda can do that if you make a very custom configuration file that flattens the output deployment tree as much as possible (see the |
Beta Was this translation helpful? Give feedback.
-
There is currently a Google Summer of Code project open for that. I'm not sure if we'll have a student working on it this summer, but if we do we might end up getting this tool! |
Beta Was this translation helpful? Give feedback.
-
|
@mtdowling btw, a quick heads up: I emailed you earlier this week (pinging here in case my email fell in the spam folder) |
Beta Was this translation helpful? Give feedback.
-
|
A Teal formatter is essential. Please create it :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Teal has a ton of potential to become the TypeScript of Lua, but there are a few developer experience gaps that I think are currently holding it back. I'll raise a few here, but feel free to raise other ideas too. Please let me know if I'm just not aware of a solution for things I'm listing too.
1. It's unclear the best way to package and distribute Teal
I've raised this previously, and I think it's still a bit of a rough edge. We definitely do want our .tl files in rocks so that developers using our libraries get autocomplete and type checking.
I've published a few Teal/Lua packages to LuaRocks now, but it's tedious to have to maintain rockspecs where you need to write out each .lua file and then each .tl file manually. Sure, it's no big deal when you have a single file package, but it balloons for multi-module packages.
Ideally there could be a plugin to LuaRocks to manage all this automatically and also include Teal files in the rock for those that use Teal and want autocomplete. luarocks-build-cyan exists, but doesn't do include Teal, and I'm not sure if it's usable at the moment. Maybe this is the solution, and the project just needs some help finishing it up? If so, any notes on the vision and what it should do would be great.
2. I don't think the norm should be to commit generated .lua files to repos
The standard practice at the moment for Teal repositories seems to be to commit both the .tl files and .lua files into VCS. However, I think we should find a way to not have to do this because:
3. Providing a pure Lua version of a Teal library
So, if we don't commit .lua files into Teal repos, then we need to figure out how we can easily provide a pure .lua solution for developers that don't use Teal. With LuaRocks, this doesn't really matter since the rock could contain the .tl and .lua files. However, many Lua developers, particularly those that work with game engines like Love2D, just want to copy and paste Lua code into their projects.
For my own projects, I was thinking I could maybe make a GitHub release that has a few zip files, one of which is the Lua version of the library. Installation would be as simple as downloading and unzipping. This would be automated on every release. I'm sure some kind of open source tool could be made to share the code too.
Alternatively, maybe there's a way to have LuaRocks somehow manage this and put the generated files in a specific directory, and it would just a matter of documentating how to get the Lua code.
I'm just totally making this up and inventing the idea of "variants" and specifying a custom local dir, but:
4. We need a way to integrate teal-types with build tools
We need a solution for how libraries and applications can rely on types from teal-types and similar repos (see this related issue).
LuaCATS has a similar types repo, and you can pull in specific parts of it using an addon manager of their VS code plugin. The addon manager seems to modify VS Code's settings.json to tell their LSP about library types.
For Teal, I wonder if we could:
5. Testing Teal libraries needs some work
Writing tests for a library that uses Teal still has some papercuts. Some libraries are simply just writing tests in Lua. But if we're writing Teal libraries, the ideal experience is to write tests in Teal.
busted-tl works pretty well, but it hasn't shipped a stable release yet. This means you can't install it using normal luarocks commands and need to install it as a one-off using the CLI.
To get it to work, you have to manually run this in a Makefile or something similar.
(let me know if there's some trick I can use in my rockspec to make this work).
Given how ubiquitous busted it for testing, maybe if Cyan were able to run tests for a package, it automatically wires up
busted-tl?6. We need a documentation generator
Lua has ldoc. Ldoc is great for Lua code, but teaching it how to generate docs for Teal might be stretching it too far. I opened an issue to see if anyone else has looked at Teal support.
It looks like Luau has a few dedicated documentation generators.
LuaCATs has documentation generation built into their LSP plugin.
Just like how TypeScript has dedicated documentation generators separate from JavaScript, we need something for Teal too.
7. We need to beef up Cyan
Cyan can handle compiling a Teal project, but I still find myself needing to use Makefiles to manage tasks that Cyan doesn't handle yet. Things like installing LuaRocks dependencies, running tests, making a new rock, etc. I've opened a few issues on the repo for these already, just mentioning them for completeness.
8. Other stuff
I'm sure there's a bunch of other stuff to talk about (e.g., we need a code formatter, would be nice to have the ability to add custom linters to the compiler, etc), but I'll stop here :)
Beta Was this translation helpful? Give feedback.
All reactions