4 ms·
Javascript (without typescript) also has duck typing. The difference with structural typing is that the interface is formalized and enforced compile time. Pyth
by Too 7y ago
Javascript (without typescript) also has duck typing. The difference with structural typing is that the interface is formalized and enforced compile time.
Python 3.7 added compile structural typing using what they call Protocols. It works very similar to typescript. See https://www.python.org/dev/peps/pep-0544/ https://www.python.org/dev/peps/pep-0544/