Ancestors

Toot

Written by The Uberduck on 2024-08-22 at 21:31

Okay, let's see if the Fediverse can answer this. I'm using #Csharp with #godot and need to wrap a scene "foo" in a class that creates multiple copies of it, then intercepts any method calls to "foo" and applies them to each copy. From outside the class, there should appear to only be one "foo," but in reality there are several.

I think I know how I'd do it in python or ruby, but it involves a lot of metaprogramming. Can this be done in C#?

=> More informations about this toot | More toots from uberduck@hachyderm.io

Descendants

Written by Spiritech on 2024-08-22 at 22:11

@uberduck off the top of my head. Maybe a signal/event or add the scene to a group only for that scene and when then with get by group you should be able to update them all i think.

=> More informations about this toot | More toots from Spiritech@mastodon.social

Written by The Uberduck on 2024-08-22 at 22:13

@Spiritech If I understand correctly, all of these involve the calling code to be aware that there's something odd going on. If at all possible, I'd like this to be transparent to the calling code.

=> More informations about this toot | More toots from uberduck@hachyderm.io

Written by Spiritech on 2024-08-22 at 22:27

@uberduck Transparent in what way? Like a completion event return message? Or like progress updates?

=> More informations about this toot | More toots from Spiritech@mastodon.social

Written by The Uberduck on 2024-08-22 at 22:30

@Spiritech If I have an object 'Foo' that has method 'bar', I want to be able to write a wrapper 'Wrapper' such that I can call 'new (Wrapper(Foo)).bar()' and it will call Foo.bar(). I need to be able to this without explicitly telling Wrapper about the bar method ahead of time.

=> More informations about this toot | More toots from uberduck@hachyderm.io

Written by Spiritech on 2024-08-22 at 22:52

@uberduck if im understanding correctly. Two classes at least one or maybe both implementing an interface with a method of bar and on the generic wrapper class the constuctor calls bar in the class that is being wrapped.

=> More informations about this toot | More toots from Spiritech@mastodon.social

Written by The Uberduck on 2024-08-22 at 22:56

@Spiritech I'm trying to avoid having to implement every method that foo might have in the wrapper individually, since that's likely to be an enormous amount of boilerplate code and will not be extensible in the slightest.

Something like this: https://keegoo.github.io/notes/2018/03/12/method-missing-in-python.html

=> More informations about this toot | More toots from uberduck@hachyderm.io

Written by Spiritech on 2024-08-22 at 23:05

@uberduck abstract class godot may have some quirks with syntax https://www.reddit.com/r/godot/comments/17e752a/abstract_class_problem_in_c/

=> More informations about this toot | More toots from Spiritech@mastodon.social

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113007806185667159
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
310.272014 milliseconds
Gemini-to-HTML Time
2.323528 milliseconds

This content has been proxied by September (ba2dc).