Skip to content

Instantly share code, notes, and snippets.

View fare's full-sized avatar

François-René Rideau fare

View GitHub Profile
@fare
fare / Context.scala
Created December 22, 2016 03:43
Context passing in Scala
trait IsContext {
def contextualContent: List[HasContext[this.type]] = List()
contextualContent.map { item => item.setContext(this) }
}
trait HasContext[+Context] {
private var ctx: Any = null
def setContext(context: Any) {
assert(ctx == null)
ctx = context
}
@fare
fare / default.nix
Created May 15, 2017 01:03
Nix support for gerbil
# pkgs/development/compilers/gerbil/default.nix
# Note: this supposes Gambit was compiled with
# "--enable-single-host"
# "--enable-shared"
# "--enable-absolute-shared-libs"
# "--enable-c-opt=-O6" "--enable-gcc-opts" "--enable-inline-jumps"
# "--enable-thread-system=posix" "--enable-dynamic-tls"
# "--enable-openssl"
{ stdenv, fetchurl, fetchgit, gambit, openssl, zlib, coreutils, rsync }:
@fare
fare / nest.ss
Created August 22, 2017 01:25
Trying to nest a helper inside a macro...
#lang racket
(define-syntax defsyntax (syntax-rules () ((_ x ...) (define-syntax x ...))))
;; These two work:
(defsyntax Rnest
(syntax-rules ()
((_ (rev ...) (one more ...)) (Rnest (one rev ...) (more ...)))
((_ () ()) ())
((_ (x) ()) x)
((_ (x (y ...) z ...) ()) (Rnest ((y ... x) z ...) ()))))
@fare
fare / case-lambda-bug.ss
Created February 17, 2018 01:57
case-lambda works in the interpreter, only accepts the base case in the compiler
;; works with Gerbil v0.12-DEV-1315-g5902327 on Gambit v4.8.8-434-g490f0a7d on nixpkgs 867d3f9 (gcc 7.2.0)
;; fails with Gerbil v0.12-DEV-1404-g0a266db on Gambit v4.8.8-435-gd1991ba7 on nixpkgs dafdaa9 (gcc 7.3.0)
package: bug
(export #t)
(import :clan/utils/assert)
(def foo (case-lambda (() 0) ((x) 1) ((x y) 2) ((x y z . t) (+ 3 (length t)))))
@fare
fare / What do Formal Methods actually Guarantee.csv
Created June 26, 2018 02:00
What do Formal Methods actually Guarantee?
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
"Limits to Formal Methods","What Formal Methods CAN do"
"Formal methods are not a magic powder that you can sprinkle over your code to make it correct.","Formal methods are a structural backbone around which you can develop more robust code."
"Formal methods are only methods. You still need to apply them correctly, to the right things to have useful results.","When applied correctly, formal methods can eliminate not only single bugs, but entire classes of bugs and attacks, that your model can express as absent."
"Formal methods won’t prevent bugs on aspects of your code that you haven’t formalized yet.","Formal methods can ensure the non regression of your code with respect to those classes of defects you formalized. Unlike other methods, they provide a ratchet that ensures progress even as the code evolves."
"Formal methods can’t eliminate bugs and prevent attacks that go below the model you use (e.g. SPECTRE attack).","Formal methods allow you to reason at one high level of abstraction and transport your re
@fare
fare / keybase.md
Created July 21, 2018 20:12
keybase proof

Keybase proof

I hereby claim:

  • I am fare on github.
  • I am fahree (https://keybase.io/fahree) on keybase.
  • I have a public key ASDY4Ks-hdLvBqTl4DYmUK5RmbfOYIA2V2W0UtbzmzkxtAo

To claim this, I am signing this object:

@fare
fare / api.md
Created October 14, 2024 16:50
First draft for Sky API

Availability API

Types

(deftype :signature (:byte-vector 64)) ;; ????
(deftype :hash (:byte-vector 32))
(deftype :topic :hash)
(deftype :data-block :byte-vector)
(deftype :block-certificate :signature)
(deftype :sky-connection ...)
@fare
fare / fable5-ltuo-essence.md
Created July 9, 2026 14:50
Trying to steer Claude Fable 5 Incognito towards my theory of OO

1

What is the essence of Object-Oriented Programming? What is it for? What makes something OO or not OO? I don't want the bullshit circular answers from Wikipedia or "common" literature, without clean criteria, wherein anything anyone claims is OO becomes so. I want a criterion based on essentials. Something that can duly reject hyped "this database is OO" (even though it isn't) or absurd and not-helpful opinions like Cook's "the lambda calculus is OO because it has abstraction, which is all that matters" and "smalltalk isn't 'pure' OO so haha it's not even quite OO". And by "OO" I will mean the programming language meaning that includes Smalltalk and CLOS as well as C++ Java and JavaScript. Hopefully the criterion can reject languages or systems that have claimed to be OO (but accept most of the commonly accepted OO languages), and accept a few outlires that aren't claimed as OO by their authors, but are (but still reject most languages not considered OO). If the criterion only restates wishy-wash

@fare
fare / oo.spec.2.for.fable5.md
Last active July 11, 2026 08:26
Trying to one-shot a good definition of OOP from Claude Fable 5

I am looking for a short but precise definition of Object-Oriented Programming.

A good definition for a concept is:

  • Meaningful: it provides information necessary and sufficient to delineate the concept. It must crucially reject what is outside the concept as well as accept what is inside.
  • Clear: it relies on well-understood unambiguous words and preexisting concepts, and provides criteria that are objective (as much as can be).
  • Informational: it relates a concept at some level of abstraction to its manifestations at a slightly lower level of abstraction. The definition might invoke concepts at the same level as the one being defined, but only if they are simpler than it,
@fare
fare / oo.spec.md
Created July 10, 2026 00:41
Trying to get a good definition of OOP from ChatGPT 5.5 (high)

I am looking for a short but precise definition of Object-Oriented Programming.

A good definition for a concept is:

  • Meaningful: it provides information necessary and sufficient to delineate the concept. It must crucially reject what is outside the concept as well as accept what is inside.
  • Clear: it relies on well-understood unambiguous words and preexisting concepts, and provides criteria that are objective (as much as can be).
  • Informational: it relates a concept at some level of abstraction to its manifestations at a slightly lower level of abstraction. The definition might invoke concepts at the same level as the one being defined, but only if they are simpler than it,