Typed Pairs

2019-09-05 Thread Mikkel
Hello I am wondering whether it is possible to define a Pair with a key and a value of a specific class. Suppose I want an Array of Pairs with keys as Str and values as Array of Str called "properties". And define it as a instance variable.Something of the likes: has Pair[Str, Array[Str]] @!prop

Re: Typed Pairs

2019-09-05 Thread yary
this looks like two questions- typing Array contents - see Typing Syntax is "my @bucket of TypedThings;" typing a Pair > my Pair[Str, Array[Str]] $x; ===SORRY!=== Error while compiling: An exception occurred while parameterizing Pair at :1 Exception

Re: Typed Pairs

2019-09-05 Thread Timo Paulssen
You can try defining a subset type a bit like this: subset StrArrStrsPair of Pair where .key ~~ Str && .value ~~ Positional[Str]; Please be aware that the arrays have to be explicitly created with the type constant of Str for this to work. On 5 September 2019 14:34:05 CEST, Mikkel wrote: >Hell