Associative Array Types
WiP.AssociativeArrayTypes History
Hide minor edits - Show changes to markup
Added lines 1-2:
=== This page is now outdated ===
Changed line 76 from:
PROCEDURE [FOR] nextValue ( dict : Dictionary; VAR key : ARRAY OF CHAR; value : <valueType> );
to:
PROCEDURE [FOR] nextValue ( dict : Dictionary; VAR key : ARRAY OF CHAR; VAR value : <valueType> );
Changed lines 76-77 from:
PROCEDURE [FOR] nextValue ( dict : Dictionary; VAR key : ARRAY OF CHAR ) : <valueType>;
to:
PROCEDURE [FOR] nextValue ( dict : Dictionary; VAR key : ARRAY OF CHAR; value : <valueType> );
Added lines 83-84:
Changed line 76 from:
PROCEDURE [FOR] nextValue ( dict : Dictionary; key : ARRAY OF CHAR ) : <valueType>;
to:
PROCEDURE [FOR] nextValue ( dict : Dictionary; VAR key : ARRAY OF CHAR ) : <valueType>;
Changed line 11 from:
- obtain entry count:
entryCount := LENGTH(dict); or entryCount := COUNT(dict);
to:
- obtain entry count:
entryCount := COUNT(dict);
Deleted lines 27-36:
LENGTH or COUNT
Regardless of how associative array types would be constructed, the user syntax to obtain the number of entries stored in an associative array would either repurpose the existing pervasive function LENGTH or it would require a new pervasive function COUNT .
entryCount := LENGTH(dict);
entryCount := COUNT(dict);
The latter would certainly be clearer. A pervasive function COUNT could also be useful in combination with enumeration and SET types.
Added line 10:
- iterate over all entries:
FOR item IN dict DO ... END;
Added lines 85-86:
PROCEDURE [FOR] nextValue ( dict : Dictionary; key : ARRAY OF CHAR ) : <valueType>;
Changed lines 107-118 from:
to:
[@DEFINITION MODULE Search Tree?;
TYPE Search Tree? = OPAQUE; (* any unspecified opaque type is considered a collection *)
TYPE Search Tree? = OPAQUE DICTIONARY; (* alternatively this, or ... *)
TYPE Search Tree? = DICTIONARY; (* another possible alternative *)
TYPE Search Tree? = OPAQUE COLLECTION; (* yet another alternative *)
TYPE Search Tree? = COLLECTION; (* yet another alternative *)
Changed line 121 from:
to:
Deleted lines 97-98:
to introduce a new reserved word DICTIONARY or COLLECTION to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that make them indistinguishable from the built in variant.
Changed line 105 from:
to:
TYPE Dictionary = COLLECTION OF Value Type?; (* alternative *)@]
Changed line 97 from:
The built in type constructor would be the convenient general use tool, like CARDINAL , INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD , COMPLEX and vector types are for numerics.
to:
The built in type constructor would be the convenient general use tool, like CARDINAL , INTEGER and REAL for numerics, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for more specialised uses, just like library defined BCD , COMPLEX and vector types are for numerics.
Changed line 99 from:
to introduce a new reserved word DICTIONARY or COLLECTION to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that makes them indistinguishable from the built in variant.
to:
to introduce a new reserved word DICTIONARY or COLLECTION to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that make them indistinguishable from the built in variant.
Changed lines 40-41 from:
Associative array types could be constructed by extending the ARRAY type constructor syntax and semantics. In any case it is assumed that the retrieval key for associative arrays will always be of type ARRAY OF CHAR .
to:
Associative array types could be constructed by extending the ARRAY type constructor syntax and semantics. In any case it is assumed that the retrieval key for associative arrays will always be of type ARRAY OF CHAR .
Changed line 97 from:
The built in type constructor would be the convenient general use tool, like CARDINAL , INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD, complex and vector types are for numerics.
to:
The built in type constructor would be the convenient general use tool, like CARDINAL , INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD , COMPLEX and vector types are for numerics.
Changed line 97 from:
The built in type constructor would be the convenient general use tool, like CARDINAL, INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD, complex and vector types are for numerics.
to:
The built in type constructor would be the convenient general use tool, like CARDINAL , INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD, complex and vector types are for numerics.
Changed lines 59-60 from:
Another alternative would be ...
to:
Other alternatives would be ...
Changed lines 65-67 from:
but these would require a new reserved word.
to:
TYPE Dictionary = COLLECTION OF ValueType;
any of these would require a new reserved word.
Changed lines 97-98 from:
to introduce a new reserved word ASSOCIATIVE or DICTIONARY to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that makes them indistinguishable from the built in variant.
to:
to introduce a new reserved word DICTIONARY or COLLECTION to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that makes them indistinguishable from the built in variant.
Changed lines 101-102 from:
TYPE Dictionary = DICTIONARY OF ValueType;
to:
TYPE Dictionary = DICTIONARY OF ValueType;
TYPE Dictionary = COLLECTION OF ValueType;
Added lines 114-117:
Changed line 103 from:
Library defined variant ...
to:
Library defined complement ...
Changed line 101 from:
TYPE Dictionary = DICTIONARY OF Employee;
to:
TYPE Dictionary = DICTIONARY OF ValueType;
Changed lines 99-100 from:
The builtin associative array constructor could use a new reserved word ...
to:
Builtin associative array constructor ...
Changed line 103 from:
and the library variant could use the same reserved word to declare the new type as a collection type so that the compiler can make sense of the bindings supplied ...
to:
Library defined variant ...
Changed lines 107-109 from:
to:
TYPE Patricia Trie? = OPAQUE; (* any unspecified opaque type is considered a collection *)
TYPE Patricia Trie? = OPAQUE DICTIONARY; (* alternatively this, or ... *)
TYPE Patricia Trie? = DICTIONARY; (* another possible alternative *)
Changed lines 93-94 from:
The best solution might be to introduce a new reserved word ASSOCIATIVE or DICTIONARY to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that makes them indistinguishable from the built in variant.
to:
The best solution might be a combined approach.
The built in type constructor would be the convenient general use tool, like CARDINAL, INTEGER and REAL for numeric types, and library defined collection types that use bindings to provide the same syntax as used with the built in variant would be for specialised uses, just like library defined BCD, complex and vector types are for numerics.
to introduce a new reserved word ASSOCIATIVE or DICTIONARY to facilitate the ease of use of a builtin type constructor whilst at the same time allow library defined abstract data types to define bindings that makes them indistinguishable from the built in variant.
The builtin associative array constructor could use a new reserved word ...
Added lines 103-104:
and the library variant could use the same reserved word to declare the new type as a collection type so that the compiler can make sense of the bindings supplied ...
Changed lines 107-109 from:
to:
|