Thread overview
[Issue 13122] std.algorithm.cartesianProduct output type immutability
Jan 02, 2015
Peter Alexander
July 14, 2014
https://issues.dlang.org/show_bug.cgi?id=13122

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx

--
September 21, 2014
https://issues.dlang.org/show_bug.cgi?id=13122

--- Comment #1 from hsteoh@quickfur.ath.cx ---
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)?

--
September 21, 2014
https://issues.dlang.org/show_bug.cgi?id=13122

--- Comment #2 from hsteoh@quickfur.ath.cx ---
Sorry, I meant, typeof(b).

--
September 21, 2014
https://issues.dlang.org/show_bug.cgi?id=13122

--- Comment #3 from bearophile_hugs@eml.cc ---
(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/fxkgafwqeeduxkerzglo@forum.dlang.org

--
January 02, 2015
https://issues.dlang.org/show_bug.cgi?id=13122

Peter Alexander <peter.alexander.au@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au@gmail.co
                   |                            |m

--- Comment #4 from Peter Alexander <peter.alexander.au@gmail.com> ---
(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/fxkgafwqeeduxkerzglo@forum.dlang.org

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?

--
January 08, 2015
https://issues.dlang.org/show_bug.cgi?id=13122

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from bearophile_hugs@eml.cc ---
(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.

--
January 08, 2015
https://issues.dlang.org/show_bug.cgi?id=13122

--- Comment #6 from hsteoh@quickfur.ath.cx ---
Yet another unfortunate consequence of autodecoding. :-(

--