[Issue 7310] pure function results should implicitly cast to mutable, shared, and inout
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 18 17:09:49 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7310
timon.gehr at gmx.ch changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #7 from timon.gehr at gmx.ch 2012-01-18 17:09:48 PST ---
(In reply to comment #6)
> (In reply to comment #5)
> > Furthermore, the optimization also applies when it is the other way round
> > (mutable return value implicitly converted to immutable), so the analysis would
> > consider implicit conversions of the return value anyway.
>
> No. The only way an immutably pure function can return a mutable value, is if
> it created it itself -- so we know it's unique. No analysis of the body of the
> function is required.
This is not what I was suggesting. I am only reasoning about the call-site
here.
>
> But, if an immutable pure function returns an immutable value, we know nothing.
> It could be a parameter, or an immutable global variable, or a variable created
> inside the function.
For parameter, see comment #2. immutable global variables are a deal-breaker.
Implicitly casting between shared and unshared should still be possible at
strongly pure function border. I am opening a separate issue for it.
--
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