Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aspect not triggered #1

Open
mlomnicki opened this issue Nov 6, 2012 · 4 comments
Open

Aspect not triggered #1

mlomnicki opened this issue Nov 6, 2012 · 4 comments

Comments

@mlomnicki
Copy link

Hello guys,

Many thanks for You Are Da Bomb. Mostly, it works great for me. Except when it doesn't :)

Please take a look at the following snippet

After(@usecase, 'userActivatedAnAccount', @serverSide.activateAccount)

Before(@serverSide, 'activateAccount', @gui.showProgressIndicator)

As expected, the @serverSide.activateAccount method is called. After that I expect @gui.showProgressIndicator to be called as well. Unfortuantely it isn't.
I have to wrap activateAccount to make it work.

After(@usecase, 'userActivatedAnAccount', (args...) => @serverSide.activateAccount(args...))

Is that wrapper really needed? Can we avoid it somehow?

Here's a jsfiddle which shows that issue http://jsfiddle.net/dv3uV/

@nthx
Copy link

nthx commented Nov 6, 2012

Switch order of declaration :/

Unfortunately former declaration (Before) modifies "activateAccount" method to be a new one (a wrapper) that calls it's older body + gui.showProgressIndicator

While your "After" declared original "activateAccount" to be invoked, and it will be ...

That's how DaBomb works and nothing we can do about it. It's not AspectJ.. just simple method wrappers... :-(

@mlomnicki
Copy link
Author

Thanks for explaining but that's sad story my friend. Very sad...

Does it have to be implemented on method wrappers? What if we add 2 arrays to each "aspectized" object. One array with references to before aspects and the second to after aspects? It sounds naive but maybe it will work in more reliable and predictable way than current implementation? What do you think?

@nthx
Copy link

nthx commented Nov 7, 2012

of course. just what will run those fns from arrays? tell me how and you win a prize!

@piecioshka
Copy link
Contributor

@nthx I think you can do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants