On Wed, Nov 06, 2013 at 11:52:56PM +0100, Namespace wrote: > On Wednesday, 6 November 2013 at 22:43:18 UTC, Dicebot wrote: > >On Wednesday, 6 November 2013 at 22:41:08 UTC, Atila Neves wrote: > >>I know, but I keep having to refer back to that and even then I > >>didn't know about the syntax these guys just posted! ;) > > > >Well, it is mentioned in the list of `is` usage cases down that > >link. It is very ugly part of the language but definitely worth > >spending some time to carefully investigate all the patterns - > >damn powerful stuff. > > There are so much more uglier things ... :P > Take a look at the scoped or ref counted implementation.
Are you sure about that? Do you know that this does? int func(ref int x, string y, float z = 3.14159) { ... } // This is possibly the single nastiest bit of syntax in all of D: static if (is(func X == __parameters)) { // Quick, without looking at the docs: what does X refer // to? // If you manage to figure that one out, can you say // with certainty what's the type of X? Are you sure? :P alias Y = X[0]; // Quick, without looking at the docs: what is Y? // (If your answer was, the first element of X, you're // wrong!) // Quiz: how do you get a single element of X? (And no, // X[i] is the wrong answer, see above.) // If you got it right thus far: how do you access the // name of a single element of X? The default value? // (Note: if you didn't get the previous questions // right, don't even attempt this one; it's one of those // things that nobody can possibly guess unless they've // seen it before.) } Almost every part of the above is so completely counterintuitive and impossible to predict from the syntax that I honestly doubt if the scoped or RefCounted implementation could beat it for ugliness. :P T -- Notwithstanding the eloquent discontent that you have just respectfully expressed at length against my verbal capabilities, I am afraid that I must unfortunately bring it to your attention that I am, in fact, NOT verbose.