The D Scripting Language

Alexander Malakhov anm at programmer.net
Fri Nov 12 09:01:24 PST 2010


Gary Whatmore <no at spam.sp> писал(а) в своём письме Thu, 11 Nov 2010  
20:07:35 +0600:

> Alexander Malakhov Wrote:
>> ...
>> Maybe it would be better to just make rdmd to surround source code with:
>>
>> //----- rdmd generated text BEGIN
>> public import std.stdio, ...
>>
>> void main( string[] args ){
>> //----- rdmd generated text END
>>
>> 	// programmer's code
>> }
>>
>> in cases when rdmd detects there is no main()
>
> No, it could do that in all cases. D supports nested declarations. This  
> is how the other languages do this. It would improve the score a lot.  
> Did TDPL talk script programming? We can still change this radically  
> without breaking D2 - thank god the specification is informal and  
> incomplete.

Then you have 2 issues:

void main(string[] args){

	import std.stdio; // 1. will not compile
	void main(string[] args){
		writeln("hello");
	}

	main(args); // 2. this should be appended, hence anyway rdmd should  
analyze
		    //    if there is main()
}

--
btw, why name is not simply "std.io" ?

-- 
Alexander


More information about the Digitalmars-d mailing list