Php 8 novedades8/23/2023 If it worked sanely, then x = true || x = false would always evaluate to true (or, rarely, throw). But that makes the second thing you want impossible: If you want an associative =, you need every such type conversion be an injection. This obviously makes = non-associative (as you can have a=b and b=c without a=c, example: '0', 0, and '00'). Other type combinations are considered unequal (you can think of it as a cast to a theoretical disjoint union type) Null and undefined are compared as equal (you may think of it as a cast either way) String and object are compared as strings Number and string are compared as numbers Objects are complicated.į x = y were interpreted as castToTypeZ(x) = castToTypeZ(y) where Z is some built-in typeīoolean and number are compared as numbersīoolean and string are compared as numbers So is positive infinity and negative infinity. Also, NaN is a valid value in some languages for double / floats. My takeaway is that API documentation is important. My assumption was that if the return value was undefined, the API would return nil / null for the optional - however the API actually return a float value of NaN. The API return value was not well documented. I recently came across an ambiguous API that returned an optional float / double. With numbers there is some ambiguity - especially if the language allows. however, I am of the opinion that optionals are the solution to all problems in this scope). I understand introducing a modern concept like optionals into a prehistoric language like PHP would be next to impossible. If you are making large language changes, why not introduce a truly awesome concept like optionals? Are you interested in promoting your own content? STOP! Read this first.For posting job listings, please visit /r/forhire or /r/jobbit.Do you have something funny to share with fellow programmers? Please take it to /r/ProgrammerHumor/.Do you have a question? Check out /r/learnprogramming, /r/cscareerquestions, or Stack Overflow.Direct links to app demos (unrelated to programming) will be removed.If there is no code in your link, it probably doesn't belong here. Just because it has a computer in it doesn't make it programming.That means no image posts, no memes, no politics.Please keep submissions on topic and of high quality.r/programming is a reddit for discussion and news about computer programming
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |