Skip to content

Instantly share code, notes, and snippets.

@Keno
Keno / match.md
Last active December 25, 2025 22:08

Syntax for match statements

This is a proposal for the native implementation of a match statement for pattern matching in julia. This was previously discussed in JuliaLang/julia#18285 and there have been various packages for this as well, most notably https://github.com/JuliaServices/Match.jl. `match is also found in several other languages, such as Scala (https://docs.scala-lang.org/tour/pattern-matching.html) and Rust (https://doc.rust-lang.org/book/ch06-02-match.html) as well as many functional progamming languages

This proposal is my attempt at a native julian take on these constructs, so the

Declared exceptions

The goal of this proposal is put forth a concrete proposal for having methods declare which exceptions are part of its API. This has been discussed in JuliaLang/julia#7026 and various other venues, but because the discussion there is extensive, I'm creating this as a clean document to put forward a concrete proposal.

Declared exceptions

cl = Int32[32, 1, 1, 47, 1, 1, 54, 1, 1, 58, 1, 1, 68, 2, 1, 72, 3, 1, 73, 0, 0, 76, 4, 1, 77, 5, 1, 78, 0, 0, 81, 7, 2, 81, 7, 3, 81, 7, 4, 81, 7, 5, 81, 7, 6, 81, 7, 7, 81, 7, 8, 81, 7, 9, 81, 7, 11, 81, 7, 12, 81, 7, 13, 81, 7, 14, 81, 7, 15, 81, 7, 16, 81, 7, 17, 81, 7, 18, 81, 7, 19, 81, 7, 20, 81, 7, 21, 81, 7, 22, 81, 7, 23, 81, 7, 24, 81, 7, 25, 81, 7, 26, 81, 7, 27, 81, 7, 28, 81, 7, 29, 81, 7, 30, 81, 7, 31, 81, 7, 32, 81, 7, 33, 81, 7, 34, 0, 0, 0, 81, 7, 36, 81, 7, 39, 81, 7, 40, 81, 7, 40, 81, 7, 40, 81, 7, 40, 81, 7, 40, 81, 7, 41, 81, 7, 42, 84, 0, 0, 85, 0, 0, 86, 0, 0, 86, 0, 0, 86, 0, 0, 86, 0, 0, 98, 11, 1, 98, 11, 2, 98, 11, 3, 98, 11, 4, 98, 11, 5, 98, 11, 7, 98, 11, 8, 98, 11, 9, 98, 11, 11, 98, 11, 12, 98, 11, 13, 98, 11, 14, 98, 11, 16, 98, 11, 17, 98, 11, 18, 98, 11, 19, 98, 11, 20, 99, 0, 0, 102, 0, 0, 103, 0, 0, 104, 0, 0, 106, 12, 1, 107, 13, 1, 107, 13, 2, 108, 0, 0, 109, 0, 0, 113, 12, 1, 114, 14, 1, 114, 14, 2, 114, 14, 3, 114, 14, 4, 119, 0, 0, 119, 15, 2, 119, 15, 3, 119, 15,
@Keno
Keno / README.md
Last active November 29, 2023 18:51
Mac TESmart KVM display issues lab notes

I am debugging an issue attempting to manage multiple macs through a TESmart KVM switch and a PiKVM. Everything works beautifully if the PiKVM is hooked up directly to the mac. Unfortunately, with the TESmart switch in the middle, the mac display goes dark after 30s or so. AllRez (https://github.com/joevt/AllRez) output from both the direct attach and with the temsart in the middle are attached.

Of particular note (to me at least) is that the HDCP status differs. Without the TESmart switch in the middle, HDCP is disabled:

    68028h AUX_HDCP_BCAPS: BCAPS_HDCP_CAPABLE, BCAPS_REPEATER_PRESENT
 68029h AUX_HDCP_BSTATUS: BSTATUS_LINK_FAILURE
### A Pluto.jl notebook ###
# v0.19.25
using Markdown
using InteractiveUtils
# ╔═╡ 3f8b71ed-d04c-4ce1-8c5d-663329993d6d
Main.foo
# ╔═╡ Cell order:
abstract type AbstractLattice; end
function widen; end
"""
struct JLTypeLattice
A singleton type representing the lattice of Julia types, without any inference
extensions.
"""
#include <stdio.h>
#include <signal.h>
#include <setjmp.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <pthread.h>
#include <errno.h>
#include <sys/mman.h>
<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=device-width"><meta charset="utf-8">
<meta name="pluto-insertion-spot-meta">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white"><meta name="theme-color" media="(prefers-color-scheme: dark)" content="#2a2928"><meta name="color-scheme" content="light dark"><link rel="icon" type="image/png" sizes="16x16" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.9/frontend-dist/favicon-16x16.347d2855.png" integrity="sha384-3qsGeVLdddzV9oIkj3PhXXQX2CZCjOD/CiyrPQOX6InOWw3HAHClrsQhPfX9uRAj" crossorigin="anonymous"><link rel="icon" type="image/png" sizes="32x32" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.9/frontend-dist/favicon-32x32.8789add4.png" integrity="sha384-cOe5vSoBIgKNgkUL27p9RpsGVY0uBg9PejLccDy+fR8ZD1Iv5dF1MGHjIZAIZwm6" crossorigin="anonymous"><link rel="icon" type="image/png" sizes="96x96" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.9/frontend-dist/favicon-96x96.48689391.png" integrity="sh
commit ec046ffc2b8b9ed6916e402ee580e18da6673709
Author: Keno Fischer <keno@juliacomputing.com>
Date: Sun Jul 3 01:53:53 2022 +0000
WIP: AMD CPUID override
Since e9ea1e7, we've had the ability to turn a userspace `cpuid`
instruction into a SIGSEGV using the ARCH_(GET|SET)_CPUID arch_prctl.
However, this capability is limited to supported hardware, which
currently means Intel CPUs. AMD CPUs do not have a documented facility
@Keno
Keno / IntercatsTalk.pdf
Last active September 7, 2022 11:33
Intercats Talk
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.