Hmm. Isn't this expected behaviour? After all, typeof(a) == immutable(dchar)[], so shouldn't the cartesianProduct result contain the same element type, i.e., immutable(dchar)?
Comment #2 by hsteoh — 2014-09-21T05:56:02Z
Sorry, I meant, typeof(b).
Comment #3 by bearophile_hugs — 2014-09-21T11:25:05Z
Comment #4 by peter.alexander.au — 2015-01-02T21:23:52Z
(In reply to bearophile_hugs from comment #3)
> (In reply to hsteoh from comment #1)
> > Hmm. Isn't this expected behaviour?
>
> Probably yes, but I have opened a discussion thread:
> http://forum.dlang.org/thread/[email protected]
Don't want to bump the thread.
The reason filtering a string yields dchar instead of immutable(dchar) is because string.front returns a decoded dchar by value. On the other hand iterating a dstring returns the dchar by ref, so you see its immutability.
Shall we close this bug?
Comment #5 by bearophile_hugs — 2015-01-08T14:50:56Z
(In reply to Peter Alexander from comment #4)
> The reason filtering a string yields dchar instead of immutable(dchar) is
> because string.front returns a decoded dchar by value. On the other hand
> iterating a dstring returns the dchar by ref, so you see its immutability.
>
> Shall we close this bug?
The current behaviour is is a little strange, but I guess you are right. I close this down then, as invalid.
Comment #6 by hsteoh — 2015-01-08T17:45:57Z
Yet another unfortunate consequence of autodecoding. :-(