Noob: don't understand usage of curly brackets in if-statement

It’s a different perspective on the same thing… is it “a method call that has been optimized to inline the functions” or is it “a control structure masquerading as a method call”?

IMO (opinion) the baseline implementation for branching and looping in SC is via method calls with function arguments. By “baseline” I mean that you could remove all of the inline-optimization from the compiler, so that every looping and branching keyword compiles to a standard method call, and SC would behave exactly the same (just, slower).

(
var x = 0, y = 4;

{
	if(true) {
		var random = rrand(1, 10);
		x = x + random;
		y = y + random;
	}
}.def.dumpByteCodes;
)

BYTECODES: (7)
  0   6C       PushSpecialValue true
  1   04 00    PushLiteralX instance of FunctionDef in closed FunctionDef
  3   B0       TailCallReturnFromFunction
  4   C2 0B    SendSpecialMsg 'if'
  6   F2       BlockReturn

Some such constructions are inlined for speed, specifically those where the functions passed as arguments 1/ are literal functions and 2/ don’t declare local variables or arguments. (In practice, this covers most uses of if, while, case and switch.) I personally don’t think it’s entirely accurate to say that SC’s if is a C-style control structure that is sometimes compiled as a method call with arguments.

But I also recognize that we are looking at the same Rubik’s Cube from different angles, and just seeing different colors.

hjh