Questions about windows support

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 23 10:02:55 PST 2012


On Thu, Feb 23, 2012 at 03:56:49AM +0100, Adam D. Ruppe wrote:
> I started the dshell just to waste a little time:
> 
> http://arsdnet.net/dcode/dshell.d
> 
>         dmd dshell.d -L-lreadline -L-lncurses
> 
> It doesn't do much here, but there's a few things I think
> are cool:
> 
> 1) D reflection rox. You can write D functions with simple
> arguments and it works basically. I want to detect bitfield
> enums to automatically do -flags too.

Nice!!! So you can write the same code for both the "shell library" and
the actual shell itself.


> 2) Your functions can return whatever, and it is wrapped in
> a runtime polymorphic range.

Cool, this is better than just plaintext stdin/stdout. :)


> If you just want strings, you can do ProgramDataByLine(input).
> 
> If you want something fancier, you can use originalProgramData!Type
> to fetch out the original input range.

Nice.


> The syntax is so far just the basics... calling functions
> and pipes.

The echo command has a bug, it's not supposed to output 'echo' as part
of its output. :)


> but hey its kinda cool already.

It's extremely cool. Definitely orders of magnitude better than writing
the equivalent thing in C. Can you imagine the amount of code
duplication & ugliness that you'd need in an equivalent C
implementation?  Without reflection, you'd either need hand-coded tables
all over the place or insanely complex nested macros that nobody can
understand.


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge


More information about the Digitalmars-d mailing list