You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Ittay Dror (JIRA)" <ji...@apache.org> on 2008/10/22 09:30:44 UTC
[jira] Created: (BUILDR-184) when creating a sub project, extend it
with the parent's methods
when creating a sub project, extend it with the parent's methods
----------------------------------------------------------------
Key: BUILDR-184
URL: https://issues.apache.org/jira/browse/BUILDR-184
Project: Buildr
Issue Type: Wish
Affects Versions: 1.3.2
Reporter: Ittay Dror
sometimes it is required to override methods in Project. my use case is that I'd like to override 'id' from package
i think it would be nice if i could do:
define 'base'
def id
...
end
define 'sub'
end
end
so that 'sub' inherits the redifinition of id.
it will also have benefits for utility methods since it means i can just call it directly, not through 'parent' (or parent.parent in case of more level of nesting)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (BUILDR-184) when creating a sub project, extend
it with the parent's methods
Posted by "Alex Boisvert (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/BUILDR-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex Boisvert resolved BUILDR-184.
----------------------------------
Resolution: Won't Fix
I tend to agree here; I'm not sure inheritance is a good default and there's already good mechanisms in Ruby/Buildr to make this painless where needed.
> when creating a sub project, extend it with the parent's methods
> ----------------------------------------------------------------
>
> Key: BUILDR-184
> URL: https://issues.apache.org/jira/browse/BUILDR-184
> Project: Buildr
> Issue Type: Wish
> Affects Versions: 1.3.2
> Reporter: Ittay Dror
>
> sometimes it is required to override methods in Project. my use case is that I'd like to override 'id' from package
> i think it would be nice if i could do:
> define 'base'
> def id
> ...
> end
> define 'sub'
> end
> end
> so that 'sub' inherits the redifinition of id.
> it will also have benefits for utility methods since it means i can just call it directly, not through 'parent' (or parent.parent in case of more level of nesting)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (BUILDR-184) when creating a sub project, extend
it with the parent's methods
Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/BUILDR-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839386#action_12839386 ]
Antoine Toulme commented on BUILDR-184:
---------------------------------------
Better use the flexibility and power of Ruby: define whatever changes you want to make to the project in a separate module, and then extend the project with it:
module IdRedefinition
def id
...
end
end
define 'foo' do
extend IdRedefinition
define 'sub' do
extend IdRedefinition
end
define 'bar' do
end
end
See that bar this way isn't using this special id method.
If you'd like all projects in the file to use the module, then you can use the Extension mechanism and include it in Project.
> when creating a sub project, extend it with the parent's methods
> ----------------------------------------------------------------
>
> Key: BUILDR-184
> URL: https://issues.apache.org/jira/browse/BUILDR-184
> Project: Buildr
> Issue Type: Wish
> Affects Versions: 1.3.2
> Reporter: Ittay Dror
>
> sometimes it is required to override methods in Project. my use case is that I'd like to override 'id' from package
> i think it would be nice if i could do:
> define 'base'
> def id
> ...
> end
> define 'sub'
> end
> end
> so that 'sub' inherits the redifinition of id.
> it will also have benefits for utility methods since it means i can just call it directly, not through 'parent' (or parent.parent in case of more level of nesting)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.