Skip to content

Instantly share code, notes, and snippets.

View no-defun-allowed's full-sized avatar

Hayley Patton no-defun-allowed

View GitHub Profile
@no-defun-allowed
no-defun-allowed / dbyol.org
Last active April 28, 2025 23:14
Don't Build Your Own Lisp

Don’t Build Your Own Lisp

I feel somewhat pressed to give a negative review of this book. This comes from someone who has worked on various Lisp implementations, and written some amount of C, but that isn’t an excuse to be overly harsh. This book, however, does not provide many nice things to say, and plenty of un-nice things. My apologies in advance.

First off: God help you if you are going to write your first interpreter in C of all things. No one I know thinks it’s a good idea to start

@no-defun-allowed
no-defun-allowed / oblique-strategies.el
Last active March 9, 2025 06:43
Brian Eno's Oblique Strategies cards in Emacs
(defvar *oblique-strategy-list*
'("Remove specifics and convert to ambiguities"
"Don't be frightened of cliches"
"What is the reality of the situation?"
"Are there sections? Consider transitions "
"Turn it upside down "
"Think of the radio "
"Allow an easement (an easement is the abandonment of a stricture) "
"Simple subtraction "
"Go slowly all the way round the outside "
@no-defun-allowed
no-defun-allowed / selling-lisp-by-the-pound.org
Last active April 17, 2024 06:10
Selling Lisp by the pound

Selling Lisp by the Pound

“Paper late!” cried a voice in the crowd,

“Old man dies!” The note he left was signed,

‘Old Kiczales’ - it seems he’s drowned!

TODO stuff for SBCL mark-region GC

First, make the damn GC work consistently.

Done: Parallelise it.

Parallel marking seems easier than parallel copying. The GC is already designed after https://dl.acm.org/doi/pdf/10.1145/512529.512546 and has the same mark queue design. We presumably “just” need to make marking atomic,

@no-defun-allowed
no-defun-allowed / partial-read-barriers.md
Last active June 5, 2023 05:17
Partial read barriers and Common Lisp

The "partial read barrier" and Common Lisp

Most CLOS implementations use a representation for instances which uses an indirection, in order to implement class redefinition and change-class. In this document I propose a technique which avoids the indirection most of the time, describe how to optimise around the assumption that a class does not change, and how this technique fares with multiple threads.

The partial read barrier and Smalltalk

;; A grown up version of https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00127.html
(defvar-local *vpi-did-full-indent?* nil)
(defun vpi-find-start ()
(loop
(back-to-indentation)
(when (or (= (point-min) (point)) (zerop (current-column)))
(return))
(forward-line -1)))
@no-defun-allowed
no-defun-allowed / point.lisp
Last active May 4, 2022 05:56
A metaclass which allocates instance slots in contiguous vectors
(defclass point ()
((x :initarg :x
:reader x
:type single-float
:pool-name *point-xs*)
(y :initarg :y
:reader y
:type single-float
:pool-name *point-ys*))
(:metaclass pooled-class))
@no-defun-allowed
no-defun-allowed / evm-versus-secd.md
Last active May 3, 2022 13:56
An unfair comparison of Ethereum VM mishaps to Netfarm's VM

Looking through the "checklist" on https://news.ycombinator.com/item?id=14691212. I think I made it out alive.

  1. Everything is 256 bits wide, including the "byte" type. This means that whilst byte[] is valid syntax, it will take up 32x more space than you expect. Storage space is extremely limited in Solidity programs. You should use "bytes" instead which is an actual byte array. The native 256-bit wide primitive type is called "bytes32" but the actual 8-bit wide byte type is called "int8".

Object size is an implementation detail.

  1. Strings. What can we say about this. There is a string type. It is useless. There is no support for string manipulation at all. String concatenation must be done by hand after casting to a byte array. Basics like indexOf() must also be written by hand or implementations copied into your program. To even learn the length of a string you must cast it to a byte array, but see above. In some versions of the Solidity compiler passing an empty string to a function would cause all
@no-defun-allowed
no-defun-allowed / ssl_lib.c
Created March 29, 2022 10:14
fix libbass.so not knowing how to use SSL in Garry's Mod
static int peek_failures = 0;
int SSL_peek(SSL *s, void *buf, int num)
{
if (s->handshake_func == 0) {
SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED);
return -1;
}
if (s->shutdown & SSL_RECEIVED_SHUTDOWN) {
#include <gc.h>
#include <cstddef>
#include <new>
void* operator new(std::size_t n) {
void *p = GC_MALLOC(n);
if (!p) throw std::bad_alloc();
return p;
}