News for hackers. Stuff that matters.
Re:Pyre: Fast Type Checking for Python by grumpyprole on Friday May 11, 2018 @02:57PM (#17049949)
> When developing, you don't necessarily know about your types yet.

This is absolutely not true for myself and my coworkers. We think in types first. Typically we write out high-level functions with type signatures and make sure they all fit together and everything type-checks. Then, we'll fill in the detail and actually implement the functions. Often this process is recursive and we need to repeat it until we get small functions that are either easy to implement or available in a library. We have a type-based search tool to facilitate finding such library functions. Sometimes there are problems and alternative abstractions that only come to light when filling in the details. When a large re-organisation of code is necessary, types again help to get this right.

Personally, I could never build a non-trivial piece of software in a dynamic language. Perhaps I just don't have the brain power to track the types manually in my head.

Re:Pyre: Fast Type Checking for Python by crdoconnor on Friday May 11, 2018 @04:21PM (#17050532)
I develop making heavy use of behavioral tests, REPL and sanity checks.

I don't worry too much about tracking types in my head because with a test and REPL I can quickly and trivially spin up and inspect to the minutest level of detail almost any line of code in a runtime state, use autocomplete, etc. and write reliable snippets of code with a near instantaneous feedback loop - getting instant feedback not just on an object's type and its properties, but on what it actually does when it is run.

Usually when developers used to a statically typed language switch to a dynamically typed language changing their style of development does not occur to them simply because the economics are so different to what they are used to - they rely heavily on IDEs with autocomplete, etc. (which, in statically typed language provides instantaneous feedback) and are used to long compile/test feedback loop and REPLs that are poor to non-existent.

In practice this means a lot of them don't think to go looking for potentially better forms of instantaneous feedback that are more readily available in dynamically typed languages but will kvetch because the one they are used to is suddenly unavailable... ;)

Re:Pyre: Fast Type Checking for Python by Karrot_Kream on Friday May 11, 2018 @04:44PM (#17050661)
Static types mean that you never have to write behavioral tests. If you're writing behavior tests, you're just writing a very verbose subset of the same guarantees that types offer instantly.

Moreover, running code snippets in a repl only help if your codebase is small and you're designing it mostly alone. 3 months later, when someone needs to add a new feature and they call your function with incorrect assumptions (sending a dictionary with missing keys for example) then you'll have something that can work in the happy path, but doesn't work around the edge cases. I've seen behavioral tests try to address this, but again, that's just an inferior form of typing.

Re:Pyre: Fast Type Checking for Python by tigershark on Saturday May 12, 2018 @12:21PM (#17054737)
REPL are not confined to dynamic typed languages. Using a better programming language you won’t have any need for a lot of your tests.
Re:Pyre: Fast Type Checking for Python by crdoconnor on Sunday May 13, 2018 @02:49PM (#17060321)
>Using a better programming language you won’t have any need for a lot of your tests.

I know of no type system that can acts as a reasonable substitute for a well written integration test. How exactly is your type system going to provide a reasonable assurance that my code will work as expected with an upgraded database, for example?

They can substitute sanity checks and poorly written low level unit tests that should really have been sanity checks. I've seen nothing more impressive than that.

I've heard rumors of the amazing things you can do with haskell's type system and the old chestnut that "if it compiles it works" but in practice the one piece of software I use in haskell is, at best, averagely buggy.

Re:Pyre: Fast Type Checking for Python by hindsightRegret on Friday May 11, 2018 @04:51PM (#17050701)
Agreed 100%. For quick one-off scripts and coding interviews, I have no qualms with using python. But maintaining api input/output guarantees in a large piece of software w/o explicit typing sounds like a huge pain to me.
Re:Pyre: Fast Type Checking for Python by scarface74 on Friday May 11, 2018 @09:03PM (#17051875)
I spent the first 12 years of my career doing 80% C and C++ and a little Perl on the side and the last 10 years doing C# with a little PHP. Of course I've had to do some JavaScript. My experience with dynamic languages completely turned me off of them.

But recently, I was forced to learn Python. I have to admit that Python is joy to use for small scripts and event driven AWS Lambda functions, but I would still use C# for any large projects.

I can't put my finger on why Python+Visual Studio Code is such a joy to use compared to my previous experience with dynamic languages.

Re:Pyre: Fast Type Checking for Python by halbritt on Friday May 11, 2018 @03:16PM (#17050097)
That's kind of the thing, though: Folks are using python to bang out trivial pieces of software all the time. Dynamic types are great for that.

Occasionally, those trivial pieces of software become non-trivial, in which case, having the ability to refactor with type hints is a good thing vs. a complete rewrite in a strongly typed language.

Re:Pyre: Fast Type Checking for Python by paganel on Friday May 11, 2018 @03:46PM (#17050325)
> Folks are using python to bang out trivial pieces of software all the time. Dynamic types are great for that.

And I think that's ok, because (imho) 90%-to-95% of the code written right now falls under the "trivial" label.

Re:Pyre: Fast Type Checking for Python by willtim on Friday May 11, 2018 @04:19PM (#17050517)
Some large investment banks are writing millions of lines of non-trivial code in Python. Perhaps because management heard it was "strongly typed".
Re:Pyre: Fast Type Checking for Python by scrollaway on Friday May 11, 2018 @11:44PM (#17052374)
Or perhaps because they invested a lot of research and figured Python was the best tool for what they set out to do.

You really should stop with the FUD in this thread, it's unconstructive and getting really annoying. We get it, you don't like Python.

Re:Pyre: Fast Type Checking for Python by willtim on Saturday May 12, 2018 @02:48AM (#17052827)
It's not FUD if someone posts an opposing viewpoint. My point was that some of the terminology used in this community is rather disingenuous. Python has a lot of strengths, but let's also be honest about its weaknesses.
Re:Pyre: Fast Type Checking for Python by acdha on Saturday May 12, 2018 @08:00AM (#17053632)
So far you haven’t had a good track record of making statements which are factually correct and detailed enough to discuss. If you want to contribute anything of value to the conversation try making a longer comment which explains in detail precisely what you believe is a problem and why it matters so much that you’re willing to accuse a popular open source community of making false claims.

So far I’ve seen one concrete example from you (the SQL/file path one) which is either the same in every other language (if you store them as generic strings) or prevented by Python’s type system (if you use non-generic types).

Re:Pyre: Fast Type Checking for Python by willtim on Saturday May 12, 2018 @11:30AM (#17054487)
I posted a link by Professor Robert Harper, I guess you didn't read it. This has been a discussion about terminology, so I'm not sure you can claim anybody is factually incorrect.
Re:Pyre: Fast Type Checking for Python by acdha on Saturday May 12, 2018 @11:51AM (#17054610)
That guess would be incorrect. I would suggest that you stop disparaging other people and try to clearly articulate the point you are trying to make in enough detail to be discussed.
Re:Pyre: Fast Type Checking for Python by willtim on Saturday May 12, 2018 @12:29PM (#17054773)
As I said, the link I posted contains the detail. If you've read it then perhaps you'd care to comment on it instead of posting successive personal attacks. I suggest that you not take my opinions (or Harpers) so personally.
Re:Pyre: Fast Type Checking for Python by naasking on Friday May 11, 2018 @11:55PM (#17052401)
Let's be real, probably 99% of projects just use a language that the main developer is already familiar with. Social and economic realities often trump technical merit, which is why inferior technology has such inertia long past the time when better replacements are available.
Re:Pyre: Fast Type Checking for Python by pjmlp on Saturday May 12, 2018 @02:30AM (#17052769)
Banks also do lots of critical business decisions in Excel, sanity is not always their strongest point.
Re:Pyre: Fast Type Checking for Python by singingfish on Saturday May 12, 2018 @07:12AM (#17053499)
s/Occasionally/Frequently/

I made a temporary kludge around 10 months ago whose time to live was supposed to be a few weeks. Guess what happened to that? I am definitely looking forward to retiring it mind you.