3 ms·
how does that make sense in any universe. Just because I have a function named "then" does not mean that my object is a promise. Maybe "then" is the name of a d
by jcelerier 7y ago
how does that make sense in any universe. Just because I have a function named "then" does not mean that my object is a promise. Maybe "then" is the name of a domain thing in my project, for instance a small DSL or something like that. arghhhhhh !
- krapp 7y agoIt's almost as if treating a dynamically typed interpreted language as if it had static types like C++ is fundamentally broken.
- jhanschoo 7y agoobjects with a .then(...) methods are treated as though they have Promise semantics by the language See Promise.resolve https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- LudwigNagasena 7y agoConsider it a special function like "__init__" in Python. I think this is one of the problems with duck typing, existence of a public function introduces possible name collision onto the whole codebase.