• 0 Posts
  • 5 Comments
Joined 2 years ago
cake
Cake day: June 14th, 2023

help-circle
  • It’s because the Booleans sometimes are flipped in display-server technology from the 1980s, particularly anything with X11 lineage, and C didn’t have Boolean values back then. More generally, sometimes it’s useful to have truthhood be encoded low or 0, as in common Forths or many lower-level electrical-engineering protocols. The practice died off as popular languages started to have native Boolean values; today, about three quarters of new developers learn Python or ECMAScript as their first language, and FFI bindings are designed to paper over such low-level details. You’ll also sometimes see newer C/C++ libraries depending on newer standards which add native Booleans.

    As a fellow vim user with small hands, here are some tricks. The verb gU will uppercase letters but not underscores or hyphens, so sentences like gUiw can be used to uppercase an entire constant. The immediate action ~ which switches cases can be turned into a verb by :set tildeop, after which it can be used in a similar way to gU. If constants are all namespaced with a prefix followed by something unique like an underscore, then the prefix can be left out of new sections of code and added back in with a macro or a :%s replacement.



  • In short: If you’d like to learn more, come visit #pypy on Libera IRC. It’s an interesting discussion topic, particularly if we want standard-library imports like math, sys, or json to work.

    RPython is not capable of translating to bare metal today; it depends on libc and libffi for many features even when not producing JIT compilers. It’s also intended to operate on a layer of syscalls: rather than directly instructing hardware, it wants to make fairly plain calls, perhaps via FFI, passing ordinary low-level values. So, any OS developer would first have to figure out how to get RPython to emit code that doesn’t require runtime support, and also write out the low-level architecture-specific hardware-access routines.

    That said, RPython is designed to translate interpreters, and fundamentally it thinks an interpreter is any function with a while-loop, so a typical OS would be a fairly good fit in terms of architecture. RPython knows the difference between high-level garbage-collected objects and low-level machine-compatible values; GC would be available and most code would be written in a statically-typable dialect of Python 2.7 that tastes like Java or OCaml.

    The OS would be the hard part. RPython admits the same compositional flexibility as standard Python, so it should be possible to hack PyPy into something that can be composed with other RPython codebases. This wouldn’t be trivial, though; PyPy in particular is tightly glued to RPython since they are developed together in a single repository, and it wasn’t intended for reuse from the RPython side.

    If all of that sounds daunting, and what you would like to do instead is take an existing kernel or shell with C linkage and ELF support, and extend it arbitrarily using Python code, then PyPy can help you in that direction too. Compile a libpypy and embed PyPy against your kernel, and you can then run arbitrary Python code in a fairly nice environment which supports Python-first development. Warning: while the high-level parts of this might be nice, like Python’s built-in REPL tools, the low-level parts could be very nasty since this embedding interface is old and rotting, to say nothing of actually getting bare-metal code that doesn’t make syscalls.



  • I’ve been using NixOS for nearly a decade. It took me several days to understand the filesystem layout, and I had the advantage of knowing some capability theory beforehand. However, once I understood the Nix store, my paradigm shifted and I haven’t had any further “unexpected troubles.”

    As far as I can tell, AppImages and Flatpaks are extraneous, heavy, improperly isolated, and propagate a sprawling filesystem which is hard to secure. Compare and contrast with Impermanent NixOS, which only persists data that the user has explicitly marked to be saved and has systemwide caching of installed applications.