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

Can't use other modules macros while using decorator #37

Open
FrancescoZ opened this issue Feb 3, 2020 · 2 comments
Open

Can't use other modules macros while using decorator #37

FrancescoZ opened this issue Feb 3, 2020 · 2 comments

Comments

@FrancescoZ
Copy link

While using decorator with Spandex i'm not able to add another use in sequence:

defmodule Fetcher.Info do
  use Spandex.Decorators
  use Interceptor.Annotation

 @intercept true
 @decorate span(type: :backend)
 def retrieve_information(resource_uuid) do
      #mycode
 end
end

Using this code I get the following warning:

warning: this clause cannot match because a previous clause at line 1 always matches
  lib/fetcher/info.ex:1

Could it be useful to insert something like this?

Module.register_attribute __MODULE__, :decorate, accumulate: true

To allow the macros to be used as a list and not overwrite the previous.
I think this would also help the #29, what do you think?

@arjan
Copy link
Owner

arjan commented Feb 3, 2020

Hmm, have not looked at this for a while; but it seems this register attribute already happens when you use the decorator. So something else must be going on?

@FrancescoZ
Copy link
Author

FrancescoZ commented Feb 5, 2020

mmmm from a really superficial analysis it seems that the redefinition of __using__ do not allow other module to do the same. I'm trying to deeper in this direction

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

2 participants