Skip to content

Instantly share code, notes, and snippets.

@uucidl
uucidl / fastbuild-generator.patch
Last active July 18, 2016 08:17
(WIP) FASTbuild generator for gyp
From 2c2a5e747a601ec655e5a94d935cca09599580d1 Mon Sep 17 00:00:00 2001
From: nil <nil@ableton.com>
Date: Mon, 9 May 2016 12:51:23 +0200
Subject: [PATCH 01/19] Import fastbuild generator
---
pylib/gyp/generator/fastbuild.py | 1095 ++++++++++++++++++++++++++++++++++++++
1 file changed, 1095 insertions(+)
create mode 100644 pylib/gyp/generator/fastbuild.py
  • A Discipline Of Programming by Edsger W. Dijkstra
  • Elements Of Programming by Alexander Stepanov and Paul McJones
@uucidl
uucidl / generality.org
Last active November 4, 2016 11:20
Generality

https://youtu.be/CAlU_hs_rZ8?t=3069

It’s good to generalize when things get simpler in generality. I.e. general case vs case analysis

This seems to have similarities to the practice of Topology in Mathematics (of which I’m no expert of) in how they squash degerate cases.

Discipline Of Programming by Dijkstra:

  • there are useful and useless generalizations
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
size_t
megabytes_size(uint32_t x)
{
return x * 1024 * 1024;
@uucidl
uucidl / problems-with-async.org
Created March 3, 2017 17:13
problems with async

Asynchronous updates are somewhat useful to distribute computations.

However this makes behavior composition hard (callback/promise etc) and callstacks start losing their effectiveness when a crash occurs, since scope is unclear.

@uucidl
uucidl / grain-ratio.cpp
Last active March 3, 2017 17:22
grain-ratio.cpp
// @url: https://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD340.html
// @url: https://www.cs.utexas.edu/~EWD/transcriptions/EWD03xx/EWD361.html
// @quote{
// For besides the need of precision and explicitness, the programmer is faced with a problem of size
// that seems unique to the programmer profession. When dealing with "mastered complexity", the idea
// of a hierarchy seems to be a key concept. But the notion of a hierarchy implies that what at one
// level is regarded as an unanalyzed unit, is regarded as a composite object at the next lower lever
// of greater detail, for which the appropriate grain (say, of time or space) is an order of magnitude
// smaller than the corresponding grain appropriate at the next higher level. As a result the number
// of levels that can meaningfully be distinguished in a hierarchical composition is kind of
@uucidl
uucidl / symbolserver_tips.org
Created April 28, 2017 08:21
Symbols; Symbol Server on Windows
// Passing container explicitely to all its functions, and using typed cursors (i.e. indices)
// rather than all-knowing iterators (i.e. pointers) allows to use the same return type for
// iteration, look-up etc.. regardless of what's going to happen next.
//
// Downsides:
// A cursor requires an indirection when looking at the data in the debugger.
// I.e. a `char*` member shows you directly what you should be looking at,
// whereas if you have the pos, you need the container and to use debugger expressions
// to see the content.
//
@uucidl
uucidl / repro.c
Last active August 20, 2017 17:56
Reproduction of an optimizer bug with Visual Studio 2017
/* Repro optimizer issue with Visual Studio 2017 */
/* @language: c99 */
/*
# Visual Studio 2015 (working)
--
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe
cl.exe -Fe:repro.exe repro.c -nologo -FC -EHsc -Z7 -Oi -GR- -Gm- -O2 -Z7 -W4 -WX -DEBUG
@uucidl
uucidl / ZZ_Draft.org
Last active September 1, 2017 12:49
Maintaining APIs: Resist adding that boolean parameter!

Resist adding that boolean parameter!

Also known as: “The Boolean Trap” “Boolean parameters are wrong”

Consider a trivial software interface with one entry point proc:

// Transforms a value (type T0) into another value (type T1) with effect E0
T1 proc(T0);