Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Upgrade into split-system #7

Open
H1M4W4R1 opened this issue Jun 18, 2023 · 4 comments
Open

Upgrade into split-system #7

H1M4W4R1 opened this issue Jun 18, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@H1M4W4R1
Copy link
Owner

H1M4W4R1 commented Jun 18, 2023

Also known as splitting method AOP code into separate sub-objects. Will also fix #2 however it requires a bit of coding and bugfixing to prevent issues.

According to SharpLab experiments there might be a slight issue with amount of IL code required to be implemented into method.

@gmrodriguez124 This is what I initally meant, however implementation will be painful to code... (see https://github.com/H1M4W4R1/Unity-Aspect-Oriented-Programming/tree/upgrade-noruntime)

@H1M4W4R1 H1M4W4R1 added the enhancement New feature or request label Jun 18, 2023
@H1M4W4R1 H1M4W4R1 self-assigned this Jun 18, 2023
@H1M4W4R1
Copy link
Owner Author

Note for self: getting rid of reflection is pretty much impossible due to attribute usage... Alternatives is to use static methods in attributes (losing option to use attribute parameters)... Needs to be reconsidered.

@H1M4W4R1
Copy link
Owner Author

H1M4W4R1 commented Jun 18, 2023

  • Implement Event Aspect Processing
  • Implement new subsystem for aspect variable sharing (or rework AspectData to be shared between aspects during single block execution)
  • Field aspects? - ignored, too many potential issues, workaround available
  • Rework Event (Invoke) Aspect Processing to implement arguments (etc.) - ignored, too many potential issues, workaround available
  • Implement Try-Catch for method encapsulation to catch method exceptions
  • Create Unit Tests

@gmrodriguez124
Copy link

gmrodriguez124 commented Jun 18, 2023

Note for self: getting rid of reflection is pretty much impossible due to attribute usage... Alternatives is to use static methods in attributes (losing option to use attribute parameters)... Needs to be reconsidered.

If it's impossible, what about just switching to caching the reflections on compile? I am not sure if something along the lines of CreateDelegate would be possible specifically on compile - but if the user's project allows for it, a one time cost at initial runtime could be an option to speed up the invocation by about ~65% based on some scattered benchmarks I've seen this past week

Supports AOT on webgl and should work on platforms like IOS and Android

@H1M4W4R1
Copy link
Owner Author

H1M4W4R1 commented Jun 18, 2023

If it's impossible, what about just switching to caching the reflections on compile?

But you still need to access all instances of specific attribute on specific member to call their methods... At least getting rid of MethodBase::Invoke() is a good start...

Copying bodies is out of scope, because it would lose possibility to override arguments/throws/return value etc.

Note for future self:
a) check if attributes can be cached during generation by using this keyword during initialization.
b) while implementing exception aspects make sure to add option to validate source of exception (Aspect or Method itself)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants