Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#207 Collections # 2: Please consider default implementation of s

v3.2.0
closed
None
5
2012-08-14
2007-07-16
No

It would be conceivable to supply a default implementation for the methods "allIndexes", "allItems", "hasIndex", "hasItem", "items" and "makeArray" in the class "Collection". If so, then "makeArray" needs to be implemented for the "OrderedCollection" class as well (returning "allItems').

Doing so would allow anyone who defines a collection class to merely implement the methods "at", "[]", "put", "[]=", "supplier". If performance is important, then the default implementations could be overridden.

These would be the suggested default implementations, which could be overridden in subclasses:

ad Class "Collection":

::method "allIndexes" / return an "allIndexes" array /
return self~supplier~allIndexes

::method "allItems" / return an "allItems" array /
return self~supplier~allItems

::method "hasIndex"
use strict arg index
return self~supplier~allIndexes~hasItem(index)

::method "hasItem"
use strict arg item
return self~supplier~allItems~hasItem(item)

::method items
return self~supplier~allIndexes~items

::method makeArray / return index array /
return self~supplier~allIndexes

ad Class "OrderedCollection":

::method makeArray / return item array /
return self~supplier~allItems

Discussion

  • Rick McGuire
    Rick McGuire
    2007-07-19

    Logged In: YES
    user_id=1125291
    Originator: NO

    This RFE has been examined, and has been determined to be inline with
    the goals of the ooRexx language. This is not a commitment that this
    feature will be implemented, but this will remain open until someone in
    the ooRexx community chooses to implement the feature.

    Any committer who wishes to work on this feature should assign the
    feature to themselves when they begin. Any non-committer who wishes to
    work on this should indicate their interest by adding a comment to the
    RFE.

     


Anonymous


Cancel   Add attachments