dynamic classes and duck typing

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Wed Dec 2 01:08:45 PST 2009


Andrei Alexandrescu wrote:
> Leandro Lucarella wrote:
>> Walter Bright, el  1 de diciembre a las 13:45 me escribiste:
>>> Leandro Lucarella wrote:
>>>> I develop twice as fast in Python than in D. Of course this is only me,
>>>> but that's where I think Python is better than D :)
>>> If that is not just because you know the Python system far better
>>> than the D one, then yes indeed it is a win.
>>
>> And because you have less noise (and much more and better libraries
>> I guess :) in Python, less complexity to care about.
>>
>> And don't get me wrong, I love D, because it's a very expressive language
>> and when you need speed, you need static typing and all the low-level
>> support. They are all necessary evil. All I'm saying is, when I don't 
>> need
>> speed and I have to do something quickly, Python is still a far better
>> language than D, because of they inherent differences.
>>
>>>> I think only not having a compile cycle (no matter how fast 
>>>> compiling is)
>>>> is a *huge* win. Having an interactive console (with embedded
>>>> documentation) is another big win.
>>> That makes sense.
>>
>> I guess D can greatly benefit from a compiler that can compile and run
>> a multiple-files program with one command (AFAIK rdmd only support one
>> file programs, right?) and an interactive console that can get the ddoc
>> documentation on the fly. But that's not very related to the language
>> itself, I guess it's doable, the trickiest part is the interactive
>> console, I guess...
>>
> 
> I'm amazed that virtually nobody uses rdmd. I can hardly fathom how I 
> managed to make-do without it.
> 
> Andrei


I use it almost exclusively, and find it an extremely useful and 
efficient tool. The only time I use DMD directly is when I'm done coding 
and testing, and want to compile the final library file or executable.

For libraries, I define a unit.d file in the library root directory that 
looks something like this:

   #!/usr/local/bin/rdmd --shebang -w -unittest
   module unit;

   import std.stdio;

   // Import entire library.
   import mylib.moduleA;
   import mylib.moduleB;
   ...

   void main()  { writeln("All unittests passed."); }

Then I mark unit.d as executable, and run it whenever I want to test 
changes I've made to the library.

-Lars



More information about the Digitalmars-d mailing list