Index » General » Why I like D (page 2)

December 05, 2008
Don:
> I think for dynamic languages, test-driven development is mandatory.

I generally write tests after the code in all languages I use :-) Maybe I'll learn to use TDD in the future, who knows.


> But you have to write zillions of tests because the compiler accepts all
> kinds of garbage. [...]
> I like that D gives us the best of both worlds -- you only have to write
> tests to find the 'requires brain' bugs.

Unfortunately in reality the situation is a little different, and you end writing many tests in D too (take a look at my dlibs, there are more tests than code). One of the problems is that the tests you have to write "because the compiler accepts all kinds of garbage" aren't that many, and they are generally easy&quick to write and think about. Most of the programming & testing time is used elsewhere. But the dynamic languages allow you to save time in other ways. So for me the end result is that when programs aren't too much complex, I write correct Python code faster than correct D code (this includes testing time too). While when algorithms and ideas are complex, I take about the same time in both languages, because there are far more time-consuming things and details to think about.

I think in 5-10 year we'll look at the static/dynamic typing Wars like today we look at the C - Pascal Wars: as a thing of the past, as a storm in a bottle. Because probably most language will have a mix of both, with pluggable type systems too (two first examples that already exist: Python3 has optional function annotations that will be used by pluggable type systems, and C#4 has now ways to allow duck typing).

Bye,
bearophile
December 05, 2008
"Robert Fraser" <fraserofthenight@gmail.com> wrote in message news:ghabu5$1v4$1@digitalmars.com...
> Nick Sabalausky Wrote:
>> That's the reason I refuse to use dynamic languages and
>> indentation-syntax
>> languages whenever I have a choice. They're nothing but a giant step
>> backwards, constantly replacing the most basic and standard compiler
>> diagnostics with the world's most unnecessary runtime atrocities.
>
> Confusing two things there. Haskell is an indentation-syntax language, but not dynamic. The compiler catches quite a bit.

No, I'm keeping a clear, deliberate separation between dynamic-typing and indentation-syntax here. For all I know, indentation-syntax might be less problematic in a functional language like Haskell, but besides Python, I've used another indentiation-syntax language, SPIN (not dynamic typed), and even in that I found the indentation stuff to be never helpful, but sometimes problematic (it misses scope-related bugs that never would have occurred in the first place in any non-indentation language). If Python really wants to put an end to improperly indented source files, it should error out when indentation doesn't match non-whitespace block markers instead of running around assuming everything to be written as intended.


December 05, 2008
"bearophile" <bearophileHUGS@lycos.com> wrote in message news:ghb36o$10s1$1@digitalmars.com...
>
> But the dynamic languages allow you to save time in other ways.

I'd argue that most of those time-saving things are things that have absolutely nothing to do with dynamic typing and are perfectly possible with static typing. For example, things such as function-literals/closures/delegates (with clean syntax), reflection, having lots of large helpful libs, and being interpreted or JIT compiled are all associated with Python's (and Ruby's) productivity benefits, but none of those things even remotely necessitate dynamic typing.


December 05, 2008
Nick Sabalausky:
> bearophile:
> > But the dynamic languages allow you to save time in other ways.
> 
> I'd argue that most of those time-saving things are things that have absolutely nothing to do with dynamic typing and are perfectly possible with static typing.

I mostly agree, what I wanted to write is "But Python allows me to save time in other ways".
There isn't a single cause of my speed of writing correct programs in Python, and probably nearly all of such causes can be reproduced in static languages too, with some work and care (but both languages Boo and C#4 show that sometimes duck typing may help reduce the 'pressure' coming from a rigid typing system. A flexible type system like Haskell one may not require this). Maybe someday someone will create such ensemble of good qualities (often coming from the standard library, the good choice of names in various things, keeping simple things simple, from things like the list comprehension syntax, etc).

Bye,
bearophile
December 05, 2008
"bearophile" <bearophileHUGS@lycos.com> wrote in message news:ghbiuu$a81$1@digitalmars.com...
> Nick Sabalausky:
>> bearophile:
>> > But the dynamic languages allow you to save time in other ways.
>>
>> I'd argue that most of those time-saving things are things that have
>> absolutely nothing to do with dynamic typing and are perfectly possible
>> with
>> static typing.
>
> I mostly agree, what I wanted to write is "But Python allows me to save
> time in other ways".
> ...but both languages Boo and C#4 show that sometimes duck typing may help
> reduce the 'pressure' coming from a rigid typing system...
>

I'd agree that optional dynamic typing can, on occasion, be a small time saver (Though I can personally live without it), but I still find duck typing to be a bit unsettling. Though I admit, the C++/D style of template functions does resemble duck typing in a certain way (unless you make heavy use of template contraints). I guess that makes we wonder if there might be some merit in going with a more C#-style of function templates (but naturally, without C#'s problems of lacking IArithmetic and/or operator contraints).


Next ›   Last »
1 2
Top | Discussion index | About this forum | D home