Skip to content

Instantly share code, notes, and snippets.

@motlin
motlin / rxvt.bat
Created May 19, 2011 03:53
Launch script for Cygwin
@echo off
C:
chdir C:\cygwin\home\Craig
set SHELL=/bin/bash
set HOME=/home/Craig
set HOMEDRIVE="C:"
C:\cygwin\bin\rxvt -fn "Lucida Console-20" --loginShell +sb
@motlin
motlin / BottomType.java
Created June 5, 2012 03:02
Code example to illustrate bottom types
public class A{}
public class B{}
A a = method();
B b = method();
@motlin
motlin / BottomType.java
Created June 5, 2012 03:50
Code example to illustrate bottom types
public int factorial(int n)
{
if (n < 1)
{
error("n less than 1. <" + n + ">");
}
return n == 1 ? 1 : n * factorial(n - 1);
}
@motlin
motlin / BottomType.java
Created June 5, 2012 03:17
Code example to illustrate bottom types
public class A{}
public class B{}
A a = undefined();
B b = undefined();
@motlin
motlin / BottomType.java
Created June 5, 2012 03:22
Code example to illustrate bottom types
public class A{}
public class B{}
A a = null;
B b = null;
@motlin
motlin / BottomType.java
Created June 5, 2012 03:23
Code example to illustrate bottom types
public null undefined()
{
return null;
}
@motlin
motlin / BottomType.java
Created June 5, 2012 03:28
Code example to illustrate bottom types
public A undefinedA()
{
throw new RuntimeException();
}
public B undefinedB()
{
throw new RuntimeException();
}
@motlin
motlin / BottomType.java
Created June 5, 2012 03:33
Code example to illustrate bottom types
A a = undefined();
B b = undefined();
public Nothing undefined()
{
...;
}
@motlin
motlin / BottomType.java
Created June 5, 2012 03:55
Code example to illustrate bottom types
public MyObject myMethod(MyParameter myParameter)
{
return undefined();
}
// vs.
public MyObject myMethod(MyParameter myParameter)
{
undefined();
@motlin
motlin / BottomType.java
Created June 5, 2012 03:37
Code example to illustrate bottom types
public Nothing undefined()
{
return undefined();
}