3 ms·
And yet he doesn't care about type systems, which are largely implemented to help with optimization, you see.
by cjfont 13y ago
And yet he doesn't care about type systems, which are largely implemented to help with optimization, you see.
- vanderZwan 13y agoThat's arguable - I hear more people talking about how types reduce bugs in code than how it improves performance. Besides, that's one of the three examples he mentioned, and the the other two are not features involved with said optimisation.
- rodgerd 13y agoWell, it certainly optimises my ability to get shit done if I don't waste it on subtle type-conversion debugging.
- vanderZwan 13y agoHah! Agreed.
- exDM69 13y agoI don't know if this an argument for or against static typing and type safety but there are two sides to this coin. In dynamic programming languages it is definitely easy to get shit done, at least initially. However as a project progresses to the point where a lot of refactoring takes place and there's more than a handful of people working on it, a good static typing language will make sure that shit keeps on getting done and things won't break due to a subtle typing error. Things will be caught by the compiler even before you get running the test suite.
- eonil 13y agoI agree. In other words, automatic program-correctness check is a crucial feature if project goes larger. And type check is actually one of the simplest, easiest and fastest way to archive that. But most dynamic languages doesn't provide type-check. Really sad. Adding type annotation on dynamic language is a kind of best mix of two worlds, and Julia seems pushing this approach even further - JIT static types from type annotation.
- steveklabnik 13y agoThat's a strong vs. weak issue, not a static vs dynamic issue. irb(main):001:0> 1 + "hello" TypeError: String can't be coerced into Fixnum from (irb):1:in `+' from (irb):1 from /usr/bin/irb:12:in `<main>'
- lmm 13y agoStatic prevents type errors from propagating, which is particularly important when using generic functions. In ruby you can have a type error four functions back pass silently until you do something ungeneric with it, which makes debugging harder than it should be.
- tych0 13y agoReally? My impression is that it's largely correctness.
- spullara 13y agoVirtually every optimization even dynamic languages make are about narrowing down exactly what the type something is and which method that is called at runtime. At that point you can do things like inlining and other high powered optimizations.
- Skywing 13y agoBut that allows for smarter optimizations.
- tych0 13y agoOf course it does, and I never said it didn't. I just said that my impression is that the primary motivation of language people is correctness. However, I have published several in the area of software verification, so perhaps I am biased.
- octo_t 13y agoThere are plenty of optimizations that are only available when you know the types of the objects you're dealing with (mostly relating to aliasing). See: http://scholarworks.umass.edu/cgi/viewcontent.cgi?article=1007&context=cs_faculty_pubs&sei-redir=1&referer=http%3A%2F%2Fscholar.google.co.uk%2Fscholar%3Fq%3Dstatic%2Btype%2Boptimisations%26btnG%3D%26hl%3Den%26as_sdt%3D0%252C5#search=%22static%20type%20optimisations%22 http://scholarworks.umass.edu/cgi/viewcontent.cgi?article=10...