Myron Alexander wrote:
> downs wrote:
>> ([&update]~([1, 2] /map/ (int e) { return &prefetch /fix/ (currentStrip
>> + e); })) /map/ &Pool.addTask;
> > What is /map/ and /fix/? Are these valid D constructs? If so, where in the language spec are they as I am very interested in learning more.
map and fix are struct types with static opDiv_r that return a struct with opDiv, which returns the actual result.
He uses them to approximate infix operators.
He's been polluting #d on Freenode with them for a while now ;).

Frits van Bommel wrote:
> Myron Alexander wrote:
>> downs wrote:
>>> ([&update]~([1, 2] /map/ (int e) { return &prefetch /fix/ (currentStrip
>>> + e); })) /map/ &Pool.addTask;
>>>> What is /map/ and /fix/? Are these valid D constructs? If so, where in the language spec are they as I am very interested in learning more.
> > map and fix are struct types with static opDiv_r that return a struct with opDiv, which returns the actual result.
> He uses them to approximate infix operators.
> He's been polluting #d on Freenode with them for a while now ;).
I wonder if there are any plans for adding list comprehensions to D. Not a question, just a musing.
Thanks for the info.
Myron.

Myron Alexander wrote:
> I wonder if there are any plans for adding list comprehensions to D. Not a question, just a musing.
> > Thanks for the info.
So am I. (Though in D they'd probably be array comprehensions)
And generator expressions would be pretty cool too. Note: not full generators, those probably can't be done without stackthreads. Generator expressions are a bit more limited, but are a nice syntax to define an iterator that generates elements while opApply'ing over it.

downs wrote:
> What's the most badly garbled, mangled or otherwise hideously disfigured D code you've ever written that still worked as intended?
> > The point of this thread is to find out how badly it's possible to twist the D language without making the compiler commit Seppuku.
> > Note: intentional obfuscation doesn't count :)
> > Give us your worst.
> --downs
Sadly, I tend to actually try to write nice looking code, even if it happens to be pure evil.
I suppose in that respect, the most terrifying thing I've ever written[1] was a program that compiled new functions at runtime; a proof of concept for turning a delegate into a function pointer that was inspired by Tioport's need to call arbitrary native functions given only a run-time description of their types. Not bad looking, just really, really evil.
One of these days, I might actually finish it. :P
Here's the program itself: http://drk.is-a-geek.net/~drk/d/selfmod.d
And here's the in-memory x86 assembler it depends on: http://drk.is-a-geek.net/~drk/d/x86.d
Historically speaking, though, the nastiest thing I've ever done
in-language was probably my collection of function unpacking templates.
They abused IFTI in the nastiest way I could think of in order to work
out what types a function returned, took as arguments, and how many
arguments it took.
At least Kirk found them useful! ;)
-- Daniel
[1] The fake closures stuff comes a close second, though.