why Unix?

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 7 17:21:51 PDT 2009


On Tue, 07 Apr 2009 20:02:33 -0400, Jarrett Billingsley  
<jarrett.billingsley at gmail.com> wrote:

> On Tue, Apr 7, 2009 at 7:53 PM, Steven Schveighoffer
> <schveiguy at yahoo.com> wrote:
>
>> OK, that was *really* confusing, let me re-explain:
>>
>> if you are in interactive mode, the default is shell mode, and % turns  
>> miniD
>> on and off, which continues beyond a single line
>> if you are in a script file, then you are always in miniD mode, unless  
>> it
>> sees %, which turns it to shell mode for a single line.
>
> Close.  In either mode, % switches to the other mode for a single
> *statement*, and statements can span multiple lines.  In interactive
> mode, the interpreter will compile and run your code when you have
> finished a single statement, no matter if it's a single line or if
> it's a huge multi-line loop statement.

Ah HA!

Yes, I see that now, interesting idea.

Might I suggest that this not be the case.  I'd rather see a statement  
like the following in the script (if you wish to do miniD by default):

#!/bin/mdsh
%shell.setMode(scripted)

// and to set it back
shell.setMode(interactive)

Just my opinion.  I often try out individual lines of a script to see  
what's happening as a form of debugging, it would be maddening to have to  
insert % everywhere (for those cases where my script file is mostly  
shell-style commands).

Or, I guess if you gave the ability as stated above, I could insert the  
shell.setMode(interactive) in such scripts...

My intuition tells me that having things execute differently depending on  
whether it's scripted or interactive is going to cause bug reports...

Anyways, looking forward to trying it.

-Steve



More information about the Digitalmars-d mailing list