Re: Spoken programming language
From: | Lars Finsen <lars.finsen@...> |
Date: | Saturday, January 3, 2009, 19:12 |
Den 3. jan. 2009 kl. 16.27 skreiv Paul Kershaw:
> Tense doesn't have an existing structure, but I would imagine if a
> programmer wanted to describe tense, it would be done through
> relative shifts, treating time as a scalar variable. To start a
> brief story in a modified OOP:
>
> time.context = -2;
> create(maiden);
> about maiden;
> .age < 19;
> .age > 14;
> .hair.color = #FFCC66;
> .beauty.point10 = 9;
> .married = false;
> end about;
> create(dragon);
> about dragon;
> .size.point10 = 9;
> .temperament = const.fierce;
> .temperament =+ const.greedy;
> .location->town.radius.point10 = 5;
> end about;
>
> (Note: I've made some tweaks to standard OOP languages I'm familiar
> with. E.g., =+ means "append to existing matrix" while -> means
> "relative to" [not what it means in PHP].)
>
> English: Once upon a time, there was a very beautiful maiden who
> was young, but not too young, with golden hair and no husband;
> there was also a fierce, greedy dragon who lived not too far from
> town.
Smalltalk (assuming that the maiden lived in the mentioned town):
Time:= #once.
town:= Place new: #urban position: X.
lair:= Place new: #rural position: town position addNotTooMuch.
maiden:= Person new: #female beautiful: #very status: #maiden
maritalStatus: #unmarried age: #young underAge: false hairColour:
#golden residence: town.
dragon:= Monster new: #dragon temperament: #fierce greed: #high
residence: lair.
LEF
Reply