Hello. This course is a bit unusual.
I will present questions to prepare exercises for next week.
This session is the first session
about the way we want you to think about OOC.
Do the exercises. They're quite interesting.
What are they? There are three of them.
We'll ask you to implement not, to implement or,
and, most importantly, to wonder why these exercises.
Let's take a look at them.
First, you have the Booleans true and false.
You have messages and objects. How to implement not?
It's quite easy.
If you have false and send the message not, it returns true.
If you have true and send the message not, it returns false.
It's not so hard. But how to implement this?
The second question is about or.
Or in Pharo is |. We took examples from the Pharo implementation.
Don't cheat. Do it without checking how it's implemented.
Once again, you have Booleans: true and false.
You have objects and messages.
You have true | true returns true.
true | false returns true. true | anything returns true.
It's the same with false.
How to implement this? That's the two questions.
Take a piece of paper and try to answer.
The third question: "Why are you guys asking me this?"
You must be thinking: "I'll never implement Booleans in my life."
You're right.
Except if you have to use three-valued logic:
true, false, and unknown.
How do you do this?
You must wonder why we're wasting film to ask you this question.
It's the crucial question we ask whenever we teach advanced programming.
There must be a reason. We'll explain next week what that reason is.
Enjoy.