Hacker News new | ask | show | jobs
by saagarjha 2487 days ago
> For instance, people don't do OOP or FP using C.

Oh, but they do. It’s just that their syntax is awful.

2 comments

> It’s just that their syntax is awful.

I want to expand a bit on that. In the evolution of D, I have a front row seat on how people use it. It's hard to downplay how relatively minor syntactical changes can have a heavy influence on the programming paradigms people select. It's startling.

People will often say "but I can do that, too, in my favorite language X", and they are correct. But they don't actually do it in X because it's inconvenient.

For example, D has a built-in syntax for unittests. That gets pooh-poohed a lot as being pointless. But it's hard to argue with how transformational that has been for D programs. People expect unittests when writing D code. They didn't before. Unittests often occupy more lines of code than what they tested. The addition of a very minor bit of syntactic sugar changed the whole way people write D code.

Yes, I've seen OOP etc. done in C. As you say, it's awful, and so people don't do it. People devise their algorithms and data structures in ways that work smoothly with the language's features.

I'm sure you can compute sine and cosine tables using Roman numerals, too. But it would be so awfully ugly and tedious it's hardly a surprise that few would consider attempting it.

> I'm sure you can compute sine and cosine tables using Roman numerals, too. But it would be so awfully ugly and tedious it's hardly a surprise that few would consider attempting it.

Ptolemy’s table of chords was calculated in base 60 (inherited from Mesopotamians), by probably a Roman citizen living in Egypt and writing in Greek.

It was probably done on some kind of a counting board analogous to the ones used for decimal calculations. Hellenistic mathematicians didn’t do written arithmetic either.

And yes, making such tables is inherently “awfully ugly and tedious”, unless you have an electronic calculator to do it for you.

Yeah, I've seen that table. It was just a few entries, if I recall correctly. Few enough that one could have gotten the numbers by using drawings instead of calculation. And there were errors in it, too.

> And yes, making such tables is inherently “awfully ugly and tedious”,

Yup, but people did make such extensive tables long before calculators, many thousands more entries than that chord table, and far more accurately.

Ptolemy’s table has the chords for every possible angle in ½° increments (360 table entries in all), to 3 sexagesimal digits of precision, or about 5.5 decimal digits of precision. It also had an additional column showing the derivative of the chord function at each ½° at 5 sexagesimal digits of precision, for use interpolating at arbitrary angles in between the listed ½° increments. https://en.wikipedia.org/wiki/Ptolemy%27s_table_of_chords

You might be thinking of Hipparchus’s table (from a few centuries earlier) which only had multiples of 7½°.

> You might be thinking of Hipparchus’s table

Sounds like it.