D-etractions A real world programmers view on D

Steven Schveighoffer schveiguy at yahoo.com
Tue Sep 4 06:59:59 PDT 2012


On Sat, 01 Sep 2012 21:21:50 -0400, Nick Sabalausky  
<SeeWebsiteToContactMe at semitwist.com> wrote:

> On Thu, 30 Aug 2012 09:35:31 -0400
> "Steven Schveighoffer" <schveiguy at yahoo.com> wrote:
>>
>> For example, I use netbeans to write php -- a dynamic language.
>> There are no real variable type declarations, so when you start
>> typing, auto-complete sucks unless you have told the IDE what a
>> variable is.  You do so like this:
>>
>> /**
>>   @var Type
>>   */
>> var $varname;
>>
>> And now the IDE assumes you have stored a Type into $varname, so when
>> you type $this->varname->, it completes with the members of Type.
>>
>
> Wow, so it's basically reinventing static typing poorly. You've got
> the boilerplate and verbosity of a poorly-made static type system, with
> very few of the benefits (ie, IDE-awareness and nothing else).
>
> I'll never understand the dynamic world.

I have on occasion had the benefit of simply adding a member variable to  
instances of a class when I needed it without having to burden the rest of  
the code with knowing about that variable.  I felt dirty doing it...

But I think you are right -- "fake" static typing does not come close to  
actual static typing.  If I could count all the time I've wasted because I  
mistyped a member variable name, and it "just worked", blissfully reading  
null instead of the variable I've set, it would probably add up to days.   
Thankfully, netbeans 7 is better at telling me that a variable is  
previously unset or is never used, but it can't be perfect, especially  
with this mess I inherited.  The original author thought "modularity"  
meant importing large pieces of functions from other files, which the IDE  
refuses to correctly interpret.

This, of course, all comes from two guys who really like static typing :)   
We *may* have a biased view.

In any case, it is what it is -- the existing code-base is huge, and I  
have no real desire to rewrite all of it :)  The best I can do is add some  
typing comments and hobble through it (cursing as I go).  If I had a year  
of spare time, I could rewrite it all in D!

-Steve


More information about the Digitalmars-d mailing list