Fandom

Planet JFX

Maps and Sequences

118pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Maps are useful and powerful in a programming language and other scripting languages in this space provide them.

Sequences which are already in JavaFX are simply a special case of maps. The consensus is that maps should be added to JavaFX.

Previously, the pros and cons of sequences being orthogonal-to vs part-of the type were discussed here. The sense of the group was leaning towards sequence being part of the type. With the extension to maps, inclusion in the type is the only reasonable choice. Specifically, this means that maps and sequences are Objects. And it is generally felt that they should be immutable -- though some additional investigation of this is desired. Sequences are ordered, the consensus was that maps should be as well.

The syntax of maps was not determined. But this example is included to provide a sense.

var myMap : Integer[String];
...
for ( x in myMap ) {
   ... indexof x  ...  // key
}

A possible form for literals is

[ expr : expr, expr : expr, ... ]

Though there was concern about the overloading of ":".

A proposal for tuples combined with first-class arrays. Maps are discussed in the related (follow-in) proposals are Tuples_and_Maps, and pattern matching in Patterns.

An alternative proposal Sequences_are_Tuples shares some ideas with the above, but doesn't have (nestable) arrays, only (non-nestable) sequences.

Back to OpenJFX Compiler

Also on Fandom

Random Wiki