Skip to content

Instantly share code, notes, and snippets.

View komu's full-sized avatar

Juha Komulainen komu

View GitHub Profile

Proposal for Introducing nil to ECMAScript

Abstract

This proposal aims to introduce a new primitive value nil to the ECMAScript language, addressing a gap between null and undefined. While seemingly unnecessary, this addition offers subtle and nuanced differentiation in handling non-values, aligning with modern programming paradigms.

Specification

  • Value: nil
  • Type: typeof nil returns "absent"
package orwell;
import java.lang.reflect.Field;
public class Room101 {
public static void main(String[] args) {
Integer result = 2 + 2;
System.out.printf("2 + 2 = %d\n", result);
@komu
komu / river.lhs
Last active September 27, 2015 17:38
Crossing a river with Haskell
> {-# OPTIONS -Wall -XMultiParamTypeClasses -XFunctionalDependencies -XTypeSynonymInstances #-}
> module Main where
8 people are standing on a west bank of a river and must cross to the
other side using a boat. However,
- the boat carries at most 2 people at a time,
- the father can't be left with the girls without the mother,
- the mother can't be left with the boys without the father,
- the prisoner can't be left with any family members without the police,