ScalarCodec implementation; more tests to come