Import concerns revisited

Walter Bright newshound at digitalmars.com
Fri Jul 14 11:25:14 PDT 2006


Jari-Matti Mäkelä wrote:
> Walter Bright wrote:
>> Not exactly what you're after, but consider the Java hello world program:
>>
>>   class HelloWorldApp {
>>     public static void main(String[] args) {
>>         System.out.println("Hello World!");
>>     }
>>   }
>>
>> There's a reason for everything there, but it's a little off-putting.
>> Consider the D version:
>>
>>   import std.stdio;
>>
>>   void main() {
>>      writefln("Hello World!");
>>   }
> 
> Changing the language syntax so that imports are private by default does
> not change anything in either of those examples.

True. But what I think goes too far is requiring hello world to look like:

   import std.stdio;

   public void main() {
      std.stdio.writefln("Hello World!");
   }

It's not like it's wrong to design D that way, it's just off-putting. 
Simple things should be simple.



More information about the Digitalmars-d mailing list