News for hackers. Stuff that matters.
Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by xkriva11 on Saturday December 18, 2021 @10:24AM (#29605103)
Let me add a classic "tutorial":

t.rotate (a, v); // Original

t rotate (a, v); // Who needs dot?

t rotate a, v; // Who needs brackets?

t rotate by: a around: v; // Who needs ambiguity?

t rotateBy: a around: v // This is Smalltalk

Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by Jtsummers on Saturday December 18, 2021 @10:38AM (#29605210)
That's literally from page 2 of this, you could at least state that you're quoting the document.

Also, you missed a step. Before "ambiguity":

  t rotate by a around v; //Who needs commas?
Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by FpUser on Saturday December 18, 2021 @02:55PM (#29607952)

  t.rotate(a, v);
  ...
  t rotateBy: a around: v
I will consider only first and last as the rest is just fluffing around.

Objectively speaking (yeah right) there is no difference and both serve the same purpose. For whatever reason the first form is more visually and mentally pleasing to me.

If it was written by me it would be:

  t.rotate(angle, around);
would also have something more meaningful instead of t unless the scope is very small.
Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by alfu on Saturday December 18, 2021 @11:04AM (#29605487)
Why not compare it with t.rotate(rotateBy, around)? Could a,v used for many purposes and this example allows us to indicate their role for this specific call?
Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by Jtsummers on Saturday December 18, 2021 @11:05AM (#29605503)
Because a and v would be more typical variable names than rotateBy and around. Note that the author did not change the variable names in the translation process, they left them alone. So you could drop any variable in there but the calling of rotate becomes clearer (subjective) by switching to keywords and no longer relies on programmer discipline to have good variable names.

And yes, they probably could be used for other purposes. The names are mnemonics for "angle" (a) and "vector" (v). How you arrive at them and what you'd use them for could easily vary across a system.

Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by msbarnett on Saturday December 18, 2021 @01:48PM (#29607286)
Because those are names the caller decided upon, so they can just as easily misinform the reader as correctly educate them. The caller could have mistyped the call as

     t.rotate(around, rotateBy)
and the error in the effect might seem very mysterious indeed. The beauty of keyword args is that the mapping of caller's name to function argument name is explicit, and therefore reads correctly or incorrectly immediately at the callsite

     t rotateBy: point around:degrees
is obviously an error, without sending the reader to look up the definition.

Compiler-enforced clarity rather than relying on every individual piece of client code to always name things well & never make a mistake.

Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by zeroimpl on Sunday December 19, 2021 @03:55PM (#29618296)
[t rotateBy: a around: v] // This is Objective-C

I’ve never seen Smalltalk before, but I did find the verbose syntax of ObjC had some benefits.

That being said, typical C programmers don’t add all that whitespace, so the “who needs dots” and stuff is a bit misleading.

Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by lelanthran on Sunday December 19, 2021 @03:41AM (#29612408)
Okay, now do something that's fairly readable in non-smalltalk syntax:

t.rotate(a, v).translate(x, y).scale(w, h);

A better way to remove all the "who needs X" is s-expressions. At least then you are left with something that composes a little bit.

Re:I can read C++ and Java but I can’t read Smalltalk (2000)... by ErikCorry on Saturday December 18, 2021 @05:07PM (#29609033)
In Toit, which is in some ways a Smalltalk dialect that would be:

t.rotate a v

Alternatively if the rotate method uses named args:

t.rotate --by=a --around=v

(See toitlang.org).