# New Ticket Created by Ovid
# Please include the string: [perl #61776]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61776 >
subset Letter of Str where { $_ =~ /^ <[a..z]> $/ };
my $first_letter = 'a';
say $first_letter;
my Letter $second_letter = 'a';
say $second_letter;
sub doit (Letter $letter) {
say $letter;
}
doit('a');
That outputs (_block69 is the second 'say' and the 'Cannot assign' is the sub
call):
a
_block69
Cannot assign to readonly variable.
current instr.: 'die' pc 14740 (src/builtins/control.pir:204)
called from Sub 'infix:=' pc 13106 (src/builtins/assign.pir:24)
called from Sub '_block62' pc 310 (EVAL_14:128)
called from Sub '!SUBTYPE_ACCEPTS' pc 15909 (src/builtins/guts.pir:237)
called from Sub '!TYPECHECKPARAM' pc 15676 (src/builtins/guts.pir:128)
called from Sub 'doit' pc 527 (EVAL_14:212)
called from Sub '_block14' pc 200 (EVAL_14:83)
called from Sub '!UNIT_START' pc 16073 (src/builtins/guts.pir:327)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 892
(src/PCT/HLLCompiler.pir:508)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1217
(src/PCT/HLLCompiler.pir:669)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1398
(src/PCT/HLLCompiler.pir:759)
called from Sub 'parrot;Perl6;Compiler;main' pc 18981 (perl6.pir:162)
perl6(8003) malloc: *** error for object 0x2bcc680: double free
*** set a breakpoint in malloc_error_break to debug
My info:
$ svn info; uname -a
Path: .
URL: https://svn.perl.org/parrot/trunk
Repository Root: https://svn.perl.org/parrot
Repository UUID: d31e2699-5ff4-0310-a27c-f18f2fbe73fe
Revision: 34446
Node Kind: directory
Schedule: normal
Last Changed Author: kjs
Last Changed Rev: 34446
Last Changed Date: 2008-12-27 21:17:55 +0000 (Sat, 27 Dec 2008)
Darwin curtis-poes-computer-3.local 9.5.1 Darwin Kernel Version 9.5.1: Fri Sep
19 16:19:24 PDT 2008; root:xnu-1228.8.30~1/RELEASE_I386 i386
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6