Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
It's about time, honestly. 🤣
I will never understand the mentality that answers the question, "hey, how about we let the machine tell you when you're about to run into a predictable failure because of the intent your code conveys," with, "I'd prefer not to." -
@SortOfTested Yeah, with modern type inference there really isn't any argument left for dynamic typing
-
hitko30055yToo late. Those who care moved on a long time ago, and those who don't aren't going to use it anyway.
-
@iiii Nah, duck typing essentially *is* weak typing and both are horrible
Just because I have a method next() doesn't make me an iterator. The only entity that can judge whether I am is a human able to read and interpret the documentation which contains vital semantic information not expressible in code -
@iiii
I think he's just discriminating between duck typing and structural typing. Duck typing checks occur at runtime, structural typing performs the same check at compile time. -
@iiii @SortOfTested I don't like duck/structural typing whether it happens at compile time for this reason:
A method signature does not hold enough
semantic information to judge compatibility
Can next() return null? Can it return not-null after it returned null? Does it throw exceptions? When? Does it have any significant side effects?
These are things that you can't express in a signature yet are vital to robust code -
@iiii Duck typing and weak typing are very similar though
Weak typing does implicit conversion while duck typing does implicit interface implementation (for lack of a better term). But in both cases your values are implicitely coerced to different semantics -
@iiii Weak typing: A string can magically act like a number
Duck typing: My object can magically act like an iterator
In what world are these not similar ideas? -
@iiii My object -- which does not explicitely have the interface Iterator implemented -- magically implements that Interface because it has matching methods
It IS magic because it happens at a distance without your control. That's literally what that means
And this is exactly what I'm critiquing, and what I have explained twice now but what you have conveniently ignored both times
**A method signature does not hold enough semantic information to deduce compatibility** -
@Z-GOD That's the downside of a badly designed language. When you actually try to fix it (like they do, let's be fair) you HAVE to break backwards compatibility in a major way
-
@iiii Yes, but the problem I'm getting at is that in one case you are explicitely and positively asserting that your class follows the iterator interface semantics as required in the docs, where as in the other case it's just implicitely assumed that it'll be alright because the method signatures happen to match
-
@SortOfTested I’ve never heard a more spot on statement about the strange mentality of proponents of weakly typed systems :D
Very nice!
Related Rants
-
dfox45
Hey everyone, First off, a Merry Christmas to everyone who celebrates, happy holidays to everyone, and happy ...
-
Korvax31Italian chef: We have the best spaghetti in the world PHP developer: I doubt that
-
v-vp16windows update code function update(){ print("10%"); print("30%"); print("50%"); print("99%")...
I like how it's lowly becoming more and more a typed language.
Anyway, nice updates, but don't really see much changes overall
https://php.net/releases/8.0/...
random
php8.0
php
update