Re: What does this code snippet even do?

2021-01-29 Thread Ali Çehreli via Digitalmars-d-learn
On 1/29/21 2:41 PM, WhatMeWorry wrote:   Ali's book talks about the colon appearing for There is also "is, expression": http://ddili.org/ders/d.en/is_expr.html#ix_is_expr.is,%20expression But the is expression is so complicated. :( I defined that particular syntax as is (T :

Re: What does this code snippet even do?

2021-01-29 Thread Imperatorn via Digitalmars-d-learn
On Friday, 29 January 2021 at 22:59:14 UTC, H. S. Teoh wrote: On Fri, Jan 29, 2021 at 10:41:33PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] This means: "does the type of 'a' have the form U[], where U is a type that implicitly converts to T?". [...] This means: "does the

Re: What does this code snippet even do?

2021-01-29 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 29, 2021 at 10:41:33PM +, WhatMeWorry via Digitalmars-d-learn wrote: > // The following four lines in run.lang.io > > int[] a; > alias T = long; > pragma(msg, is(typeof(a) : U[], U : T)); This means: "does the type of 'a' have the form U[], where U is a type that implicitly

What does this code snippet even do?

2021-01-29 Thread WhatMeWorry via Digitalmars-d-learn
// The following four lines in run.lang.io int[] a; alias T = long; pragma(msg, is(typeof(a) : U[], U : T)); pragma(msg, is(typeof(a) : T[])); // returns true false But I'm not even sure what I'm looking at. Ali's book talks about the colon appearing for :, associative array ⬁ :,