Eloquently sums up my feelings about the disadvantages of dynamic typing
growler
growlercab at gmail.com
Wed Oct 16 19:49:29 PDT 2013
On Thursday, 17 October 2013 at 02:37:35 UTC, H. S. Teoh wrote:
> On Wed, Oct 16, 2013 at 10:16:17PM -0400, Jonathan M Davis
> wrote:
>> On Tuesday, October 15, 2013 15:15:45 Walter Bright wrote:
>> > http://www.reddit.com/r/programming/comments/1oi8wd/ruby_is_a_dying_language
>> > /ccs8yr8
>>
>> I can't possibly like any language where the type of a
>> variable could
>> change based on whether the condition in an if statement is
>> true
>> (because a variable gets assigned a completely different type
>> depending no the branch of the if statement).
>
> auto func(alias condition)()
> {
> static if (condition())
> int t;
> else
> float t;
> return t;
> }
>
> ;-)
>
But if you make a mistake it is very likely that you'll see it at
compile time, not runtime. Plus D has very explicit casting which
also helps.
More information about the Digitalmars-d
mailing list