Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active September 27, 2026 14:21
Show Gist options
  • Select an option

  • Save sogaiu/8b8c48a8f6ffc38453a804f3866d55c2 to your computer and use it in GitHub Desktop.

Select an option

Save sogaiu/8b8c48a8f6ffc38453a804f3866d55c2 to your computer and use it in GitHub Desktop.
issues
* be able to customize the ansi escape code for :code
in doc-format? see from around here:
https://janet.zulipchat.com/#narrow/channel/519748-chat/topic//near/623837136
bakpakin mentioned that styling and color can be turned off:
https://github.com/janet-lang/janet/pull/1886#issuecomment-5813103331
confirmed doable via NO_COLOR
* if "referencing" can be reliably detected in docstrings, could
analyze docstrings to see what the maximum length of a chain of
references is. we don't want chains that are too long because this
can make reading docs cumbersome (recall the difficulty of getting
to the bottom of a chain of function calls or up to the top of an
inheritance hierarchy to chase down how something works).
* improve website rendering of docstrings
https://github.com/janet-lang/janet-lang.org/issues/340
2024-02 https://gist.github.com/sogaiu/d57c77abf385bae42d8f042e71976549
2025-04 https://gist.github.com/sogaiu/d2e10696582735a93900ded1b6f7acf2
2025-04 https://gist.github.com/sogaiu/09975ae019fce55b2c971c466cc87f1f
2025-05 https://gist.github.com/sogaiu/833765603954c9b2a88714433b057fa4
sarna's work:
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/parsing.20docstrings/near/626279267
can we salvage pyrmont's doc-parse effort?
https://github.com/janet-lang/janet/pull/1590
what were the blockers?
* bakpakin mentioned facet token idea seems off
https://github.com/janet-lang/janet/pull/1590#issuecomment-2814270918
* loose lists are not really handled (creates independent tight
lists)
* anything else?
* zeal / dash docset generation
* janet-based solution?
* could make part of janet-lang.org build process?
* general process explained:
https://kapeli.com/docsets#dashDocset
* consult older efforts:
https://gitlab.com/sogaiu/janet-zeal-docset
https://github.com/gouch/janet-docset
* use sqlite3 janet module or just use sqlite3 binary?
* scraping by...peg? janet-xmlish?
* link rewriting (absolute url to relative - easiest to use
wget or other tool?)
* file/open
* buffer-size -> bufsize / buf-size?
* mention buf-size in docstring? only valid for non-windows.
* r, w, a, b, +, n - no backticks?
* backticks
* ev/close - missing backticks around (:close stream)
* *flychecking*
* remove backticks from around `true` - may be leave?
* first
* `0` - remove backticks?
* nil is surrounded by backticks in:
any? each eachk eachp find find-index first get get-in getproto in
index-of int/to-bytes loop next put reduce2 some update-in
remove backticks?
* short-fn
* $n -> $<n>? or $0, $1, $2, ...
questions
* how to express the name of some janet symbol with a "varying" part,
* case 1 - how to express the idea of any of $0, $1, $2, ... an
issue with writing $n is that it might mean $ followed by literal
n. one idea might be to express as $<n> but now how could we say
$ followed by literally <, then n, then >? one way to avoid this
issue is to just express as $0, $1, $2, and so on.
* case 2 - how to express the idea of any symbol. might think to
express as <sym>, but then how to distinguish between that and
literally < followed by sym followed by >?
* case 3 - how to express the idea of any keyword. in `loop`'s
docstring the notation :verb and :modifier are used but these are
stand-ins for :iterate, :range, etc. for the former and :while,
:until, etc. for the latter.
* possible collision with the way some abstract types are named.
e.g. <core/file>, <core/peg>, etc. since calling type on abstract
types of these sorts, leads to keyword results, may be can just
say "of type :core/file" or some such.
* scan within identifier for <...>? this could then support:
* $<...>
* <...>
* etc.
there is a collision with `:<anonymous>` though as this is a
literal value used for run-context
* support links inside terminal may be
https://janet.zulipchat.com/#narrow/channel/519748-chat/topic//near/623936650
https://janet.zulipchat.com/#narrow/channel/519748-chat/topic//near/623937001
https://docs.otty.sh/vt/osc/osc-8
* mystery of how reflow works for pre tags. the pre-existing newlines
seem to get ignored under certain circumstances (see defdyn and
array/slice?). some kind of html thing probably.
* use of bold / italic markup (surrounding with * or **)
should bold be reserved for something (e.g. non-janet constructs)?
poll and subsequent discussions suggest that bold is preferable?
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/Janet.20Documentation.20Improvements/near/624637834
bold seems better than italic in the terminal, but not in source
code.
currently, "*must*" in defdyn seems to be the only use of italics in
janet's docstrings.
* defdyn - *must* (does anything need to be done for this?)
* docs for groups of functions?
* buffer has multiple groups...but may be no one is confused?
* short-fn's signature is mysterious?
* Window.find for better search on web page?
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/Janet.20Documentation.20Improvements/near/624379234
but:
https://bugzilla.mozilla.org/show_bug.cgi?id=672395
https://issues.chromium.org/issues/40507943
https://github.com/whatwg/html/issues/3539
* collecting "see also" information
file/open, file/read -> slurp?
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/Janet.20Documentation.20Improvements/near/624533364
> So the way I'd tend to think about it is that I would've been
> happy to see that slurp existed once I found file/read :all, so
> probably slurp should be in the "see also" of file/read, not sure
> how "inclusive" we'd want it, it could make sense to also have it
> in the "see also" of file/open only if the "see also" list doesn't
> get too big.
> I don't know how much we'd want file/open and file/read in the
> "see also" of slurp, maybe. But we definitely want spit in the
> "see also" of slurp (this one is on janetdocs.org).
* append parens to c function names to distinguish from janet
constructs?
---
some stances / conventions
* docstring size
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/Janet.20Documentation.20Improvements/near/619423101
> ...do some analysis at the end of this and see what the impact of
> extending all of these doc strings is for the final binary size.
...
> basically build janet first normally, and then with #define
> JANET_NO_DOCSTRINGS in janetconf.h (or the corresponding meson
> option) and find the difference
* little to no example code
* "referencing" stance rationale
https://janet.zulipchat.com/#narrow/channel/399615-general/topic/Janet.20Documentation.20Improvements/near/622684967
* use of backticks
* see item 5 at:
https://github.com/sogaiu/janet-docs/blob/51ce340d3aca2cc6763d37767ce584e35e8c0df0/docs/docstrings.md#size-features-and-format
* any alternative way of marking some of these things?
* surrounding with * (italic)
* surrounding with ** (bold)
* surrounding with "
* surrounding with '
* multiple backticks, e.g. ``hello``
* some evidence of what people have done:
* bakpakin has wrapped keywords in backticks and
used `-` instead of `--` to separate names from
descriptions:
https://github.com/janet-lang/janet/commit/c911f7c47e5a17e150a08a41f20f76b462f68b03
* bakpakin wrapped true in backticks (see *flychecking*
https://github.com/janet-lang/janet/commit/1ff26d702a665d7c66774e635b685345e46a8064
* use square brackets for tuples
* list markup (* for bullet, - between name and description, etc.)
* <core/peg> vs core/file, core/native, int/s64, int/u64 (angle brackets)
* parameter names convention
https://github.com/sogaiu/janet-docs/blob/master/docs/names.md
* terminology
* avoid "data structure" mostly
* use bytes type instead of bytesequence?
* ...
---
post-first-pass?
* remove backticks from around instances of nil?
---
inconsistencies
* flags shown as keywords sometimes and not at other times
* keywords - ev/thread, fiber/new, net/shutdown, os/execute, os/open, os/pipe
* bare - file/open
* list item markup
* use of - vs -- within lists to separate a term /
name from a description (also - instead of * for bullet)
* - debug/stack, disasm, ev/thread, fiber/new, fiber/status,
file/open, file/read, file/seek, filewatch/add, os/date,
os/execute, os/open, os/pipe, os/which,
parser/state, parser/status, sandbox
* -- filewatch/new, loop, match, module/expand-path, run-context
* backtick surrounding - questionable now?
* needs surrounding?
* debug/stack, disasm, fiber/new, fiber/status, file/seek,
module/expand-path, os/date, os/execute, os/open, os/pipe,
os/which, parser/state, parser/status, sandbox
* too much surrounding (see `:while expression` for example)
* loop
* <core/peg> vs core/file, core/native, core/s64, core/u64 (angle brackets)
* using angle brackets seems like a slightly better choice because
there could at some point be symbols that look like core/something?
* may be there's even better notation? perhaps use keywords?
* except for <core/peg>, all other instances lack angle brackets
* ev/go - core/channel
* ev/to-file - core/file (no backticks)
* ffi/native - core/native
* math/rng - core/rng (no backticks)
* os/execute - core/file, core/stream (no backticks)
* os/posix-fork - core/process (no backticks)
* os/proc-wait - core/process (no backticks)
* os/spawn - core/process (no backticks)
* peg/compile - <core/peg> (only instance using angle brackets?)
* print - core/file (no backticks)
* janet vs Janet vs none
* how to refer to janet virtual / abstract machine
* Janet machine - debug/step
* VM - ev/deadline
* any other cases?
---
parameters
* number-related
* ns -> nums or ns -> xs...
* %=, *=, /=, +=, -=
* ns -> xs because can handle int/s64, int/u64...
but only values that can be converted to integers, so
may be ns is ok?
* ns
* band, etc.
* xs
* < (and friends) can use `janet_compare` (so indexed and other
types too?)
* use of xs in docstring of + (and friends), (+ & xs)...can
values of xs be anything other than numbers? they can be
int/s64 and int/u64, so may be x is ok?
otoh, (+= x & ns)...
probably should be consistent one way or another...one of:
1. (+= n & ns)
2. (+= x & xs)
3. (+= num & nums)
1. is the worst choice, probably. 3. is longer and looks a bit odd.
may be 2. is the best choice here.
* does n stand in for?
* integer
* something that can be converted to an integer
* hold off on deciding until examples are spelled out
and behavior / intention confirmed?
* (% & xs) vs (%= x & ns) (and for *, +, -, /)
* val vs x?
* args vs xs (vs vals - no uses yet)
* args
* not variadic
* cli-main - must the args here be an indexed type of bytes types?
* extreme
* max-of, min-of
* os/execute, os/posix-exec, os/spawn - indexed type of strings
* variadic
* apply, as-macro, assertf
* buffer/format, buffer/format-at
* errorf, ev/call
* ffi/call
* import, import*
* maclintf, max, min
* peg/*
* range, require
* string/format
* update, update-in
* xs
* %, *, +, -, /, <, <=, =, >, >=
* all, array, array/insert, array/push
* buffer, buffer/push, buffer/push-at, buffer/push-byte,
buffer/push-string, buffer/push-word
* compare<, compare<=, compare=, compare>, compare>=, count
* distinct, div
* eprin, eprinf, eprint, eprintf
* interleave
* keep, keyword
* map, mapcat, mod
* not=
* prin, prinf, print, printf
* some, string, symbol
* tuple, tuple/brackets
* xprin, xprinf, xprint, xprintf
* byte sequence vs bytes type
* byte sequence
* buffer, keyword, scan-number, string, string/slice, string/trim,
string/triml, string/trimr, symbol
* byte sequences
* load-image-dict, memcmp
* bytes type
* accumulate, accumulate2, any?, drop, drop-while, each, eachk,
eachp, every?, filter, find, find-index, frequencies, geomean,
get, group-by. has-key?, has-value?, in, index-of, interleave,
interpose, invert, keys, last, length, mean, next, pairs,
partition, partition-by, product, reduce, reduce2, reverse, sum,
take, take-while, values
* cases vs clauses?
* cases
* match
* clauses
* case, cond, ev/rselect, ev/select
* data -> ?
* number (see janet's tests)
* buffer/push-float32, buffer/push-float64, buffer/push-uint16,
buffer/push-uint32, buffer/push-uint64
* bytes type (c distinguishes between buffer and bytes type cuz ev?)
* ev/write, net/send-to, net/write
* ffi/write - data can be indexed, nil, number, string, boolean,
integer, integer64, uinteger64, pointer, keyword, symbol,
cfunction, abstract (w/ bytes method), function...but not table,
struct, or fiber?
* date-struct vs dt-struct vs date-st
* os/mktime
* end vs stop
* end
* array/slice, buffer/slice, keyword/slice, slice, string/slice,
symbol/slice, tuple/slice
* stop
* for, forv
* sec vs timeout
* sec
* ev/deadline, ev/sleep, ev/with-deadline, os/sleep
* timeout
* ev/chunk, ev/read, ev/write, net/accept, net/chunk, net/read,
net/recv-from, net/send-to, net/write
* ast -> form?
* compile - (eval uses `form`, so they should be the same)
* form: defer, edefer, eval, postwalk, prewalk, walk
* forms: ->, ->>, -?>, -?>>, and, as->, as?->, delay, or
* e -> exp
* math/ldexp
* m -> mant
* math/ldexp
* get rid of use of term x when only xs is in signature
* buffer/push
* ds -> ?
* thaw, thaw-keep-keys - support strings but no other bytes
types...may be that's ok? however, thaw's
docstring might be misleading then because
of the phrase "all other types"
* f is used for file descriptor in file/ stuff as well as a function
elsewhere...
* as file - file/close, file/flush, file/read,
file/seek, file/tell, file/write
* as function - accumulate, accumulate2, apply, as-macro, ev/call,
group-by, map, mapcat, partial, partition-by,
postwalk, prewalk, reduce, reduce2, sort-by,
sorted-by, update, update-in, walk
note that file/open's docstring uses the phrase "file handle" so
possibly using `fh` would be ok...
* parser -> p or prsr?
* parser
* parser/byte, parser/consume, parser/eof, parser/error,
parser/flush, parser/has-more, parser/insert, parser/produce,
parser/state, parser/status, parser/where
* p (not great since there is `ps` for `from-pairs`...should
`from-pairs` change?)
* bad-parse, parser/clone
* prefix vs pfx?
* prefix - debug/stacktrace (string),
merge-module (usually string with trailing "/")
* pfx - string/has-prefix? (string)
* os/which avoid using test as parameter name?
* osname
* os-desc
* os
"Is test is truthy" has a typo: Is -> If
* os/rename - oldname -> oldpath? newname -> newpath?
* src vs source vs source-line?
* src - as buffer - buffer/blit
as path - bundle/add, bundle/add-bin, bundle/add-file,
bundle/add-manpage
* source - compile(?)
as path - debug/break, debug/unbreak, dofile
other - merge-module
* ev/thread - main -> fiber-or-fn / fib-or-fn
* not changing is ok from the perspective that `main` doesn't shadow
a built-in construct name. otoh, `main` is a special name that a
user is likely to define.
---
by individual function
* debug/break
* explain source parameter in prose
* remove example
* make examples file at janet-lang.org
* debug/unbreak
* explain source parameter in prose possibly
by refrencing debug/break
* make examples file at janet-lang.org?
* errorf - redundant docstring?
* ffi/write - lacks explanation of parameters
* net/setsockopt
* capitalization
* missing - marks
* table/clone
* veqq
> I think there are straightforward small wins (like removing the
> later part of table/clone's docstring, which just misleads
> people).
https://github.com/janet-lang/janet/issues/576
* rwtolbert
https://janet.zulipchat.com/#narrow/channel/409517-help/topic/table.2Fclone.20doesn.27t.20make.20a.20deep.20copy.3F/near/618085936
https://janet.zulipchat.com/#narrow/channel/409517-help/topic/table.2Fclone.20doesn.27t.20make.20a.20deep.20copy.3F/near/618086761
* link from prototypes page to new cloning section (on data
structures page)
* shallow copy is default, sometimes deep
* XXX: dropping prototypes is default, sometimes flattened or copied
* table/clone appears to copy prototype reference - should
docstring mention this?
---
by characteristic
* docstring oddness
* array/concat: each of the `parts` do not have to be indexed types
(array/concat @[] [:a] @[:b] "hello") works
docstring is sort of misleading may be?
should probably say that each value in `parts` can be of any type.
* explicitly mentions website
* asm
* peg/match
* array or tuple, array and tuple, array/tuple, arrays/tuples
* apply
* array/slice
* cli-main
* indexed?
* match
* os/execute
* tuple/slice
* struct or table, table/struct
* os/execute
* excise "data structure" where appropriate
* "plain":
* todo: ffi/read
* go through core api page again to collect any more instances
* improve ffi/write along with ffi/read
* peg stuff
* peg/* functions don't mention that `peg` can be abstract type.
* peg/match
* peg/find
* peg/find-all
* peg/replace
* peg/replace-all
* peg/compile
* website docs prose a bit out-of-date?
> The peg module has few functions because the complexity is exposed
> through the pattern syntax. Note that there is only one match
> function, peg/match. Variations on matching, such as parsing or
> searching, can be implemented inside patterns.
there are functions other than peg/match now
* avoid changing / mark as discouraged?
* walk, prewalk, postwalk
* take, take-until, take-while,
drop, drop-while, drop-until
---
terms / glossary
* `iterable` only used in source once (single error message), but
bakpakin uses in communication. see notes elsewhere.
* `run-context` sometimes used to describe a context (see `quit`)
* stack trace, not stacktrace (apparently)
---
misc
* rwtolbert powershell tidbit
PS C:\Users\bob> get-help get-childitem
NAME
Get-ChildItem
.... [ elided ]
REMARKS
To see the examples, type: "get-help Get-ChildItem -examples".
For more information, type: "get-help Get-ChildItem -detailed".
For technical information, type: "get-help Get-ChildItem -full".
For online help, type: "get-help Get-ChildItem -online"
* synonyms
* glossary?
* some functions / macros are not so good...is there a way to
discourage use but not deprecate?
* walk, prewalk, postwalk
https://github.com/janet-lang/janet/issues/1616
how about "fixed" versions?
* drop-until, drop-while, take-until, take-while
drop, take added later by person who didn't stick around.
all produce immutable things (arrays -> tuples, buffers ->
strings)
take oddities / mismatched docs:
* handles dictionaries, but returns tables (whereas for bytes
and indexed types returns immutable types)...also there
is no specified order for dictionaries...
* for fibers and abstract types, doesn't handle negative
indices
https://github.com/janet-lang/janet/issues/1178
https://github.com/janet-lang/janet/pull/1183
* slice - returns tuples when given arrays...is that particularly
useful? wouldn't returning arrays be more janet-like? if a tuple
is desired, why not use tuple/slice?
* juxt and juxt*? turned out to be not so useful?
* XXX: other?
* some terms are easier to understand by examining JANET_TFLAG_* in
janet.h
* collect spork items but don't commit to doing just yet
* 4 uses of "indexed data structure" in misc.janet
https://github.com/janet-lang/spork/blob/d11159797de554f32c63912bdd73c35e45a38f6b/spork/misc.janet#L373-L391
* how to verify claims about abstract types. test an abstract type
that has appropriate implementations for `get`, etc.? need to find
or create a suitable implementation first. extend / modify settee?
`tarray`s in spork are useful for some of this (e.g. helped when
invstigating `sort`).
* slice - example abstract type with bytes method?
* recall how `update` doesn't work with settee -- testing with
actual usages seems better if possible to verify docstring
assertions.
* iterable
https://github.com/janet-lang/janet/pull/1696#issuecomment-3770848819
https://github.com/janet-lang/janet/issues/1697
https://github.com/janet-lang/janet-lang.org/issues/315
what counts as an iterable? see:
https://github.com/janet-lang/janet/pull/1696#issuecomment-3770848819
for details.
single-use (single-pass) vs re-iterable
may be not worth defining.
otoh, bakpakin keeps using the terminology:
https://github.com/janet-lang/janet/pull/1801#issuecomment-5302482584
that doesn't mean it needs to live in the docstrings though :)
so if not, change `empty?`'s docstring to be explicit about
supported types:
``
(empty? x)
Check if `x` is empty.
`x` can be a bytes, indexed, dictionary, fiber, or abstract type
with a suitable `next` method.
``
* possibly makes sense to change lone location (error message in
`janet_next_impl` in `value.c`) in source code that mentions
iterable...
* section on upgrading janet (module recompilation)
* only update-installed should be needed now?
* how to address converting from .janet files in examples to content
appropriate for janet-lang.org's examples (currently manual)
* return value checking
* indeterminate in some cases (e.g. `next`)
* expected errors
* documenting janet-pm
* difference between :dependencies and :jpm-dependencies?
(defn pm-install
"Install a bundle given a url, short name, or full 'bundle code'. The bundle source code will be fetched from
git or a url, then installed with `bundle/install`."
[bundle-code &named no-deps force-update no-install auto-remove]
(def bundle (resolve-bundle bundle-code))
(def name (name-lookup bundle))
(if (and name (not force-update)) (break))
(def {:url url :type bundle-type :tag tag} bundle)
(def bdir (download-bundle url bundle-type tag))
(def did-shim (project-janet-shim bdir))
(def info (load-project-meta bdir))
(def infoname (get info :name))
(when (and (not name) (bundle/installed? infoname))
(def existing (bundle-name-to-bundle infoname))
(eprintf "a conflicting bundle %v is already installed, keeping that one." infoname)
(eprintf " existing bundle: %.99M" existing)
(eprintf " skipped bundle %.99M" bundle)
(break))
# XXX: pay attention from here...
(def jpm-deps (get info :jpm-dependencies @[]))
(unless no-deps
(each dep jpm-deps
(pm-install dep :force-update force-update :auto-remove true)))
(when did-shim
# patch deps after installing all jpm dependencies. This allows the bundle/* module to track dependencies, and
# prevent things like uninstalling a dependency, breaking another installed package.
(def deps-or-nils (seq [d :in jpm-deps] (jpm-dep-to-bundle-dep d)))
(def deps (filter identity deps-or-nils))
(unless (index-of "spork" deps)
# if spork is not installed, we are installing to a different tree.
(when (bundle/installed? "spork") (array/push deps "spork")))
(put info :dependencies deps)
# XXX: ...to here
---
waiting for merge
* 451 string/check-set
* 452 string/split
* 1889
* arrtup -> ind (or may be x depending on capabilities)
* array/slice
* spit
* contents - must be bytes type, just use `bytes`?
* delim -> sep
* string/split
* string/check-set
* parameter name changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment