Skip to content

Instantly share code, notes, and snippets.

so regarding tree-shaking, if we put aside the mentioned pr for a moment, and take a look at this bit of text (from here):

As a matter of style, it is also recommended to group small libraries together into "bundles" that are updated, tested, and deployed together. Since Janet libraries are often quite small, the cost of downloading more functionality that one might need isn't particularly high, and JPM can remove unused functions and bindings from generated standalone binaries and images, so there is no runtime cost either.

when i first read this i thought what was being referred to by:

JPM can remove unused functions and bindings from generated standalone binaries and images

was user-defined things and not built-in janet things.

@sogaiu
sogaiu / notes.md
Last active December 18, 2025 06:54
android new phone data transfer

What's Changed

(import ../lib/location :as l)
(import ../lib/jipper :as j)
(comment
(def a-def
"(def a 1)")
(def a-def-with-tuple-destructuring
"(def [x y] [8 9])")
* code to help with "compiling" / "linking" multiple files into a
self-contained single script
* develop with files split, but "compile" to single script
* rationale
* single file can be copied and used more easily as a script or
library (e.g. easier to "vendor" into projects). though on
windows, the script idea may require an accessory `.bat` or
value (def)
src/janet/src/boot/boot.janet on line 11, column 3
defn
(defn name & more)
Define a function. Equivalent to `(def name (fn name [args] ...))`.
--------------------------------------------------------------------
@sogaiu
sogaiu / byte-use-in-janet-symbol-names.txt
Last active November 30, 2025 03:01
bytes used in janet symbol names
032 [ ]: 0
033 [!]: 596
034 ["]: 0
035 [#]: 0
036 [$]: 408
037 [%]: 235
038 [&]: 24
039 [']: 0
040 [(]: 0
041 [)]: 0
@sogaiu
sogaiu / comment-top-level-defs.janet
Last active November 29, 2025 11:15
comment top-level def extraction test
(import ./lib/location :as l)
(import ./lib/jipper :as j)
(comment
(def an-import
"(import ./analyze :as a)")
(def a-def
"(def a 1)")