News for hackers. Stuff that matters.
Re:Programming as a Way of Thinking by runeks on Monday May 01, 2017 @01:34PM (#14239612)
The variables named 'anything' can represent anything, that's the point. Are you saying we should avoid writing code that's too general?

I understand that not all languages are powerful enough to allow defining functions that can operate on any type. But this doesn't mean that languages with this expressive power should refrain from using it; it means that users of less powerful languages need to learn something new (as I had to).

Re:Programming as a Way of Thinking by gbrown on Monday May 01, 2017 @02:18PM (#14240020)
That would create incredibly verbose code, which would be very hard to parse (IMHO).
Re:Programming as a Way of Thinking by throwawayjava on Monday May 01, 2017 @02:39PM (#14240237)
Exactly the opposite. Typed languages without parametric/generic code result in extraordinarily verbose and bug-prone code. You end up constantly casting to/from void* or Object.

That's why all popular typed languages after C provide a facility for writing parametric code.

And without exception, the standard libraries for those languages using single-variable names (S,T) for types. Because when you have 1-3 type variables, and you're writing generic code, "Type" doesn't really communicate anything that "T" doesn't.