[Issue 9359] Can't concat ints: incompatible types for 'int' and 'int'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 21 16:17:44 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9359



--- Comment #4 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2013-01-21 16:17:43 PST ---
They can be concatenated with arrays, thus producing another array.

But thinking about it more, defining 'int~int' to result in 'int[]' would be
inconsistent with the fact that 'int[]~int[]' results in 'int[]' instead of
'int[][]'.

This does result in some annoying inconsistencies:

int[] a = [1] ~  1  ~  1;  // OK
int[] a =  1  ~ [1] ~  1;  // OK
int[] a =  1  ~  1  ~ [1]; // Fail

int[] a = [1] ~ [1]; // OK
int[] a =  1  ~ [1]; // OK
int[] a = [1] ~  1;  // OK
int[] a =  1  ~  1;  // Fail

But I guess I don't see a way around that without introducing the more
error-prone inconsistency of:

[[1]] ~ [[1]]  --> int[][]
 [1]  ~  [1]   --> int[]
  1   ~   1    --> int[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list