sergiotaborda / lense-lang

The Lense Language Compiler
1 stars 0 forks source link

Collection literals #25

Closed sergiotaborda closed 7 years ago

sergiotaborda commented 8 years ago

Allow collections to be defined by literals. Literal defined collections are always immutable. however immutable collections can be assigned to mutable ones. This uses the implicit constructor mechanic to copy the immutable collection to the mutable one

Sequence a = [2, 4, -5, 6, 7]; Array a = [2, 4, -5, 6, 7];

Association<String, String> family = { "mom": "Carol" , "dad": "Steven" , "son": "Geroge" }; Map<Natural, String> numbers = { 1 : "One" , 2 : "Two" };

// Tuples (String , Integer) pair = ("Route" , 66 ); (String , Integer, Boolean ) pair = ("Route" , 66 , true );