On Monday, 24 September 2012 at 22:13:51 UTC, Timon Gehr wrote:
On 09/24/2012 09:41 AM, monarch_dodra wrote:
> [SNIP]

I don't think this does what you think it does. The 'is(R r)' declares r to be an alias for R. So 'r' is a type in that code snippet.

Darn :(

Also, is(typeof(takeExactly(R, 1))) && is(R == typeof(takeExactly(R, 1)))

can be written in a more compact way as

is(typeof(takeExactly(R, 1)) == R)

Technically, no: That was my first try, and as mentioned in the first reply, this returns true when the types of takeExactly and R are equal comparable, but does not make sure they are the actually the same types.

"is(R == typeof(takeExactly(R, 1)))"

Makes sure they are the exact same type, and

"is(typeof(takeExactly(R, 1)))"

is a short-circuit, to prevent the second test from error'ing if takeExactly!R is not legal.

Reply via email to