News for hackers. Stuff that matters.
Re:Cold Showers by maleldil on Saturday June 18, 2022 @09:35PM (#31795358)
How would a "language engine" know what you can do with `item` if it has no type information?

You can do that with Python (sometimes) because many libraries have type hints today, so even if you don't use types yourself, the type checker can infer them in your code and help you out.

Re:Cold Showers by falcolas on Saturday June 18, 2022 @11:56PM (#31796030)
Is this a serious question? Code analysis (both static and dynamic).

The same way Rust checks for object lifespans with the borrow checker, which is distinct from the compiler and type system.

The same way valgrind for C can check for use after free.

The same way errorprone can look for null checks in Java.

This is a well tested and proven technique. Static code analysis is a staple of the industry, when it comes to automated code analysis.

Re:Cold Showers by maleldil on Sunday June 19, 2022 @01:11PM (#31801226)
I still don't see how you can determine an object's attributes without type information. If you're inside the function, all you know is there's a parameter named item. How can you provide autocomplete there?

All of the examples you gave are from static languages, where the information is known at compile time (except for valgrind, which requires a runtime). The parent to my original post was claiming that you can have the same tooling for Ruby.

Also, you're wrong about Rust. Lifetimes are part of the type system.

Re:Cold Showers by kazinator on Sunday June 19, 2022 @12:45AM (#31796233)
Valgrind finding use-after-free is a dynamic analysis.