digitalmars.D.bugs - [Issue 6715] New: Using a custom pow function for ^^
- d-bugmail puremagic.com (29/29) Sep 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6715
- d-bugmail puremagic.com (18/18) Apr 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6715
- d-bugmail puremagic.com (13/14) Apr 04 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6715
- d-bugmail puremagic.com (8/15) Dec 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6715
http://d.puremagic.com/issues/show_bug.cgi?id=6715 Summary: Using a custom pow function for ^^ Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: siegelords_abode yahoo.com --- Comment #0 from siegelords_abode yahoo.com 2011-09-22 11:46:57 PDT --- I want to use a custom pow function (e.g. the one from the C standard library, or from Tango) instead of the one in std.math, but a^^b is rewritten into std.math.pow(a, b) which makes this difficult to accomplish. I can work around it by using a static method like so: struct std { struct math { static auto pow(real a, real b); } } But I'd rather not have to do that (it breaks std imports, for example). Can we have ^^ rewritten into a simple pow? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6715 siegelords_abode yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- Platform|Other |All OS/Version|Linux |All --- Comment #1 from siegelords_abode yahoo.com 2012-04-04 16:01:30 PDT --- An even better idea occurred to me today, now that UFCS has been introduced. Instead of my original proposal, why not do this: a^^b turns into a.pow(b) Due to the way properties are looked up this is safer than the original proposal (bad things won't happen if you have variables named 'pow' for example). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 04 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6715 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #2 from bearophile_hugs eml.cc 2012-04-04 16:17:36 PDT --- (In reply to comment #0)Can we have ^^ rewritten into a simple pow?Note: I think that currently a^^b is optimized in some special cases by the compiler (like b = 2). A simple function call causes a loss of those handy optimizations. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 04 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6715 --- Comment #3 from siegelords_abode yahoo.com 2012-12-29 08:08:04 PST --- (In reply to comment #2)(In reply to comment #0)I never asked for those optimizations to be disabled. I am solely talking about the cases when ^^ is rewritten as a function. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------Can we have ^^ rewritten into a simple pow?Note: I think that currently a^^b is optimized in some special cases by the compiler (like b = 2). A simple function call causes a loss of those handy optimizations.
Dec 29 2012