Giter Site home page Giter Site logo

Comments (14)

bakpakin avatar bakpakin commented on May 11, 2024 9

As of 3b6ff3c, Janet can now precompile modules into images via the -c flag.

For example:

$ build/janet -c examples/colors.janet clrs.jimage
$ build/janet
janet:0:> (import clrs)
nil
janet:14:> (print (clrs/color :green "hello"))
hello # but in green
nil
janet:50:>

Or after building the image:

$ build/janet -l clrs -e '(print (color :green "hello"))'

This doesn't yet link the module to the janet binary to form a single executable file, but that should be possible

from janet.

bakpakin avatar bakpakin commented on May 11, 2024 6

Currently, the best way is a source distribution.

However, I have been working on packaging code into blobs that can be loaded without parsing and compiling. The core library is actually loaded this way. I plan on adding a way to both load binary blobs (images) as modules, and also execute an image. Images are just Janet data structures marshalled with the marshal function.

from janet.

bakpakin avatar bakpakin commented on May 11, 2024 4

We have been working on the jpm tool for building, and hopefully eventually managing dependencies, distributing software, and several other developer facing tasks. As of now, jpm install in a directory with a project.janet file can be used to add scripts to some PATH (see mendoza's project.janet for a simple example). jpm will be Janet's main build tool and language-level package manager.

from janet.

andrewchambers avatar andrewchambers commented on May 11, 2024 3

I think a git repository that is something like 'janet-lang/pkgs' which just contains janet tables of urls and cryptographic hashes might be nice. Sort of like a registry of import paths.

Walking those tables could emit package definitions for many different operating systems, or be used to build directly.

from janet.

bakpakin avatar bakpakin commented on May 11, 2024 2

I think a git repository that is something like 'janet-lang/pkgs' which just contains janet tables of urls and cryptographic hashes might be nice. Sort of like a registry of import paths.

We could definitely set something up like that, its probably a good first step towards a package ecosystem. I think each entry should contain links to source by default or janet images, as these are cross platform, as well as lots of metadata.

For packaging native code, I'm still unsure of the best way to do it that's easy and portable. The cook.janet scripts in some of the modules like JSON work very well for small, self contained projects, but are certainly a leaky abstraction for cross platform libraries that actually need to link to system specific libraries (libuv comes to mind).

from janet.

bakpakin avatar bakpakin commented on May 11, 2024

BTW, these images could likely be portable across OSs.

from janet.

ryukinix avatar ryukinix commented on May 11, 2024

WOW! This indeed is a nice feature! I'll be watching the janet development :)

from janet.

ryukinix avatar ryukinix commented on May 11, 2024

Nice improvement! I'll test it later. Good work!

from janet.

sepisoad avatar sepisoad commented on May 11, 2024

keep up the good work

from janet.

ryukinix avatar ryukinix commented on May 11, 2024

Congratulations for this awesome work, @bakpakin. I see a nice future for janet and it's great to see this level of care about software distribution, where so many languages failed miserably.

from janet.

sleepyfox avatar sleepyfox commented on May 11, 2024

Please don't go down the path of npm (central package hosting), but instead normalise linking to independent github/gitlab/... repos for packages. Thanks. Keep up the good work!.

from janet.

bakpakin avatar bakpakin commented on May 11, 2024

So jpm actually has a lot of these features already, including installing dependencies from git urls, and building executables! jpm will never do anything centralized because it’s way more work for me and for people who want to create packages. I am going to push a documentation page to Janet-Lang.org soon, but all of this functionality is in the latest master and will be in 1.2.0. installing git dependencies requires having git installed, and building an executable requires a c compiler, but should both work on most supported systems including windows.

Sent with GitHawk

from janet.

sleepyfox avatar sleepyfox commented on May 11, 2024

Thanks for the reply, I'd certainly be up for helping with the doco for new starters.

from janet.

bakpakin avatar bakpakin commented on May 11, 2024

All of the functionality for deploying Janet code with jpm has been released in 1.2.0, and documentation on it can be found here. For updates on the docs, file a bug against https://github.com/janet-lang/janet-lang.org.

from janet.

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.