Schrödinger is a programming language, inspired by a Twitter joke: https://twitter.com/nicklockwood/status/425337273014816768
The Schrödinger language is C-like, but features only one primitive type, Cat, which can have one of two values, Dead or Alive.
You cannot assign values to a Cat, you can only ask what value it has. The value is determined randomly at the point of inspection but remains fixed from that point on. In that sense, a Cat is not so much a variable as a constant with a random value.
Here is some sample code:
Cat muffin;
if (muffin is Alive)
{
print "Hello World";
}
else
{
print "Goodbye, Cruel World";
}
Schrödinger imposes some limits on the naming of Cat variables. For example, these are acceptable:
Cat mittens;
Cat kitty;
Cat snowball;
However this would be a syntax error:
Cat fido;
Although the value of any given Cat is not known at compile time, by repeatedly creating cats and inspecting their value, it is possible to create a Cat with a known value. There is only a very small chance that this will take an infinite amount of time.
Once you have a cat in the desired state, you can put it in a Box for later. A Box is a special container type used for storing cats. Think of it as a Cat* (a pointer to a Cat).
Here is a more sophisticated example:
Box box;
do
{
//keep creating cats until we have a live one
Cat moggy;
if (moggy is Alive)
{
box.cat = moggy;
break;
}
}
if (box.cat is Alive)
{
print "The cat is alive!"
}
else
{
print "That... should not have happened"
}
The Schrödinger language is not without controversy. Some have argued that having only one type is limiting, and that requiring a non-determistic loop to set each variable to a known value is inconvenient, and can make Schrödinger a risky choice for performance-critical code.
Despite this, and the fact that there are no known compilers or interpreters, Schrödinger is still generally accepted as being more useful than Java.