The D Scripting Language

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Nov 12 09:44:18 PST 2010


On 11/12/10 9:21 AM, Alexander Malakhov wrote:
> Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> писал(а) в своём
> письме Thu, 11 Nov 2010 21:12:33 +0600:
>
>> On 11/11/10 5:50 AM, 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()
>>
>> rdmd already does that with --eval and --loop.
>>
>> http://www.digitalmars.com/d/2.0/rdmd.html
>>
>> Andrei
>
> I was unable to pass file to --eval, is this possible ?

It is:

rdmd --eval $(cat filename)

I know... it's cheating :o). But if you want to pass a file, why not 
just make the file a small program and compile it the classic way?

>> rdmd --eval=script.d
> (16): Error: undefined identifier script
>
>
> also while I'm here. This works: > rdmd
> --eval=writeln("");writeln("");writeln("");
> and this don't:
>> rdmd --eval=writeln("hello")
> (16): Error: undefined identifier hello
>
>
> btw, does --eval make "import std.all" or some set of modules ?

It imports all modules.


Andrei


More information about the Digitalmars-d mailing list