HaloO Autrijus, you wrote:
I think that's because you live in the static realm already. :)
Perhaps, but if yes it is an infinite one.
my $x is typed; $x = "123"; $x = length($x); Would be a type error. If it's in the dynamic world (as in Perl5), that's just fine. Does that difference make sense to you?
The question remains, when exactly does $x acquire its constraint and how long does it persist? For my vars it's easy to say: "from first assignment of none(Undef).does(Item) to end of scope". Which in the above code gives: the first assignment puts a Str into $x and if &length returns an Int the second assignment fails. This is what I understand. But how usefull is this feature? I mean the programmer who reads 'my Int $x' knows that everything that is true for an Int is true wherever $x is subsequently used. A 'my $x is typed' pretty much means: "read on and find out what type $x aquires". Do you have a non-trivial application for this in mind? It reminds me a bit to the 'bind a variable once in the constraint store' of the constraint programming paradigma. But there it serves as guiding the control flow. What is the purpose in a typed, imperative language as Perl6? -- $TSa.greeting := "HaloO"; # mind the echo!