|
|
|
|
|
by hamstergene
4382 days ago
|
|
You may not realize it, but it looks to me you are. The points you criticize Swift for are distinctive features of dynamic languages, e.g. to be able to: * substitute object type without recreating the object * substitute object's method without changing object's type * create a string with method name and call that method Obj-C and most dynamic languages have them; Swift and languages like C++ do not. (I understand that with full reflection and enough runtime hacking static languages can have that too — by the way, that includes Swift as it currently is; but that's a whole different discussion). In other words: if the compiler has statically (at compile time) validated types of arguments and return values of any `obj.foo(arg)` call, why would anyone possibly want anything but either a direct call to a hardcoded address, or to a pointer stored at vtable? And if the compiler has no means to validate that, that means you are down to what dynamic languages do: there has to be some code to check argument types before passing them to the code that makes hard assumptions about their types. |
|