{"action":"closed","issue":{"url":"https://api.github.com/repos/imagej/imagej-ops/issues/176","repository_url":"https://api.github.com/repos/imagej/imagej-ops","labels_url":"https://api.github.com/repos/imagej/imagej-ops/issues/176/labels{/name}","comments_url":"https://api.github.com/repos/imagej/imagej-ops/issues/176/comments","events_url":"https://api.github.com/repos/imagej/imagej-ops/issues/176/events","html_url":"https://github.com/imagej/imagej-ops/issues/176","id":98730081,"number":176,"title":"Clarify OpMethods","user":{"login":"Squareys","id":1889284,"avatar_url":"https://avatars.githubusercontent.com/u/1889284?v=3","gravatar_id":"","url":"https://api.github.com/users/Squareys","html_url":"https://github.com/Squareys","followers_url":"https://api.github.com/users/Squareys/followers","following_url":"https://api.github.com/users/Squareys/following{/other_user}","gists_url":"https://api.github.com/users/Squareys/gists{/gist_id}","starred_url":"https://api.github.com/users/Squareys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squareys/subscriptions","organizations_url":"https://api.github.com/users/Squareys/orgs","repos_url":"https://api.github.com/users/Squareys/repos","events_url":"https://api.github.com/users/Squareys/events{/privacy}","received_events_url":"https://api.github.com/users/Squareys/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/imagej/imagej-ops/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"LeonYang5114","id":9411485,"avatar_url":"https://avatars.githubusercontent.com/u/9411485?v=3","gravatar_id":"","url":"https://api.github.com/users/LeonYang5114","html_url":"https://github.com/LeonYang5114","followers_url":"https://api.github.com/users/LeonYang5114/followers","following_url":"https://api.github.com/users/LeonYang5114/following{/other_user}","gists_url":"https://api.github.com/users/LeonYang5114/gists{/gist_id}","starred_url":"https://api.github.com/users/LeonYang5114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeonYang5114/subscriptions","organizations_url":"https://api.github.com/users/LeonYang5114/orgs","repos_url":"https://api.github.com/users/LeonYang5114/repos","events_url":"https://api.github.com/users/LeonYang5114/events{/privacy}","received_events_url":"https://api.github.com/users/LeonYang5114/received_events","type":"User","site_admin":false},"milestone":null,"comments":14,"created_at":"2015-08-03T12:08:29Z","updated_at":"2016-04-27T18:51:24Z","closed_at":"2016-04-27T18:51:24Z","body":"Hello everybody!\r\n\r\nI'd like to clarify how OpMethods in `Namespace` implementations and `OpService` should look like. Consider a common op hierarchy for a statistical max op:\r\n - `Op.Stat.Max`\r\n - `MaxOp`\r\n - `DefaultMax`\r\n\r\nTwo variants for its OpMethods are possible.\r\n - first:\r\n```\r\n@OpMethod(op = net.imagej.ops.stat.max.DefaultMaxFilter.class)\r\npublic <T extends RealType<T>> T max(final T out, final Iterable<T> input)\r\n{\r\n\tfinal T result =\r\n\t\t(T) ops().run(net.imagej.ops.stat.max.DefaultMax.class, out, input);\r\n\treturn result;\r\n}\r\n```\r\n - second:\r\n```\r\n@OpMethod(op = net.imagej.ops.stat.max.DefaultMaxFilter.class)\r\npublic <T extends RealType<T>> T max(final T out, final Iterable<T> input)\r\n{\r\n\tfinal T result = (T) ops().run(Ops.Stat.Max.class, out, input);\r\n\t//                           ! ^^^^^^^^^^^^\r\n\treturn result;\r\n}\r\n```\r\n\r\nIn my opinion, the second version is the \"correct\" one. That is because the first one prevents Ops from choosing the best option (which is one of its big features after all). A more optimized version for a compatible set of parameters could be never be chosen.\r\n\r\nThe second one allows this, though. Both are accepted by the NamespaceTest, but if missing, the test will suggest the first one.\r\n\r\nIs my thinking correct, or did I miss something?\r\n\r\nGreetings, Squareys."}}