News for hackers. Stuff that matters.
Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Tuesday June 20, 2017 @10:22AM (#14594834)
I'll bet he starts to care if floating point arithmetic introduces errors into his results. You can only push off the complexity for so long if you want to do things that aren't trivial.
Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @10:33AM (#14594920)
Can you think of a (non-contrived) example where automatic promotion to float is going to cause a non-trivial error when computing (say) a household budget?

"You can only push off the complexity for so long if you want to do things that aren't trivial."

There are a lot of things that aren't "trivial" that nonetheless don't require a totalitarian type system.

Re:Why Python Is Not My Favorite Language (2016) by lmm on Tuesday June 20, 2017 @12:10PM (#14595791)
> Can you think of a (non-contrived) example where automatic promotion to float is going to cause a non-trivial error when computing (say) a household budget?

Having your share of holiday costs come out as NaN is fiddlier than getting an exception at the point where you actually divided by zero.

Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @09:31PM (#14599972)
Both of those are runtime errors, though.

The "type safe" guys like to pretend that their approach can catch all that stuff at compile time. It does catch a certain class of error, but at the cost of making the code take much longer to write. That doesn't work in a world where your competitor is iterating five times while you're still building the first one. Excellent way to get your milkshake drunk, that.

Re:Why Python Is Not My Favorite Language (2016) by lmm on Wednesday June 21, 2017 @04:07AM (#14601835)
> Both of those are runtime errors, though.

Sure, the point is that using integer arithmetic for integer calculations gets you better error reporting that saves you time when tracking odwn other bugs.

> The "type safe" guys like to pretend that their approach can catch all that stuff at compile time. It does catch a certain class of error, but at the cost of making the code take much longer to write. That doesn't work in a world where your competitor is iterating five times while you're still building the first one.

My experience is that I can iterate a lot faster if the compiler's able to help me catch errors faster. It doesn't slow down writing the code; almost anything I'd write in say Python translates directly into the same Scala. (I guess the language pushes me into defining my data structures a little more explicitly, but that's something I'd want to do in Python anyway if only for documentation reasons).

Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Wednesday June 21, 2017 @09:14AM (#14603435)
Define "much longer to write." I don't think that claim is true.
Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Tuesday June 20, 2017 @10:43AM (#14595000)
Isn't the biggest non-programmer audience who has any interest in writing Python scripts scientists? I don't think it's totally contrived to imagine that floating-point precision is an issue in such cases.
Re:Why Python Is Not My Favorite Language (2016) by sametmax on Tuesday June 20, 2017 @11:13AM (#14595214)
Fun fact: half of the professional programmers I met in my life don't even try to do anything for floating point precision issues.

You are living in your bubble. The bubble of people who knows what they are doing.

Get out, you'll be surprise how much amateurish the world is.

Yet it runs.

Re:Why Python Is Not My Favorite Language (2016) by KirinDave on Tuesday June 20, 2017 @01:53PM (#14596864)
I'm really not a fan of this argument. No one is arguing for a banishment of the concept of a competency PMF. We're just saying, "If you use these newer techniques and tools and patterns, you get more bang for your buck."

The common response is, "But then I have to learn something new." But this is the curse of technology, and pretty much inevitable. Some learning needs to occur because tech changes so fast.

Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @09:27PM (#14599964)
"If you use these newer techniques and tools and patterns, you get more bang for your buck."

But you don't, necessarily. Dealing with type wankery takes time. And no, it has nothing to do with "learning something new". Languages that tout "type safety" have been around since at least Pascal (47 years old)... arguably even before that, with some of the Algol variants.

Yet they've never made it to mainstream acceptance. It's not even about hype -- Pascal was pushed HARD, by just about every university. Where is it now? Turbo Pascal had a small degree of success, but that's only because it chucked a lot of real Pascal's rigidity out the window.

Re:Why Python Is Not My Favorite Language (2016) by KirinDave on Tuesday June 20, 2017 @09:43PM (#14600014)
So... Can you clarify this? "Pascal is no longer popular. Pascal had a static type system. Therefore, static typing has failed?"

If so, I counter: the last 3 years have been a series of breakthroughs both in terms of technology and social acceptance of typed programming. TypeScript is the rapidly growing language, Haskell's never been more boring to use, Scala's edging out Clojure even though it has very fragmented community leadership. C++ has adopted a lot of powerful new features and you're seeing functional programmers speaking at C++ conferences because the folks there can use it. Java has more capable and composable lambdas than Python.

Systems not using these techniques are plagued by security flaws, while those that are work on stabilizing performance under various workloads.

It's never been a better time to be using a strong, static type system..

Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @09:59PM (#14600090)
"Can you clarify this? "Pascal is no longer popular. Pascal had a static type system. Therefore, static typing has failed?""

I would make it "Pascal was never popular", but yes.

"If so, I counter: the last 3 years have been a series of breakthroughs both in terms of technology and social acceptance of typed programming."

This isn't the first rodeo for many of us. "Compile-type static type checking will solve all of our problems" is an idea that's come around repeatedly. Outside of a few niche applications, it never works, or even catches.

As for the supposed booming popularity of TypesScript... dude, TypeScript doesn't even make the top 30 on GitHub. It's less popular than assembly language and Visual Basic.

Re:Why Python Is Not My Favorite Language (2016) by KirinDave on Wednesday June 21, 2017 @01:06AM (#14600805)
> I would make it "Pascal was never popular", but yes.

Then why... why bring it up? Should I discount all of dynamic typing because Io and Pike never took off? C++ did stick around, Oak became Java. APL is still in active use.

> This isn't the first rodeo for many of us. "Compile-type static type checking will solve all of our problems" is an idea that's come around repeatedly. Outside of a few niche applications, it never works, or even catches.

"It never works" is a pretty bold claim given that the majority of code you interact with on a daily basis has SOME sort of type system. I'd say C++ is better endowed than most in this dimension.

> As for the supposed booming popularity of TypesScript... dude, TypeScript doesn't even make the top 30 on GitHub. It's less popular than assembly language and Visual Basic.

My dude it would be extremely suspicious if it did. Instead, look at the growth stats: https://octoverse.github.com/. It's the fastest growing language that has non-trivial presence on github (and of course, that's the correct way to phrase it, a new language appearing can appear to have quadruple-digit growth percentile).

This seems profoundly disingenuous. Is that your intent?

Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Tuesday June 20, 2017 @10:05PM (#14600114)
Have you ever heard of an obscure language called Java?
Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @10:53PM (#14600314)
Yeah, I have. Java is notorious for tossing 30 page runtime exceptions all over the place. Given that the alleged advantage of getting type happy is to prevent runtime errors, can you explain how Java actually supports your case?
Re:Why Python Is Not My Favorite Language (2016) by KirinDave on Tuesday June 20, 2017 @11:17PM (#14600394)
Are you mad at the existence of stack traces? Would you prefer it if the errors were unsourced? Are we pretending Python does it better or even that differently?

As for "the case", Java does reduce the # of NPEs you get by not letting you deref invalid keys on objects, and it makes it easier to handle objects in the abstract.

Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Wednesday June 21, 2017 @09:18AM (#14603465)
Well, for one, the post I was responding to claimed that no language touting type safety had ever caught on, and yet there is Java, likely the most used programming language on Earth next to C and C++ (which themselves offer some level of type safety).

But moving on to your claim in this post, nobody ever said "compile-time checks eliminate errors altogether." What they do do is reduce errors and completely eliminate certain classes of errors. They also make maintenance and debugging much easier because they define clear expectations for the interfaces of their arguments and return values. The length of stack traces is a completely orthogonal concern.

Re:Why Python Is Not My Favorite Language (2016) by emodendroket on Tuesday June 20, 2017 @12:13PM (#14595815)
Yes, everything looks like it works, but occasionally it's completely wrong. I don't think just chugging along is desirable in all circumstances. But even if I accept your premise, that just says to me that Python is a good choice for people who don't really know how to program and don't care to learn too much.
Re:Why Python Is Not My Favorite Language (2016) by Turing_Machine on Tuesday June 20, 2017 @11:29AM (#14595351)
Floating point precision isn't even a problem for most scientists, at least not the ones dealing with real-world data.

It's pretty rare to have measurements that are accurate to more than a few decimal places.

Re:Why Python Is Not My Favorite Language (2016) by KirinDave on Tuesday June 20, 2017 @01:43PM (#14596741)
Yes, we had non-trivial floating point errors in Level that appeared after multiple divide operations in an early version of the product. We stopped using it.