const?? When and why? This is ugly!
Lutger
lutger.blijdestijn at gmail.com
Wed Mar 4 05:04:46 PST 2009
bearophile wrote:
> Lutger:
>> If you have a dynamic language you have a different way of programming.
In D
>> when I make a typo, the compiler catches it. When I do the same in Ruby,
I
>> have a unit test that spits out a method missing exception with a trace.
>> Suppose D doesn't catch my typo and then my application crashes at
runtime
>> without such a trace, that will be a nightmare.
>
> This is a complex and long debated topic.
> In my D programs I put almost as many unittests as I put in Python
programs, because experience shows me the type system of D doesn't catch
that many bugs. The result seems strong enough D programs.
> While I debug I use the 'Phobos hack' to add something like those traces
to D (I don't understand why such feature isn't built-in yet, it's essential
when I debug D programs).
>
> Bye,
> bearophile
I didn't mean to imply that with D the type system unit tests and stack
traces are obsolete or that D is better / worse.
When you say 'not that many bugs', how often does you code compile with
errors? Because every compile time error you encounter is a bug in a dynamic
language, and within that perspective I think it's quite a lot. Now, that
doesn't mean dynamic languages are more bug prone, just that the way you
program with them is different. Different enough that you can't compare type
systems of static and dynamic languages that easily.
More information about the Digitalmars-d
mailing list