Import concerns revisited
Walter Bright
newshound at digitalmars.com
Wed Jul 12 17:03:11 PDT 2006
Derek Parnell wrote:
> On Thu, 13 Jul 2006 05:05:22 +1000, Walter Bright
>> It's not always true, but languages that are less wordy in their
>> example code tend to be picked up faster. People's first projects in D
>> aren't going to be large, complex, professional products. They'll want
>> to just try it out on something simple. That bar should be as low as
>> reasonable.
>
> I understand your desire to not 'frighten' new comers away. My concern
> is that your "low as reasonable" seems to encourage poor programming
> practices. Can you provide an example where the 'import' and
> 'visibility' ideas being brainstormed at the moment would force example
> code to look scary? At worst, someone might have to add 'public { ... }'
> somewhere.
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!");
}
I can go straighter towards what I want to do, without detouring through
all the other requirements Java puts on things that seem, with such a
simple program, to be beside the point.
Just for fun, here's an Ada version:
With STANDARD_IO;
Use STANDARD_IO;
Procedure HELLO_WORLD is begin
Put("Hello world!");
End HELLO_WORLD;
No thanks! <g>
More information about the Digitalmars-d
mailing list