RSSAmplifier

Blog

Noam Lewis - The Blog

/blog/RSS feed ↗11 posts

Latest posts

The Open-Source Libraries Powering Fresh

The Open-Source Libraries Powering Fresh Building Fresh would have been insanely hard if it weren't for these libraries. Packages specifically useful for building a TUI text editor: Crate One-Line Summary arboard Cross-platform acesss to the system clipboard (CTRL+C for the win) crossterm Terminal manipulation, handling input, cursor movement, and colors across platforms (backend for ratatui) deno…

Type-safe enums in C, using a clang plugin

The C programming language generally treats enums as integers (see “Appendix: For Language Lawyers” for reference).

Safer C programming

TL;DR - check out elfs-clang-plugins, cool plugins for clang made at elastifile.

Const when you need it

infernu uses row-type polymorphism to propagate read/write capabilities on record fields. Using row-type polymorphism to describe more than just which fields are present bears a vague resemblance to polymorphic constraints.

Two implementations of DHM type inference

Here are two simple implementations of Damas-Hindley-Milner type inference.

In Python, don’t initialize local variables unnecessarily

A common pattern:

Beware of ‘var’ in for loops, JS programmers

Time and time again, I see people using ‘var’ in the initialization part of a for loop. Example from MDN (Mozilla Developer Network):

A simple problem with recursive types and subtyping

Here’s a simple example of recursive types interacting badly with subtyping: T={ foo: T -> A} U={ foo: U -> B} Consider T <: U, therefore (T -> A) <: (U -> B) Which implies: U <: T So T <: U but also U <: T, which is true iff A <: B and B <: A.

infernu news

In the past month, most of the work on infernu was to stabilize the type system, making decisions about some trade-offs. Here’s a short summary:

Identity Crisis

Compared to other tools adding static types to JavaScript, Infernu’s main strengths are full type inference and strong type safety. Here are a few examples.

The wl-pprint package maintainer…

…is now me.