couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxepal <...@git.apache.org>
Subject [GitHub] couchdb-couch-epi pull request: Implement 'couch_epi:is_defined_by...
Date Tue, 25 Aug 2015 07:40:09 GMT
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch-epi/pull/6#discussion_r37840214
  
    --- Diff: src/couch_epi_functions_gen.erl ---
    @@ -61,6 +63,23 @@ apply(Handle, _ServiceId, Function, Args, Opts) ->
         Modules = providers(Handle, Function, length(Args), DispatchOpts),
         dispatch(Handle, Modules, Function, Args, DispatchOpts).
     
    +-spec defined_by_app(
    +    Handle :: atom(), SourceApp :: atom(),
    +    Function :: atom(), Arity :: pos_integer()) ->
    +        list().
    +defined_by_app(Handle, SourceApp, Function, Arity) ->
    +    try
    +        ModulesBySource = [
    +            M || {M, _} <- get_current_definitions(Handle, SourceApp)
    +        ],
    +        ModulesByFunc = Handle:providers(Function, Arity),
    +        lists:filter(fun(I) ->
    +            lists:member(I, ModulesBySource)
    +        end, ModulesByFunc)
    +    catch
    +        error:undef -> false
    --- End diff --
    
    Also, I think you have here a bug: if undef error raised, in `is_defined_by_app/4` you'll
compare `[] /= false` which give you `true`, but don't think that's right answer,


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message