moosetechnology / Fame

Fame is a meta-modeling framework for executable models.
MIT License
4 stars 10 forks source link

FMMultivalueLink inherits from SequenceableCollection #65

Closed Gabriel-Darbord closed 9 months ago

Gabriel-Darbord commented 9 months ago

Instead of Collection.

Add new: to be compatible with the SequenceableCollection API. Add setCollection: to make new: work with the intended pre-sizing mechanism. Remove hash and first to ninth because they are defined in SequenceableCollection.

This might make FMMultivalueLink faster because of the optimized versions of select:thenCollect:&co, although I haven't tried it.

I'm also considering about removing the = method, which only differs from SequenceableCollection's by calling asOrderedCollection on the other collection, but that may be unnecessary (and thus slower for no reason).

    self == otherCollection ifTrue: [^ true].
    self species == otherCollection species ifFalse: [^ false].
    ^ values hasEqualElements: otherCollection "=>" asOrderedCollection "<= unnecessary?"
Gabriel-Darbord commented 9 months ago

The tests pass but this doesn't work as expected: we get errors when using basic Collection methods like collect:.

jecisc commented 9 months ago

Do we revert?