digitalmars.D - Why is ^^= not part of type definition of integers?
- 12345swordy (7/7) May 04 2021 Currently it relies on a function call of phobos math function
- Max Haughton (6/13) May 04 2021 pow can be inlined, there is no optimization problem here.
- 12345swordy (6/23) May 04 2021 The rewrite currently only works if you mark your get and set
- Max Haughton (2/18) May 04 2021 You've lost me.
- 12345swordy (6/26) May 04 2021 Should g ^^= 2 be allowed for non-@property functions? Where g()
- Max Haughton (2/20) May 04 2021 @property exists, so I think no.
Currently it relies on a function call of phobos math function instead of code generation for backend optimization. If that were the case, why does it not rewrite it as `this g() = std.math.pow(g(),2)` for functions? This is a road block for me when implementing binary operators for properties. -Alex
May 04 2021
On Tuesday, 4 May 2021 at 15:20:53 UTC, 12345swordy wrote:Currently it relies on a function call of phobos math function instead of code generation for backend optimization. If that were the case, why does it not rewrite it as `this g() = std.math.pow(g(),2)` for functions? This is a road block for me when implementing binary operators for properties. -Alexpow can be inlined, there is no optimization problem here. As for why the rewriting doesn't happen in general I assume it's because there wasn't demand for it. Why is this a roadblock, can't you just lower to the form similar to the one you suggest?
May 04 2021
On Tuesday, 4 May 2021 at 15:27:13 UTC, Max Haughton wrote:On Tuesday, 4 May 2021 at 15:20:53 UTC, 12345swordy wrote:The rewrite currently only works if you mark your get and set functions as property. I am not sure if the rewrite should be allowed for functions that are not mark property when it comes to ^^= operator for integers. -AlexCurrently it relies on a function call of phobos math function instead of code generation for backend optimization. If that were the case, why does it not rewrite it as `this g() = std.math.pow(g(),2)` for functions? This is a road block for me when implementing binary operators for properties. -Alexpow can be inlined, there is no optimization problem here. As for why the rewriting doesn't happen in general I assume it's because there wasn't demand for it. Why is this a roadblock, can't you just lower to the form similar to the one you suggest?
May 04 2021
On Tuesday, 4 May 2021 at 15:57:33 UTC, 12345swordy wrote:On Tuesday, 4 May 2021 at 15:27:13 UTC, Max Haughton wrote:You've lost me.On Tuesday, 4 May 2021 at 15:20:53 UTC, 12345swordy wrote:The rewrite currently only works if you mark your get and set functions as property. I am not sure if the rewrite should be allowed for functions that are not mark property when it comes to ^^= operator for integers. -Alex[...]pow can be inlined, there is no optimization problem here. As for why the rewriting doesn't happen in general I assume it's because there wasn't demand for it. Why is this a roadblock, can't you just lower to the form similar to the one you suggest?
May 04 2021
On Tuesday, 4 May 2021 at 16:08:28 UTC, Max Haughton wrote:On Tuesday, 4 May 2021 at 15:57:33 UTC, 12345swordy wrote:Should g ^^= 2 be allowed for non- property functions? Where g() is a function call where function definitions void g(int value) and int g() exist. -Alex -AlexOn Tuesday, 4 May 2021 at 15:27:13 UTC, Max Haughton wrote:You've lost me.On Tuesday, 4 May 2021 at 15:20:53 UTC, 12345swordy wrote:The rewrite currently only works if you mark your get and set functions as property. I am not sure if the rewrite should be allowed for functions that are not mark property when it comes to ^^= operator for integers. -Alex[...]pow can be inlined, there is no optimization problem here. As for why the rewriting doesn't happen in general I assume it's because there wasn't demand for it. Why is this a roadblock, can't you just lower to the form similar to the one you suggest?
May 04 2021
On Tuesday, 4 May 2021 at 16:49:00 UTC, 12345swordy wrote:On Tuesday, 4 May 2021 at 16:08:28 UTC, Max Haughton wrote:property exists, so I think no.On Tuesday, 4 May 2021 at 15:57:33 UTC, 12345swordy wrote:Should g ^^= 2 be allowed for non- property functions? Where g() is a function call where function definitions void g(int value) and int g() exist. -Alex -AlexOn Tuesday, 4 May 2021 at 15:27:13 UTC, Max Haughton wrote:You've lost me.[...]The rewrite currently only works if you mark your get and set functions as property. I am not sure if the rewrite should be allowed for functions that are not mark property when it comes to ^^= operator for integers. -Alex
May 04 2021