work in progress | array


proposal for class ARRAY

Refine the specification of resize

Proposal

Refine the specification of feature 'resize':
resize (min_index, max_index: INTEGER)
   -- Resize to bounds `min_index' and `max_index'.
   -- Do not lose any item whose index is in both
   -- `lower..upper' and `min_index..max_index'.
require
   valid_bounds: min_index <= max_index + 1
ensure
   new_lower: lower = min_index
   new_upper: upper = max_index
   default_if_too_small:
      min_index < old lower implies 
          subarray (min_index, max_index.min (old lower - 1)).all_default
   default_if_too_large:
      max_index > old upper implies
          subarray (min_index.max (old upper + 1), max_index).all_default
   stable_in_intersection:
      subarray ((min_index.max (old lower)).min(old upper + 1), 
               (max_index.min (old upper)).max(old lower - 1)).same_items
      (old subarray ((min_index.max (lower)).min(upper + 1), 
                     (max_index.min (upper)).max(lower - 1)))

History

This feature is implemented by every vendor. However, the behaviour described here differs from the current behaviour of ISE and HACT.

Impact of proposed change

This change has the potential to break some ISE or HACT code because the proposed specification allows an ARRAY to be reduced in size, whereas the current ISE and HACT behaviour allows the ARRAY to increase in size only. This change appears to be acceptable to all vendors.

Result

The proposal was accepted.

votes cast at eGroups:

Accept the proposal
                sergei_ivano-@object-tools.com
                franck.arnau-@omgroup.com
                eric-@gobosoft.com
                pete-@deakin.edu.au
                manu-@eiffel.com
                wagne-@ti.uni-trier.de
                jweiric-@one.net
                jc-@rh.edu
                saunder-@wchat.on.ca
                kwaxe-@aha.ru