Eloquently sums up my feelings about the disadvantages of dynamic typing

Chris wendlec at tcd.ie
Fri Oct 18 03:44:59 PDT 2013


On Friday, 18 October 2013 at 10:23:34 UTC, Chris wrote:
> On Friday, 18 October 2013 at 02:08:59 UTC, Nick Sabalausky 
> wrote:
>> On Wed, 16 Oct 2013 23:00:04 -0700
>> "H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote:
>>
>>> On Wed, Oct 16, 2013 at 11:07:20PM -0400, Jonathan M Davis 
>>> wrote:
>>> > In contrast, with a dynamically typed language, the type of 
>>> > a
>>> > variable can actually change while your program is running,
>>> > resulting in function calls being wrong due to the fact 
>>> > that they
>>> > don't work with the new type. If you're dealing with static 
>>> > typing,
>>> > the type of every variable is fixed, and the legality of 
>>> > code
>>> > doesn't suddenly change at runtime.
>>> 
>>> 	bool func(Variant x, Variant y) {
>>> 		return x < y;
>>> 	}
>>> 
>>> 	func(1, 2);	// ok
>>> 	func(1.0, 2.0);	// ok
>>> 	func("a", 1);	// hmmm... ;-)
>>> 
>>
>> from bottle import route, run, response
>>
>> @route('/foo')
>> def index():
>> 	response.content_type = response
>> 	return 'Take that, HTTP!!'
>>
>> run(host='localhost', port=8181)
>
> from bottleneck import runslow

I like bottlenecks in Blues, not in programs.


More information about the Digitalmars-d mailing list