Duplicate keys in array literals?

2013-11-28 Thread bearophile
Is it a good idea to silently statically accept duplicated keys in both dynamic array literals and in associative array literals? void main() { int[] a = [0:10, 0:20]; int[int] aa = [0:10, 0:20]; } I don't remember having ever had the need for this, and on the other hand I have

Re: Duplicate keys in array literals?

2013-11-28 Thread Daniel Murphy
bearophile bearophileh...@lycos.com wrote in message news:befwnwpitihpcjfbd...@forum.dlang.org... Is it a good idea to silently statically accept duplicated keys in both dynamic array literals and in associative array literals? Looks like a bug to me.

Re: Duplicate keys in array literals?

2013-11-28 Thread luka8088
On 28.11.2013. 12:23, bearophile wrote: Is it a good idea to silently statically accept duplicated keys in both dynamic array literals and in associative array literals? void main() { int[] a = [0:10, 0:20]; int[int] aa = [0:10, 0:20]; } I don't remember having ever had

Re: Duplicate keys in array literals?

2013-11-28 Thread Denis Shelomovskij
28.11.2013 15:23, bearophile пишет: Is it a good idea to silently statically accept duplicated keys in both dynamic array literals and in associative array literals? void main() { int[] a = [0:10, 0:20]; int[int] aa = [0:10, 0:20]; } I don't remember having ever had the need

Re: Duplicate keys in array literals?

2013-11-28 Thread Jacob Carlborg
On 2013-11-28 18:55, luka8088 wrote: PHP also allows it: $data = array('a' = 1, 'a' = 2); And I find it to be only a source of bugs. Arrays are a weird beast in PHP. They're both arrays and associative arrays, at the same time, somehow. -- /Jacob Carlborg

Re: Duplicate keys in array literals?

2013-11-28 Thread luka8088
On 28.11.2013. 21:01, Jacob Carlborg wrote: On 2013-11-28 18:55, luka8088 wrote: PHP also allows it: $data = array('a' = 1, 'a' = 2); And I find it to be only a source of bugs. Arrays are a weird beast in PHP. They're both arrays and associative arrays, at the same time, somehow.

Re: Duplicate keys in array literals?

2013-11-28 Thread bearophile
Denis Shelomovskij: File the issue please. I have opened an issue, currently it's not an enhancement request: https://d.puremagic.com/issues/show_bug.cgi?id=11637 In that issue I have also added more explanations and more code examples, with an extra small discussion about arrays with