News for hackers. Stuff that matters.
Re:Dynamic type systems are not inherently more open by amelius on Sunday January 19, 2020 @09:06AM (#22091480)
Yes, some programming languages take this approach but I don't think that prototyping is as easy in such languages as it is in a dynamically typed language (e.g. Haskell vs Python).
Re:Dynamic type systems are not inherently more open by yakshaving_jgt on Sunday January 19, 2020 @09:40AM (#22091640)
In my experience (currently writing Haskell professionally, previously writing Ruby professionally) prototyping is easier in Haskell.

How many systems have you prototyped in Haskell?

Re:Dynamic type systems are not inherently more open by dllthomas on Sunday January 19, 2020 @02:04PM (#22093187)
> prototyping is easier in Haskell

That's very much my experience, as well. Assuming - and it's a very big assumption - that your use case has equivalent library support.

Re:Dynamic type systems are not inherently more open by rwmj on Sunday January 19, 2020 @09:18AM (#22091534)
When writing OCaml, if I'm unsure of the type I set the type to some impossible value, compile it, and the compiler tells me what the type really is.
Re:Dynamic type systems are not inherently more open by hnra on Sunday January 19, 2020 @09:37AM (#22091622)
I Haskell you simply put a "_" in the annotation and the compiler suggests the correct type.
Re:Dynamic type systems are not inherently more open by dllthomas on Sunday January 19, 2020 @02:07PM (#22093218)
You can also do this with values, asking "what goes here?" - it's great.
Re:Dynamic type systems are not inherently more open by andrepd on Sunday January 19, 2020 @10:51AM (#22092017)
Alternatively, merlin can tell you the type of the expression under your cursor, besides also flagging type mismatches like your situation.
Re:Dynamic type systems are not inherently more open by hopia on Sunday January 19, 2020 @10:13AM (#22091808)
Productivity can be really subjective. Those that are used to modeling the problem domain with the type system find that their most productive approach, even with prototyping.
Re:Dynamic type systems are not inherently more open by dllthomas on Sunday January 19, 2020 @02:06PM (#22093204)
Right, and the type system is such a big help in refactoring - especially in small projects - that you don't have to be all that right in your first N cuts at the model. You can write code and find out where you're wrong, and fix it fast.
Re:Dynamic type systems are not inherently more open by pwm on Sunday January 19, 2020 @02:51PM (#22093546)
It’s even more help in larger projects :) The dividends of type-checher aid refactoring really start paying off once the project is above a a certain size/age.
Re:Dynamic type systems are not inherently more open by dllthomas on Tuesday January 21, 2020 @05:04PM (#22112161)
Yeah, I think I was unclear. Given a need to refactor, it's a bigger help on a bigger refactor.

But a large refactor on a large project is still a pain. By the time you get there, you still want your model stable and/or flexible enough that you don't need to do that much.

On a small enough project, every refactor is easy enough that you can lean into it. Make a bunch of assumptions you're not confident about, setting up the types so you're sure you'll know what needs fixing when they're wrong. Then you test those assumptions as you write - and run - more code.

Re:Dynamic type systems are not inherently more open by zitterbewegung on Sunday January 19, 2020 @09:43AM (#22091661)
What would be neat is if you could take a Python program and run type inference on the program and it would output a type annotated version of the code.
Re:Dynamic type systems are not inherently more open by duckerude on Sunday January 19, 2020 @11:35AM (#22092264)
I don't have experience with it, but pytype can do that: https://github.com/google/pytype

After typechecking it leaves provisional stubs in .pytype/pyi/, and it has a tool to merge them into the original code.

mypy has stubgen: https://mypy.readthedocs.io/en/latest/stubgen.html

As far as I know it's less powerful since mypy isn't really built for unannotated code and pytype is.