www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7438] New: Functions from std.conv should be pure

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438

           Summary: Functions from std.conv should be pure
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: SyntaxColoring gmail.com



The conversion functions in std.conv always yield the same results for the same
input, so they should be marked as pure.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
Should we close ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc




 Should we close ?
I agree with Jonathan M Davis that maybe asking for them to be always pure is a bit too much (this is debatable. Maybe it's a good thing still). But I think we can't close this bug report before this little program, that shows a very basic usage of to!(), compiles with no errors or warnings: import std.conv: to; void main() pure { string r = to!string(to!real("2.5")); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438




PDT ---
I'd be very tempted to argue that that should be a separate bug. There's a big
difference between std.conv.to should always be pure for everything and
std.conv.to should be pure when converting to strings.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438


Robert Schadek <rburners gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rburners gmail.com



---
Is somebody working on this?
I would even argue that it should be  safe.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438




PDT ---
Whether std.conv.to can be  safe or pure depends entirely on what you're
converting. For all of the built-in types, it should be  safe and pure, but
once user-defined types enter the mix, it depends on how the user-defined types
are defined. A lot of the underlying stuff which relates to arrays (like
appender) hasn't been able to be pure in the past (I don't know quite where
that sits now though), making it so that stuff like std.conv.to!string(10)
hasn't been able to be pure even though it should be. So, odds are that the
lack of purity or  safety in std.conv.to isn't std.conv.to's fault at all.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7438




---
yes it turtles down. Just to see how hard it breaks I mark some pure. I stopped
somewhere in format. So looks like not so much fun.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 14 2013