[icon] 9
View:Recent Entries.
View:Archive.
View:Friends.
View:User Info.
Фильтр френдов:Online Friends. Коммунити.
Мой жж:Tags.
You're looking at the latest 1 entries.

Tags:,
Current Music:Feng Shui » Enter The Kingdom (4:34) » Music For The Harmonious Spirit
Time:09:22 pm
t.rotate (a, v); //Original
t rotate (a, v); //Who needs dot?
t rotate a, v; //Who needs brackets?
To evolve the syntax further, we need to know what the two parameters a and v represent. Let’s
assume the entire example is meant to “rotate by angle a around vector v.” Then the next step might be
t rotate by a around v; //Who needs commas?
How do we tell what the components are? We know, because we evolved the example, that “t” is a
variable, “rotate” is the name of the method, “by” is a separator, “a” is a variable, “around” is a
separator, and finally “v” is a variable. To eliminate potential ambiguity, we can establish a convention:
add colons after separators. Then we get
t rotate by: a around: v; //Who needs ambiguity?
Finally, let’s insist that the separators be part of the method name; i.e., let’s require that the name of
the method be “rotate by: around:” and let’s get rid of the spaces to get “rotateby:around:” as the name
and finally, let’s capitalize internal words just for readability to get “rotateBy:around:”. Then our
example could be written
t rotateBy: a around: v //This is Smalltalk
comments: Leave a comment Add to Memories Tell a Friend

[icon] 9
View:Recent Entries.
View:Archive.
View:Friends.
View:User Info.
Фильтр френдов:Online Friends. Коммунити.
Мой жж:Tags.
You're looking at the latest 1 entries.