HaloO, Larry Wall wrote:
Yes. The only thing I don't like about it is that any() isn't an Any. Maybe we should rename Any to Atom. Then maybe swap Item with Atom, since in colloquial English you can say "that pair of people are an item."
Since we are in type hierachies these days, here's my from ::Any towards ::All version. The "bottom" part where everything finds together is missing for this installment. ::Any ............... | .......................... _______:_____|_____:________ static type : | : | : | | = context : Package : | : Void Bool : | : | :......................... Module : | ___|___ : | | | : | Class Grammar : | |_______| : | | : | Role : Object : |____________________________ : | | | | : &Code @Array %Hash $Item : | / / | with : | Tuple Record | invocant(s) : | | ____:____/ \______ __________________|_________________ | : | | \ / | | | | | .Method : Sub Block | | Inf Undef Match Junction /| : |\ | | / | : | \ Ref[Code] | Rule | : | Macro | |____:_/| __________/|\____ | : | | | | | Multi : | ~Str +Num \Ref :Pair ..............: | | | |\ | | | Int | \ | ___________/| | ____|____ | Entry[::T where T.does(Hash)] | | | |/ | \| *List Pipe =Iterator Enum ?Bit Pos[::T where T.does(Str|Array)] |\___________ | | | **Eager Lazy Ref[Array|Hash] any() == lub( all ---> any ) == glb( any --> all ) lesser --> greater all() == glb( all ---> any ) == lub( any --> all ) Some operators and prefixes are added in to show their relation to the corresponding type. I hope it looks familiar. Here is some pseudo code that describes a bare minimum data layout required to support the respective types. type Item[::T] { has $.value of T; } type Pair[::T] { has $.key; has $.value of T; } type Tuple[::T where T does lub( @.values )] # lub = least upper bound { has @.values of T; has $.value ::= @.values; # auto-enreference for Item subtyping has T $.head ::= @.values[0]; has T $.tail ::= @.values[-1]; } type Record[::T where T does lub( @.values )] { has @.keys; has @.values of Pair[T]; has @.pairs ::= { zip @.keys, @.values }; has $.value ::= @.pairs; } type Code { has %.MY; # lexical scratchpad has &.block; has $.value ::= { use %.MY; &.block() }; # coderef literal } type Junction[::T where enum <any all one none>] { has @.values; has Junction $.value ::= { @.values as Junction[T] }; has &.evaluate ::= &::JUNCTION_MAGIC; # what's the exact type of this? } -- $TSa.greeting := "HaloO"; # mind the echo!