why Unix?

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Apr 7 18:55:34 PDT 2009


On Tue, Apr 7, 2009 at 8:21 PM, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:

> 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)

Sadly that would make the lexical/semantic passes of the compiler
dependent upon the semantic analysis.  Beyond that, even - it'd
require that the code be compiled and executed before you knew how to
parse it.  Sounds like Perl.  However...

> 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).

How about something like:

%{
// lots of bash-style commands!
}

That is, an entire brace-block in which the default parsing mode is bash mode?

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

It's not that it's executing differently; it's just parsed
differently, with a different "reasonable default" for interactive vs.
batch mode.  I'm sure people might complain but meh :P



More information about the Digitalmars-d mailing list