Comments (14)
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.
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.
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.
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.
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.
BTW, these images could likely be portable across OSs.
from janet.
WOW! This indeed is a nice feature! I'll be watching the janet development :)
from janet.
Nice improvement! I'll test it later. Good work!
from janet.
keep up the good work
from janet.
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.
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.
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.
Thanks for the reply, I'd certainly be up for helping with the doco for new starters.
from janet.
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)
- The case for a context object HOT 2
- The default meson option `epoll=false` causes a busy loop and segmentation fault. HOT 10
- Proposal: Terse Chained Indices HOT 19
- Reimplement `slurp` with `os/open`. HOT 28
- A way to read standard input in the background without `file/read` in a thread. HOT 4
- `each` macro improper behavior? HOT 8
- `if-let` breaks tail call optimization. HOT 6
- false branch of `if-let` doesn't report the correct call stack information. HOT 4
- `ev/select` should not resume a dead task. HOT 4
- `try` and `defer` break tail call optimization. HOT 4
- `(= @"update" @"update")` is `false`. HOT 3
- `ev/select` still revives fibers.... HOT 2
- option to unbundle docstrings and potential consequences HOT 8
- splicing into structs/tables HOT 2
- Disasm/asm doesn't round-trip for function with unused argument HOT 1
- eventloop/networking gets stuck on musl HOT 11
- Consider making `module/paths` a dynamic variable HOT 4
- Can it run on iOS? Thank you. HOT 3
- `os/strftime` doesn't respect environment variables.
- Re-integrate jpm into janet HOT 7
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 janet.