Code Monkey home page Code Monkey logo

Comments (7)

ashn-dot-dev avatar ashn-dot-dev commented on August 17, 2024 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.

jirutka avatar jirutka commented on August 17, 2024 2

This can be achieved using luapak merge.

from tl.

siffiejoe avatar siffiejoe commented on August 17, 2024 2

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.

hishamhm avatar hishamhm commented on August 17, 2024

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.

hishamhm avatar hishamhm commented on August 17, 2024

@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.

jirutka avatar jirutka commented on August 17, 2024

A stable programmatic API would be better. :)

from tl.

hishamhm avatar hishamhm commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.