Re: Spoken programming language
From: | Gary Shannon <fiziwig@...> |
Date: | Saturday, January 3, 2009, 19:29 |
-- On Sat, 1/3/09, Paul Kershaw <ptkershaw@...> wrote:
.....
>
> Actually, there are already mechanisms for depicting
> adjectives in OOP. For instance, in PHP:
>
> 1. apple->color == red
> 2. apple->color != green
> 3. apple->color = red
>
> In VB.net:
>
> 1. apple.color = red
> 2. apple.color <> green
> 3. apple.color = red
>
> English equivalents:
>
> 1. The apple is red.
> 2. The apple is not green.
> 3. The apple reddened.
>
In C++:
apple.color = red; // when "apple" is an object
apple->color = red; // when "apple" is a pointer to an object
Although in either case the English equivalent is in the imperative:
"MAKE the apple red!"
The syntax "apple.color == red" seems to mean "The apple is red?" with an implied question mark.
I still think the following kind of distinction needs to be made:
Assert(apple.color == red); // "I assert/claim/state that the apple is red."
Query(apple.color == red); // "Is the apple red?"
Imperative(apple.color = red); // "Make the apple red!"
--gary
Replies