global initializers can now be hooked, allowing garbage collected types to register their own roots #scopes
this was a fun nerd snipe: traverse an arbitrary range in the fewest number of log2 sized _and_ log2-aligned steps.
while this solution works, i feel there's possibly an even simpler one. the descend from the largest log2 aligned offset is basically just the remaining bits of the number. but the ascend is trickier. #scopes
integrated auto-capturing into the existing capture module, and it should be relatively robust now and compatible to existing captures. #scopes
wrote a lazy sum type generator / dispatcher, similar to our existing switcher pattern. #scopes
a bit of sugar later we've got transactions that can be rolled back. #scopes
phew. with a precomputed table, it is possible to compute the rolling hash of an arbitrarily big buffer of a repeating byte in log time. i'm sure this can be extended to arbitrary repetition of string, but this was hard enough. #scopes
work of yesterday: devise content addressable 128-bit hash that allows subslicing and concatenation without knowing what the actual content is.
i used a byte-wise polynomial rolling hash which does a reversible splitmix128 as finalizer to improve avalanche effect. for concat and slice the inverse splitmix128 is used to recover the rolling hash value.
a bunch of hygienic macros reduce webgpu chained struct inits to nothing. #scopes
settled on this syntax to discern mutable from immutable (memoized) types in the token db.
if you make an immutable type and declare all members mutable you've effectively made a singleton. #scopes
added support for a `then` block for `try` so exception handling is closer to destructuring. #scopes
first success in building a nice little ORM for the token db in #scopes; i can transparently switch out structs for these and they will just work.
in my experience with #scopes so far, a function f(map, value) -> {map, value} is universal enough to translate/expand/compile any kind of data efficiently. `map` can be shared by multiple different contexts but must be immutable to allow isolating subscopes, and universally polymorphic, so that any kind of key can be mapped to any kind of value, and so that it can also hold submaps. likewise `value` must be a universal variant.
wrote a BNF-like metagenerator in #scopes in 130 lines; 160 lines more for a matcher implementation, and 100 lines for a synthesizer (produce random specimens from the rules).
the demo below implements a small procedural fantasy word generator that is fed into the matcher for validation and segmentation.
#scopes can convert C include files to declarations in a scope object, and it can now also print scope objects into executable text form, which means that with a bunch of lines, one can now directly generate offline bindings from C header files