Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic Typing without duck typing?

I'm used to dynamic typing meaning checking for type info of object/non object oriented structure at runtime and throwing some sort of type error, ie if it quacks like a duck its a duck. Is there a different type of dynamic typing (please go into details).

like image 294
Roman A. Taycher Avatar asked Aug 01 '10 14:08

Roman A. Taycher


1 Answers

Yes, absolutely. Duck-typing is an idiom which says that the type of a value at this moment in time is based on the fields and methods that it has right now. Dynamic typing just says that types are associated with run-time values, not with static variables and parameters. There is a difference between the two, and you can use the latter without the former.

For example, if you programmed in PHP and limited yourself to the basic types without using OO, then you would be using dynamic typing without using duck-typing.

like image 84
Paul Biggar Avatar answered Sep 28 '22 03:09

Paul Biggar