You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It currently seems that Interceptors can only intercept a method. Are there any ideas to allow replacing a whole statement or line.
The current possiblities to intercept a location is only a line and a start position, but what if there would be an optional end position.
Reason: We have many mathematical expressions on arrays in our code, and with the extension members in C# 14 w'd like to add math operations on arrays and spans so that you are able to write
with extension member we want to allow operators which should be possible in C# 14, also Log has been extended to deal with arrays. But this should only be a symbolic expression with no execution. What I wanted to have then is to replace the whole expression with a method call created by a source generator that resolves this expression into a vectorized call.
The problem with interceptors currently is that I cannot replace this expression with my own.
If the Interceptors concept would be extended to allow InterceptsLocation with a start and end position that would help a lot.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It currently seems that Interceptors can only intercept a method. Are there any ideas to allow replacing a whole statement or line.
The current possiblities to intercept a location is only a line and a start position, but what if there would be an optional end position.
Reason: We have many mathematical expressions on arrays in our code, and with the extension members in C# 14 w'd like to add math operations on arrays and spans so that you are able to write
´´´
float []A = [10, 20, 30];
float []B = [10, 20, 30];
var C = Math.Log(A + B);
´´´´
with extension member we want to allow operators which should be possible in C# 14, also Log has been extended to deal with arrays. But this should only be a symbolic expression with no execution. What I wanted to have then is to replace the whole expression with a method call created by a source generator that resolves this expression into a vectorized call.
The problem with interceptors currently is that I cannot replace this expression with my own.
If the Interceptors concept would be extended to allow InterceptsLocation with a start and end position that would help a lot.
Are there any ideas around this?
Beta Was this translation helpful? Give feedback.
All reactions