Comments (7)
Just my 2ยข: I think bundling should be handled by a separate utility.
Mapping .tl
files one-to-one onto .lua
files fits the textbook definition of a compiler and seems to align well with the Unix philosophy.
Bundling doesn't particularly sound like something that needs to be integrated into the compiler, or really even something that needs to be Teal-exclusive.
I think the use case is valid, but perhaps that use case could be addressed by a separate utility under the teal-language
family: that way the compiler can be kept minimal.
from tl.
This can be achieved using luapak merge.
from tl.
I have recently added 3rd-party plugin support to a tool of mine that can bundle multiple Lua modules into one Lua file. Apparently, those plugins can also be used to transpile files in a Lua dialect on-the-fly during amalgamation. As a proof-of-concept, I have added plugins for moonscript, fennel, and teal.
AFAICS, a similar approach could be used with luapak -- maybe even with the same plugins.
Regarding stable API: I've only used tl.gen()
, its result.syntax_errors
return value, and the fields of the individual syntax errors (see here).
from tl.
I think it would be nice if we could use a command-line argument to bundle multiple tl scripts as a single Lua file. TypeScript supports this by using the --outFile argument.
That would be a cool feature, but would probably accelerate to the desire of some sort of source maps, because the line numbers in the tracebacks when running tl code would not match the input anymore (so this is a feature request that triggers another feature request :) ). Still, a patch would be welcome!
If this feature gets implemented, then tl's source code could be split into multiple files. This would probably make the code a bit easier to browse.
I'm still a bit on the fence for that tbh, but it's a thought to consider for sure!
from tl.
@jirutka would love to see luapak eventually convert .tl files to .lua in that same step! :) Do you think os.execute
to run tl gen
would suffice or would a stable programmatic API would make more sense?
from tl.
A stable programmatic API would be better. :)
from tl.
Regarding stable API: I've only used tl.gen(), its result.syntax_errors return value, and the fields of the individual syntax errors (see here).
@siffiejoe that should be fine!
from tl.
Related Issues (20)
- Type guard doesn't work properly with unions HOT 2
- Allow indexing (disable type checking) on `any` HOT 5
- How to debug teal code? HOT 1
- Using reserved keyword in record field HOT 4
- [next branch] Total annotation asks for functions too HOT 5
- [next branch] `where` conflicts with `<total>` HOT 3
- No errors reported when assigning value directly to a record table
- Function does not enforce argument record type if variable type is inferred
- Type alias for nested generic crashes compiler HOT 1
- [next] `self` cannot be constrained by an interface
- [next] interface methods
- Possible Typechecking Failure on Union Return HOT 2
- unexpected propagation of <const> attribute HOT 1
- missing narrowing type when not simple expression
- Inconsistencies between string escapes in Lua versions are not handled by Teal
- Feature request: Ability to rename the compiled files using regex HOT 2
- weird shadowing behavior regarding generic type names HOT 2
- reexport a nested table type HOT 1
- How do i solve this error? : argument 2: got type constant (alias), expected constant HOT 2
- flow-typing of return types at odds with polymorphic functions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tl.