4 ms·
FWIW, static languages have added dynamic typing features as well: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/using-type-dynamic ht
by kbd 8y ago
FWIW, static languages have added dynamic typing features as well:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/using-type-dynamic https://docs.microsoft.com/en-us/dotnet/csharp/programming-g...
- jerf 8y agoBut I suspect whereas the static type additions to Python will tend to spread throughout your entire system (the more you annotate, the more useful the feature is), the dynamic features of static languages tend to be used in specific places for specific reasons (the less you use the feature and the more you encapsulate it so the dynamism doesn't "escape", the better it works with the program as a whole).
- cakes 8y agoThis was pretty much true when I was last using C#. You would find specific places where you need "an object" (e.g. maybe you want to LINQ over some data in a method) so you could dynamically create it but if you wanted that object to go anywhere outside of scope you had to have a concrete definition.
- llccbb 8y agoHad a similar thought, but around C++. auto types and lambda functions are the ones that come to my mind. I am sure there are more features making their way into modern C++ versions.
- symlinkk 8y agoThose are completely different concepts. You're confusing dynamic typing with type inference. Dynamic typing: C# "dynamic" keyword Type inference: C# "var" keyword, C++ "auto" keyword
- looki 8y agoauto types really don't have anything to do with dynamic typing, in fact I would argue type deduction is an important tool in making static typing more attractive. An example of dynamic typing in C++ would be std::any (although you're still limited by what you can do with the contained object of course, for better or worse).