Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread PlatisYialos
On Tuesday, 6 November 2012 at 18:28:04 UTC, Ali Çehreli wrote: On 11/06/2012 10:13 AM, PlatisYialos wrote: > On Tuesday, 6 November 2012 at 17:48:55 UTC, PlatisYialos wrote: > > To really give a stark example: > > --- > void compiles() { > immutable(char)[][immutable(

Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread PlatisYialos
On Tuesday, 6 November 2012 at 18:25:46 UTC, Ali Çehreli wrote: On 11/06/2012 09:48 AM, PlatisYialos wrote: On Tuesday, 6 November 2012 at 17:23:41 UTC, PlatisYialos wrote: Errmm! Here's a better example, but with the same results: module test; void noparens() {

Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread Ali Çehreli
On 11/06/2012 09:48 AM, PlatisYialos wrote: On Tuesday, 6 November 2012 at 17:23:41 UTC, PlatisYialos wrote: Errmm! Here's a better example, but with the same results: module test; void noparens() { immutable char[char] aMap; char a = 'a'; immutable char b = 'b'; a

Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread Ali Çehreli
On 11/06/2012 10:13 AM, PlatisYialos wrote: > On Tuesday, 6 November 2012 at 17:48:55 UTC, PlatisYialos wrote: > > To really give a stark example: > > --- > void compiles() { > immutable(char)[][immutable(char)[]] aMap; [...] > Does the compiler give special treatment

Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread PlatisYialos
On Tuesday, 6 November 2012 at 17:48:55 UTC, PlatisYialos wrote: To really give a stark example: --- void compiles() { immutable(char)[][immutable(char)[]] aMap; immutable(char)[] a = ['a']; immutable(char)[] b = ['b']; aMap[a] = b; } void doesnotcompile() {

Re: How do I store an immutable value into a mutable associative array?

2012-11-06 Thread PlatisYialos
On Tuesday, 6 November 2012 at 17:23:41 UTC, PlatisYialos wrote: Errmm! Here's a better example, but with the same results: module test; void noparens() { immutable char[char] aMap; char a = 'a'; immutable char b = 'b'; aMap[a] = b; } void withparens() {

How do I store an immutable value into a mutable associative array?

2012-11-06 Thread PlatisYialos
Here's a test file, with the compiler messages obtained. I also tried introducing an alias with similar results to the second attempt below. 1module test; 2 3void noparens() { 4 immutable char[char] aMap; 5 aMap['a'] = 'b'; 6 7 /* Compiler error messages 8 ./src/