OT: What's your favorite codeline?

downs default_357-line at yahoo.de
Wed Sep 2 01:28:58 PDT 2009


Robert Fraser wrote:
> downs wrote:
>> <downs>     foo.betweens("src=\"", "\"") /select/ (string s) { return
>> s.find(criteria) != -1; }
> 
> Heh, I love that infix expression syntax. Too abd it ends up with a
> completely useless wrapper struct & 2 function calls, but hopefully LDC
> can inline that out.
> 

I'm 90% sure it can.

[update] Actually, I just tried and LDC compiles a simple /select/ test to plain, inlined code.
[update2] GDC doesn't.
[update3] For that matter, neither does DMD.

LDC is really shaping up to be the best D compiler out there. It already is on Unix (imho). Now if only they can get win32 exception support to work ..

>> <downs>     auto videocon =
>> ctx.getStreams().first(WHERE!("?.codec.codec_type ==
>> CodecType.Video")).codec;
> 
> Heh, going LINQ on us, now?

I _was_ thinking of that :) Could have used ex!() but WHERE is a little denser.

(for comparison: ex!("c -> c.codec.codec_type == CodecType.Video") )



More information about the Digitalmars-d mailing list