News for hackers. Stuff that matters.
Re:The March of Progress (in programming language syntax :) by lclarkmichalek on Saturday May 12, 2012 @12:00PM (#3964229)
None of these are syntax. `printf` in C or scala/groovy is a function call, which relates to the language's API, the C++ use of streams is an API decision, Java being funky is due to its API (and its semantics to a lesser extent). The only language I can think of off the top of my head where print would be syntax would be python, and even then 1) that's only for versions <=2, and 2) the formatting would still be an API choice.
Re:The March of Progress (in programming language syntax :) by astrobe_ on Saturday May 12, 2012 @12:42PM (#3964402)
printf/scanf do have a syntax. But you're not wrong saying it is not part of the syntax of the language stricto sensu.

I personnaly don't like the printf/scanf style, which unfortunately often prevails in newer languages. I definitely prefer the string interpolation method, or just plain string concatenation.

Re:The March of Progress (in programming language syntax :) by lloeki on Saturday May 12, 2012 @05:21PM (#3965161)
> I definitely prefer the string interpolation method, or just plain string concatenation.

You're mixing things up; the point of printf is to format data, of which "%s / %s / %s" is a subset. Constructs like "0x%04x" or "%12s" really are about formatting.

Re:The March of Progress (in programming language syntax :) by jasomill on Saturday May 12, 2012 @08:34PM (#3965633)
Yes, but they're often used for "mere" interpolation, especially in languages where, rightly or wrongly, string concatenation is believed to be inefficient. I personally do this nine times out of ten, if only out of habit.

For my part, I've never personally liked the use of "+", in particular, to denote concatenation, for the (admittedly silly) reason that string concatenation is not commutative. If nothing else, it's a bit of a slippery slope to even more dubious operator overloads, though not nearly so much as C++'s bloody I/O "operators"!

Re:The March of Progress (in programming language syntax :) by lloeki on Sunday May 13, 2012 @04:41AM (#3966408)
It's not uncommon to use + for groups even if they're not abelian, esp. with near-rings.

This takes all its importance with duck-typing, as syntactic sugar of binary operators will be translated to a method call, e.g in Ruby a + b becomes a.+(b) [0]. while in Python it's a.__add__(b) [1]. The result might be commutative, but the call and evaluation order certainly is not.

[0] http://ruby-doc.org/core-1.9.3/Fixnum.html#method-i-2B [1] http://docs.python.org/reference/datamodel.html#object.__add...