Don't repeat yourself!

Don't repeat yourself!

TCollectionNotification is declared twice. One resides in System.Classes and another one in System.Generics.Collections.

https://quality.embarcadero.com/browse/RSP-19791
https://quality.embarcadero.com/browse/RSP-19791

Comments

  1. Probably can't fix (without breaking change or much extra effort) as they are different (personally I would not mind small breaking changes to clean up crap like that but you know...).

    Classes:
    TCollectionNotification = (cnAdded, cnExtracting, cnDeleting);

    Generics.Collections:
    TCollectionNotification = (cnAdded, cnRemoved, cnExtracted);

    ReplyDelete
  2. Stefan Glienke The differences should be negligible. To make it almost completely compatible one could do it this way:

    { System.Types }
    type
    TCollectionNotification = (cnAdded, cnExtracting, cnDeleting);

    { System.Classes }
    type
    TCollectionNotification = System.Types.TCollectionNotification;

    { System.Generics.Collection }
    type
    TCollectionNotification = System.Types.TCollectionNotification;

    const
    cnRemoved = cnDeleting;
    cnExtracted = cnExtracted;

    As long as nobody uses Ord(), Succ() or Pred() or even has stored one of those values somewhere...

    ReplyDelete

Post a Comment