There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

RonSijm , (edited )
@RonSijm@programming.dev avatar

Extension functions are not the same at all. Extension functions are syntactic sugar. For example if you have an extension function like


<span style="color:#323232;">public static class ObjectExtension
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public static void DoSomething(this object input) { }
</span><span style="color:#323232;">}
</span>

You can call that function on an object by doing object.DoSomething() - Yes. But underneath it’s the same as doing ObjectExtension.DoSomething(object)

That function does not actually become part of the object, and you can’t use it to override existing functions

A closer example of how to do something similar in a memory safe language would be - in C# - using something like Castle DynamicProxy - where through a lot of black magic - you can create a DynamicProxy and fool the CLR into thinking it’s talking to an object, while it’s actually talking to a DynamicProxy instead. And so then you can actually intercept invocations to existing methods and overrule them

Generally overruling existing functions at runtime is not that easy

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines