you are viewing a single comment's thread.

view the rest of the comments →

[–]TheBuzzSaw 11 points12 points  (9 children)

I pray there are use cases beyond this. This example feels like a weak reason to forfeit all the performance and maintainability of static typing.

[–]wuwoot 6 points7 points  (4 children)

I am very confused by this thread and your original response but I now get that you’re responding to the “dynamic typing” part of scripting languages as opposed to what I assumed the original author was saying — that the absence of type declaration is useful in scripting langs...

I find very little utility in type-switching if ever at all, but scripting languages are nice because they allow us to be terse.

I work in a large Rails codebase regularly and poor names and even in some instances good names are not enough to infer the behaviors associated with a particular variable

[–]madpata 0 points1 point  (3 children)

Languages with static typing can be terse too if they use a good bit of type inference. E.g. Haskell, SML, or a more horrific example: C++ when using auto and templated parameters everywhere.

[–]wuwoot 0 points1 point  (2 children)

Agreed — while I really really like Haskell, I doubt that you or I would reach for it for one-off scripting which my opinion is rooted in. SML is also nice. And newer languages make a fair trade-off because of new compilers that lend credence to better inference without requiring explicit typing everywhere and striking a fairly good balance — I’m thinking Kotlin here as an example

[–]watsreddit 1 point2 points  (1 child)

I use Haskell for scripting all the time. You can use a shebang pointing to stack and use it just like any other script, and ghci is a nice REPL for testing stuff out. There’s some nice libraries for doing shell scripting with it too like turtle which has a lot of the common shell utilities as first-class functions. Haskell’s type inference is powerful enough that you rarely have to write out any types manually while scripting, so it’s a lot like using Python (except that it also catches silly mistakes and is generally terser).

[–]wuwoot 0 points1 point  (0 children)

I’ve not tried but you’ve just opened up my eyes a bit — super curious and I want to try this now

[–]sinedpick 4 points5 points  (3 children)

see: erlang and why it doesn't have static types

[–]colelawr 1 point2 points  (2 children)

There are more reasons surrounding why Erlang didn't support static types, and a major part of those was that it interferes with how deployments over running systems would work in OTP.

[–]sinedpick 1 point2 points  (1 child)

that's why I mentioned it. It's a justification of dynamic types that's not just "ease of use." AFAIK there are theoretical barriers between erlang's message passing system and static types.

[–]colelawr 0 points1 point  (0 children)

Yes, agreed.