News for hackers. Stuff that matters.
Re:Why I still Lisp by AQXt on Sunday January 31, 2021 @11:30AM (#25979940)
> What thing that violates a type check would be "perfectly fine to do"?

A typical example, in dynamic programming languages, is to treat numbers as strings and vice-versa; evaluate lists in boolean context; and so on.

> If value is not a numeric type, square is not going to be happy. And that's the case with most (all?) dynamic code.

Some programming languages will be glad to accept a string and treat it as a number -- see Duck Typing (https://en.wikipedia.org/wiki/Duck_typing).

Re:Why I still Lisp by adwn on Sunday January 31, 2021 @01:29PM (#25981194)
> A typical example, in dynamic programming languages, is to treat numbers as strings and vice-versa

That sounds great until it bites you in the ass really hard. In general, you want to catch unintended behavior as early as possible.

Re:Why I still Lisp by astrange on Sunday January 31, 2021 @07:17PM (#25984087)
You want to, but they don’t. Those people just want to get stuff done, as opposed to a language like Haskell or stricter where you’ll never be able to get old code to run because newer compilers print errors that take a week to understand. There’s some old Yegge articles about this…

PHP converting between strings and numbers is usually a mistake, but the one data structure doing everything (array and dict) is nice enough.

Re:Why I still Lisp by bjoli on Monday February 01, 2021 @03:47AM (#25986820)
I don't think that is necessarily a dynamic language thing: that seems like your regular ad hoc polymorphism. Pascal allows it, IIIRC. So does C#. Being able to use a function on different kinds of arguments is orthogonal to the typing discussion.

Scheme, for example, is dynamic yet very monomorphic. You have length (working only on lists), string-length, vector-length, bytevector-length etc.

Re:Why I still Lisp by smabie on Sunday January 31, 2021 @12:07PM (#25980311)
that sounds really awful, not "fine."
Re:Why I still Lisp by ArchieMaclean on Sunday January 31, 2021 @11:58AM (#25980201)
Can you give an example of where doing this is useful?