News for hackers. Stuff that matters.
Re:The Advantages of Flexible Typing by lolinder on Sunday September 05, 2021 @10:13AM (#28424488)
I have a hard time imagining that TCL would not have the same problem that PHP, Python and JavaScript have with types. If you're trying to add a string and a number, the language has to either throw an error or implicitly turn that into concatenation, propagating the string to more expressions that expected a number. At a cursory glance, it looks like TCL throws an error.

In that case, I can't imagine writing any significant amount of TCL and not having reached a point where you have a runtime error that would have been prevented had you had a static type system.

Am I missing something?

Re:The Advantages of Flexible Typing by kbr2000 on Sunday September 19, 2021 @03:51AM (#28582516)
I'd say the idea is that the implementation of a command/procedure needs to do the checking. In your example, arithmetic addition is usually provided by expr [0], which checks the expression it is fed before trying to calculate anything.

When you would like to concatenate strings (including numbers), you would use quoting or commands/procs made for that purpose instead.

[0] https://tcl.tk/man/tcl/TclCmd/expr.htm

Re:The Advantages of Flexible Typing by massysett on Sunday September 05, 2021 @03:07PM (#28426842)
My guess is that Dr. Hipp’s (SQLite author) meticulous and prolific use of testing ferrets out so many bugs that the ones that are left wouldn’t be caught by static typing.

In contrast, folks who rely heavily on static type systems may not write so many tests. For example I put more energy into making sure that my Haskell types capture the problem I’m trying to solve, so that the compiler flags my mistakes and exposes poor assumptions.