Inject in to object
Amex
Amex at gmail.com
Mon Jun 3 08:09:17 UTC 2019
On Sunday, 2 June 2019 at 20:16:15 UTC, Adam D. Ruppe wrote:
> On Sunday, 2 June 2019 at 15:27:07 UTC, Amex wrote:
>> It would be very useful to be able to "inject" reference in to
>> Object so that one could add such information that would be
>> available to all objects.
>
> Have you tried just writing a function outside the object that
> takes it as a parameter? It seems like that could do what you
> want today.
>
> void Display(Object _this) { ... }
Maybe... but I'm mainly looking to be able to add information to
all objects(fields) and mainly this is for debugging purposes
because Visual D/Studio does not allow one to always get at
certain global variables(One has to specify the fully qualified
name and jump through a few hoops)...
But I figure it could be useful for other things too. I just
don't see why we can't do have such a feature. I mean, if
everything could be done with extension methods then why have
object in the first place?
More information about the Digitalmars-d
mailing list