ezyang’s blog

the arc of software bends towards understanding

Killer mutants attack (mutation gone wrong)

This is a collection of WTFs due to misuse of mutable state. We'll start off with some Java. What do you expect this snippet of code to do? Sensor Accel = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); Sensor Orient = sm.getDefaultSensor(Sensor.TYPE_ORIENTATION); sm.registerListener((SensorEventListener) this, Accel, sm.SENSOR_DELAY_FASTEST); Ostensibly, it registers the current object to receive just accelerometer updates. But what if I […]

  • March 9, 2011