Commit c46dcbd8 authored by Alessandro Ghedini's avatar Alessandro Ghedini

Merge tag 'upstream/2012.10'

Upstream version 2012.10
parents 9a6a0249 96809731
*~
src/gen/*
nqp/
install/
......
New in 2012.10
+ :60[24, 59, 59] radix form
+ delegation to methods using the handles trait
+ fixed serialization of Buf
+ improved handling of :P5 regexes (more features, less bugs)
+ determining that an object lacks a method is usually now much faster
+ reduced memory usage of Match objects and optimized their construction a little
+ some code-generation improvements related to void context
+ implemented :dba('...') modifier in regexes
+ various error messages improved through use of :dba('...') in the Perl 6 grammar
+ implemented 'x' in pack
+ added $*CUSTOM-LIB
+ eval in a method can now see self, attributes and $?PACKAGE
+ each REPL line no longer implies a fresh GLOBAL
+ fixed some Pod parsing issues with Windows newlines
+ fixed interaction of :i and LTM (alternations and protoregexes now respect it)
+ import of custom meta-objects only affects the scope they are imported into
+ made <-> lambdas work
+ can now parse nested pairs of quote delimeters, like q{ foo q{ bar } baz }
New in 2012.09.1
+ is-prime and expmod
+ smart matching against Signature literals
......
Announce: Rakudo Perl 6 compiler development release #57 ("Tokyo")
On behalf of the Rakudo development team, I'm thrilled to announce the
October 2012 release of Rakudo Perl #57 "Tokyo". Rakudo is an
implementation of Perl 6 on the Parrot Virtual Machine (see
<http://www.parrot.org>). The tarball for this release
is available from <http://github.com/rakudo/rakudo/downloads>.
Please note: This announcement is not for the Rakudo Star
distribution[*] -- it's announcing a new release of the compiler only.
For the latest Rakudo Star release, see
<http://github.com/rakudo/star/downloads>.
The Rakudo Perl compiler follows a monthly release cycle, with each
release named after a Perl Mongers group. The October 2012 release is
code-named after Tokyo.pm, hosts of YAPC::Asia 2012.
This release brings changes; some of them are outlined below:
- delegation to methods using the handles trait
- improved handling of :P5 regexes
- reduced memory usage for Match objects
- each REPL line no longer implies a fresh GLOBAL
- import of custom meta-objects only affects the scope they are imported into
- can now parse nested pairs of quote delimeters, like q{ foo q{ bar } baz }
This is only a small peek at the changes in this release. For a more
detailed list, see "docs/ChangeLog".
The development team thanks all of our contributors and sponsors for
making Rakudo Perl possible, as well as those people who worked on
Parrot, the Perl 6 test suite and the specification.
The following people contributed to this release:
Jonathan Worthington, Moritz Lenz, Patrick R. Michaud, Solomon Foster,
diakopter, Timothy Totten
If you would like to contribute, see <http://rakudo.org/how-to-help>,
ask on the perl6-compiler@perl.org mailing list, or ask on IRC #perl6
on freenode.
The next release of Rakudo (#58) is scheduled for November 22, 2012. A
list of the other planned release dates and code names for future
releases is available in the "docs/release_guide.pod" file. In general,
Rakudo development releases are scheduled to occur soon after each Parrot
monthly release. Parrot releases the third Tuesday of each month.
On behalf of the development team, I encourage you to try the new release,
to live life to its fullest, to cherish each moment, and to have fun.
[*] What's the difference between the Rakudo compiler and the Rakudo
Star distribution?
The Rakudo compiler is a compiler for the Perl 6 language.
Nothing else.
The Rakudo Star distribution is the Rakudo compiler plus a selection
of useful Perl 6 modules, the most recent incarnation of the "Using
Perl 6" book, and other software that can be used with the Rakudo
compiler to enhance its utility. Rakudo Star is meant for early
adopters who wish to explore what's possible with Rakudo Perl 6 and
provide feedback on what works, what doesn't, and what else they
would like to see included in the distribution.
......@@ -11,6 +11,16 @@ Deprecations in 2012.10
This will change to make them equivalent to a one-level map.
Planned for the 2012.11 release.
~/.perl6/lib will go away from the default include path (@*INC).
Instead %*CUSTOM_LIB now holds paths to four library locations:
perl Rakudo installs its core modules here
vendor OS-level package managers should install their modules here
site for local module installations (e.g. with panda or ufo)
home like site, but always under the user's home directory.
fallback if site isn't writable.
Removal of ~/.perl6/lib from @*INC planned for the 2012.11 release
Deprecations in 2012.09
Str.capitalize and &capitalize are deprecated in favor
......
......@@ -58,12 +58,12 @@ part of monthly Parrot releases.
2012-08-23 Rakudo #55 "Frankfurt" (tadzik,moritz)
2012-09-20 Rakudo #56 "Perl" (masak)
2012-09-29 2012.09.1 (pmichaud)
2012-10-18 Rakudo #57 "Tokyo" (duff)
=head2 Planned 2012 releases
Dates are based on Parrot's expected release schedule.
2012-10-18 Rakudo #57 duff
2012-11-22 Rakudo #58
2012-12-20 Rakudo #59
2013-01-17 Rakudo #60
......
This diff is collapsed.
This diff is collapsed.
......@@ -66,6 +66,10 @@ class Perl6::Metamodel::ClassHOW
# and if it is calls $calculator with the object and method name to
# calculate an invokable object.
method add_fallback($obj, $condition, $calculator) {
# Adding a fallback means any method cache is no longer authoritative.
pir::set_method_cache_authoritativeness__vPi($obj, 0);
# Add it.
my %desc;
%desc<cond> := $condition;
%desc<calc> := $calculator;
......@@ -201,6 +205,7 @@ class Perl6::Metamodel::ClassHOW
my $junction_type;
my $junction_autothreader;
method setup_junction_fallback($type, $autothreader) {
pir::set_method_cache_authoritativeness__vPi($type, 0);
$junction_type := $type;
$junction_autothreader := $autothreader;
}
......@@ -225,4 +230,9 @@ class Perl6::Metamodel::ClassHOW
# Otherwise, didn't find anything.
nqp::null()
}
# Does the type have any fallbacks?
method has_fallbacks($obj) {
return nqp::istype($obj, $junction_type) || +@!fallbacks;
}
}
......@@ -23,6 +23,7 @@ role Perl6::Metamodel::MROBasedMethodDispatch {
# lower in the class hierarchy "shadowed" it.
my %cache;
my @mro_reversed;
my $authable := 1;
for self.mro($obj) {
@mro_reversed.unshift($_);
}
......@@ -30,6 +31,9 @@ role Perl6::Metamodel::MROBasedMethodDispatch {
for $_.HOW.method_table($_) {
%cache{$_.key} := $_.value;
}
if nqp::can($_.HOW, 'is_composed') && !$_.HOW.is_composed($_) {
$authable := 0;
}
}
# Also add submethods.
......@@ -37,6 +41,9 @@ role Perl6::Metamodel::MROBasedMethodDispatch {
%cache{$_.key} := $_.value;
}
pir::publish_method_cache__0PP($obj, %cache)
pir::publish_method_cache__0PP($obj, %cache);
unless nqp::can(self, 'has_fallbacks') && self.has_fallbacks($obj) {
pir::set_method_cache_authoritativeness__0Pi($obj, $authable);
}
}
}
......@@ -11,6 +11,9 @@ role Perl6::Metamodel::MethodContainer {
# Add a method.
method add_method($obj, $name, $code_obj) {
# Adding a method means any cache is no longer authoritative.
pir::set_method_cache_authoritativeness__vPi($obj, 0);
# Ensure we haven't already got it.
if nqp::existskey(%!methods, $name) || nqp::existskey(%!submethods, $name) {
nqp::die("Package '" ~ self.name($obj) ~ "' already has a method '" ~
......
......@@ -26,8 +26,6 @@ role Perl6::Metamodel::Mixins {
# If the original object was concrete, change its type by calling a
# low level op. Otherwise, we just return the new type object
nqp::isconcrete($obj) ??
pir::repr_change_type__0PP($obj, $new_type) !!
$new_type
nqp::isconcrete($obj) ?? nqp::rebless($obj, $new_type) !! $new_type
}
}
......@@ -33,6 +33,13 @@ my class RoleToClassApplier {
}
return 0;
}
sub has_public_attribute($target, $name) {
my @attributes := $target.HOW.attributes($target, :local(1));
for @attributes {
return 1 if nqp::substr($_.name, 2) eq $name && $_.has_accessor;
}
return 0;
}
method apply($target, @roles) {
# If we have many things to compose, then get them into a single helper
......@@ -82,7 +89,8 @@ my class RoleToClassApplier {
my $yada := 0;
try { $yada := $_.value.yada }
if $yada {
unless has_method($target, $name, 0) {
unless has_method($target, $name, 0)
|| has_public_attribute($target, $name) {
nqp::die("Method '$name' must be implemented by " ~
$target.HOW.name($target) ~
" because it is required by a role");
......
......@@ -482,7 +482,7 @@ class Perl6::World is HLL::World {
# Hunts through scopes to find the type of a lexical.
method find_lexical_container_type($name) {
my $i := +@!BLOCKS;
my int $i := +@!BLOCKS;
while $i > 0 {
$i := $i - 1;
my %sym := @!BLOCKS[$i].symbol($name);
......@@ -512,7 +512,7 @@ class Perl6::World is HLL::World {
self.add_object($parameter);
# Calculate flags.
my $flags := 0;
my int $flags := 0;
if %param_info<optional> {
$flags := $flags + $SIG_ELEM_IS_OPTIONAL;
}
......@@ -522,6 +522,9 @@ class Perl6::World is HLL::World {
if %param_info<is_multi_invocant> {
$flags := $flags + $SIG_ELEM_MULTI_INVOCANT;
}
if %param_info<is_rw> {
$flags := $flags + $SIG_ELEM_IS_RW;
}
if %param_info<is_copy> {
$flags := $flags + $SIG_ELEM_IS_COPY;
}
......@@ -1072,9 +1075,9 @@ class Perl6::World is HLL::World {
method add_constant($type, $primitive, :$nocache, *@value, *%named) {
# If we already built this, find it in the cache and
# just return that.
my $cache_key;
my str $cache_key;
if !$nocache {
my $namedkey := '';
my str $namedkey := '';
for %named {
$namedkey := $namedkey ~ $_.key ~ ',' ~ $_.value ~ ';'
if nqp::defined($_.value);
......@@ -1297,7 +1300,7 @@ class Perl6::World is HLL::World {
# Adds a value to an enumeration.
method create_enum_value($enum_type_obj, $key, $value) {
# Create directly.
my $val := pir::repr_change_type__0PP(pir::repr_clone__PP($value), $enum_type_obj);
my $val := nqp::rebless(pir::repr_clone__PP($value), $enum_type_obj);
nqp::bindattr($val, $enum_type_obj, '$!key', $key);
nqp::bindattr($val, $enum_type_obj, '$!value', $value);
self.add_object($val);
......@@ -1476,13 +1479,14 @@ class Perl6::World is HLL::World {
~$!match
}
# Gets the name, without any adverbs.
method name(:$decl, :$dba = '') {
# Gets the name, by default without any adverbs.
method name(:$decl, :$dba = '', :$with_adverbs) {
my @parts := self.type_name_parts($dba, :$decl);
unless $decl && $decl eq 'routine' {
@parts.shift() while self.is_pseudo_package(@parts[0]);
}
nqp::join('::', @parts)
~ ($with_adverbs ?? nqp::join('', @!colonpairs) !! '');
}
# Gets the individual components, which may be PAST nodes for
......@@ -1516,7 +1520,7 @@ class Perl6::World is HLL::World {
# or resolvable at compile time.
method type_name_parts($dba, :$decl) {
my @name;
my $beyond_pp;
my int $beyond_pp;
if $decl && $!get_who {
my $name := self.text;
nqp::die("Name $name ends with '::' and cannot be used as a $dba");
......@@ -1644,7 +1648,7 @@ class Perl6::World is HLL::World {
# Checks if a given symbol is declared.
method is_name(@name) {
my $is_name := 0;
my int $is_name := 0;
if self.is_pseudo_package(@name[0]) {
$is_name := 1;
}
......@@ -1762,7 +1766,7 @@ class Perl6::World is HLL::World {
my $result := $*GLOBALish;
if +@name >= 2 {
my $first := @name[0];
my $i := +@!BLOCKS;
my int $i := +@!BLOCKS;
while $i > 0 {
$i := $i - 1;
my %sym := @!BLOCKS[$i].symbol($first);
......@@ -1932,7 +1936,7 @@ class Perl6::World is HLL::World {
# throws a typed exception
method throw($/, $ex_type, *%opts) {
# TODO: provide context
my $type_found := 1;
my int $type_found := 1;
my $ex;
my $x_comp;
try {
......@@ -1986,7 +1990,7 @@ class Perl6::World is HLL::World {
method ex-handle($/, $code) {
my $res;
my $ex;
my $nok;
my int $nok;
try {
$res := $code();
CATCH {
......@@ -2002,7 +2006,7 @@ class Perl6::World is HLL::World {
}
method rethrow($/, $err) {
my $success := 0;
my int $success := 0;
my $ex_t;
my $coercer;
try { $coercer := self.find_symbol(['&COMP_EXCEPTION']); ++$success; };
......
......@@ -364,8 +364,14 @@ find_in_cache(PARROT_INTERP, Rakudo_md_cache *cache, PMC *capture, INTVAL num_ar
return NULL;
for (i = 0; i < num_args; i++) {
if (pc_positionals[i].type == BIND_VAL_OBJ) {
PMC *arg = Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p);
arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0);
PMC *arg = pc_positionals[i].u.p;
if (arg->vtable->base_type == Rakudo_smo_id()) {
arg = Rakudo_cont_decontainerize(interp, arg);
arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0);
}
else {
return NULL;
}
}
else {
arg_tup[i] = (pc_positionals[i].type << 1) | 1;
......@@ -426,8 +432,13 @@ add_to_cache(PARROT_INTERP, Rakudo_md_cache *cache, PMC *capture, INTVAL num_arg
return;
for (i = 0; i < num_args; i++) {
if (pc_positionals[i].type == BIND_VAL_OBJ) {
PMC *arg = Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p);
arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0);
if (pc_positionals[i].u.p->vtable->base_type != Rakudo_smo_id()) {
return;
}
else {
PMC *arg = Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p);
arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0);
}
}
else {
arg_tup[i] = (pc_positionals[i].type << 1) | 1;
......@@ -464,9 +475,11 @@ static INTVAL has_junctional_args(PARROT_INTERP, INTVAL num_args, struct Pcc_cel
for (i = 0; i < num_args; i++) {
if (pc_positionals[i].type == BIND_VAL_OBJ) {
PMC * const arg = Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p);
if (STABLE(arg)->WHAT == Rakudo_types_junction_get())
return 1;
if (pc_positionals[i].u.p->vtable->base_type == Rakudo_smo_id()) {
PMC * const arg = Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p);
if (STABLE(arg)->WHAT == Rakudo_types_junction_get())
return 1;
}
}
}
......@@ -685,12 +698,25 @@ static PMC* find_best_candidate(PARROT_INTERP, Rakudo_md_candidate_info **candid
}
}
else {
PMC * const param =
got_prim == BIND_VAL_OBJ ?
Rakudo_cont_decontainerize(interp, pc_positionals[i].u.p) :
got_prim == BIND_VAL_INT ? Rakudo_types_int_get() :
got_prim == BIND_VAL_NUM ? Rakudo_types_num_get() :
Rakudo_types_str_get();
PMC *param;
if (got_prim == BIND_VAL_OBJ) {
param = pc_positionals[i].u.p;
if (param->vtable->base_type == Rakudo_smo_id()) {
param = Rakudo_cont_decontainerize(interp, param);
}
else {
param = Rakudo_types_parrot_map(interp, param);
if (param->vtable->base_type != Rakudo_smo_id()) {
type_mismatch = 1;
break;
}
}
}
else {
param = got_prim == BIND_VAL_INT ? Rakudo_types_int_get() :
got_prim == BIND_VAL_NUM ? Rakudo_types_num_get() :
Rakudo_types_str_get();
}
if (type_obj != Rakudo_types_mu_get() &&
!STABLE(param)->type_check(interp, param, type_obj)) {
type_mismatch = 1;
......
......@@ -43,7 +43,7 @@ my class Any {
method join($separator = '') {
my $list = (self,).flat.eager;
my Mu $rsa := pir::new__Ps('ResizableStringArray');
my Mu $rsa := nqp::list_s();
$list.gimme(4); # force reification of at least 4 elements
nqp::push_s($rsa, nqp::unbox_s($list.shift.Stringy))
while $list.gimme(0);
......
......@@ -7,9 +7,10 @@ my class X::Buf::Pack { ... };
my class X::Buf::Pack::NonASCII { ... };
my class Buf does Positional {
has Mu $!buffer;
has str $!buffer;
my int $binary_encoding = pir::find_encoding__Is('binary');
method BUILD() {
$!buffer := pir::new__Ps('ByteBuffer');
$!buffer = pir::trans_encoding__Ssi('', $binary_encoding);
1;
}
method new(*@codes) {
......@@ -19,25 +20,26 @@ my class Buf does Positional {
}
method !set_codes(@codes) {
my int $bytes = @codes.elems;
pir::set__vPI($!buffer, $bytes);
my $rsa := nqp::list_s();
my int $i = 0;
while $i < $bytes {
nqp::bindpos_i($!buffer, $i, nqp::unbox_i(@codes[$i]));
nqp::bindpos_s($rsa, $i, nqp::chr(nqp::unbox_i(@codes[$i])));
$i = $i + 1;
}
$!buffer = nqp::join('', $rsa);
self;
}
method at_pos(Buf:D: Int:D $idx) {
nqp::p6box_i(nqp::atpos_i($!buffer, nqp::unbox_i($idx)));
nqp::p6box_i(nqp::ord(nqp::substr($!buffer, nqp::unbox_i($idx), 1)));
}
multi method Bool(Buf:D:) {
nqp::p6bool(nqp::elems($!buffer));
nqp::p6bool(nqp::chars($!buffer));
}
method elems(Buf:D:) {
nqp::p6box_i(nqp::elems($!buffer));
nqp::p6box_i(nqp::chars($!buffer));
}
method bytes(Buf:D:) { self.elems }
method chars() { X::Buf::AsStr.new(method => 'chars').throw }
......@@ -49,10 +51,10 @@ my class Buf does Positional {
method list() {
my @l;
my int $bytes = nqp::elems($!buffer);
my int $bytes = nqp::chars($!buffer);
my int $i = 0;
while $i < $bytes {
@l[$i] = nqp::p6box_i(nqp::atpos_i($!buffer, $i));
@l[$i] = nqp::p6box_i(nqp::ord(nqp::substr($!buffer, $i, 1)));
$i = $i + 1;
}
@l;
......@@ -63,20 +65,15 @@ my class Buf does Positional {
}
method decode(Str:D $encoding = 'utf8') {
nqp::p6box_s $!buffer.get_string(
nqp::unbox_s PARROT_ENCODING($encoding)
);
my $bb := pir::new__Ps('ByteBuffer');
pir::set__vPs($bb, $!buffer);
nqp::p6box_s($bb.get_string(PARROT_ENCODING($encoding)));
}
method subbuf(Buf:D: $from = 0, $len = self.elems) {
my $ret := nqp::create(self);
my $buf := pir::new__Ps('ByteBuffer');
nqp::bindattr($ret, Buf, '$!buffer', $buf);
pir::set__vPs($buf,
nqp::substr($!buffer.get_string('binary'),
nqp::unbox_i($from.Int),
nqp::unbox_i($len.Int)
)
nqp::bindattr_s($ret, Buf, '$!buffer',
nqp::substr($!buffer, nqp::unbox_i($from), nqp::unbox_i($len))
);
$ret;
}
......@@ -160,12 +157,10 @@ multi prefix:<~^>(Buf:D $a) {
}
multi infix:<~>(Buf:D $a, Buf:D $b) {
my Buf $r := nqp::create(Buf);
my Mu $br := pir::new__Ps('ByteBuffer');
my Mu $ba := nqp::getattr(nqp::p6decont($a), Buf, '$!buffer');
my Mu $bb := nqp::getattr(nqp::p6decont($b), Buf, '$!buffer');
pir::set__vPs($br, nqp::concat_s($ba.get_string('binary'), $bb.get_string('binary')));
nqp::bindattr($r, Buf, '$!buffer', $br);
my str $ba = nqp::getattr_s(nqp::p6decont($a), Buf, '$!buffer');
my str $bb = nqp::getattr_s(nqp::p6decont($b), Buf, '$!buffer');
nqp::bindattr_s($r, Buf, '$!buffer', nqp::concat_s($ba, $bb));
$r;
}
multi sub infix:<~&>(Buf:D $a, Buf:D $b) {
......@@ -239,6 +234,15 @@ multi sub pack(Str $template, *@items) {
}
@bytes.push: map { :16($_) }, $hexstring.comb(/../);
}
when 'x' {
if $amount eq '*' {
$amount = 0;
}
elsif $amount eq '' {
$amount = 1;
}
@bytes.push: 0x00 xx $amount;
}
when 'C' {
my $number = shift(@items);
@bytes.push: $number % 0x100;
......
......@@ -54,7 +54,7 @@ my class Capture {
}
multi method Str(Capture:D:) {
my Mu $str := pir::new__Ps('ResizableStringArray');
my Mu $str := nqp::list_s();
if $!list {
my Mu $iter := nqp::iterator($!list);
nqp::push_s($str, nqp::unbox_s(nqp::shift($iter).Str)) while $iter;
......
......@@ -183,7 +183,7 @@ my class Cool {
method trim-trailing() { self.Stringy.trim-trailing };
method eval(*%opts) {
eval(self.Stringy, |%opts);
eval(self.Stringy, context => CALLER::, |%opts);
}
multi method Real() { self.Numeric.Real }
......
......@@ -9,8 +9,8 @@ my class Cursor does NQPCursorRole {
return $match if nqp::istype($match, Match) && nqp::isconcrete($match);
$match := nqp::create(Match);
nqp::bindattr($match, Match, '$!orig', nqp::getattr(self, Cursor, '$!orig'));
nqp::bindattr($match, Match, '$!from', nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!from')));
nqp::bindattr($match, Match, '$!to', nqp::p6box_i(nqp::getattr_i(self, Cursor, '$!pos')));
nqp::bindattr_i($match, Match, '$!from', nqp::getattr_i(self, Cursor, '$!from'));
nqp::bindattr_i($match, Match, '$!to', nqp::getattr_i(self, Cursor, '$!pos'));
nqp::bindattr($match, Match, '$!ast', nqp::getattr(self, Cursor, '$!ast'));
nqp::bindattr($match, Match, '$!CURSOR', self);
my Mu $list := nqp::list();
......@@ -19,11 +19,10 @@ my class Cursor does NQPCursorRole {
my Mu $caphash := nqp::findmethod(Cursor, 'CAPHASH')(self);
my Mu $capiter := nqp::iterator($caphash);
while $capiter {
my Mu $pair := nqp::shift($capiter);
my str $key = $pair.key;
my Mu $value := $pair.value;
my str $key = nqp::shift_s($capiter);
my Mu $value := nqp::p6type(nqp::atkey($caphash, $key));
if $key eq '$!from' || $key eq '$!to' {
nqp::bindattr($match, Match, $key, nqp::p6box_i($value.from));
nqp::bindattr_i($match, Match, $key, $value.from);
}
else {
$value := nqp::p6list($value, List, Mu)
......
......@@ -970,6 +970,11 @@ my class X::PseudoPackage::InDeclaration does X::Comp {
}
}
my class X::NoSuchSymbol is Exception {
has $.symbol;
method message { "No such symbol '$.symbol'" }
}
{
my %c_ex;
......
......@@ -149,7 +149,7 @@ class IO does IO::FileTestable {
method read(IO:D: Cool:D $bytes as Int) {
my Mu $parrot_buffer := $!PIO.read_bytes(nqp::unbox_i($bytes));
my $buf := nqp::create(Buf);
nqp::bindattr($buf, Buf, '$!buffer', $parrot_buffer);
nqp::bindattr_s($buf, Buf, '$!buffer', $parrot_buffer.get_string('binary'));
$buf;
}
# first arguemnt should probably be an enum
......@@ -166,14 +166,14 @@ class IO does IO::FileTestable {
}
method write(IO:D: Buf:D $buf) {
my Mu $b := nqp::getattr(
my str $b = nqp::getattr_s(
nqp::p6decont($buf),
Buf,
'$!buffer'
);
my str $encoding = $!PIO.encoding;
$!PIO.encoding('binary');
$!PIO.print($b.get_string('binary'));
$!PIO.print($b);
$!PIO.encoding($encoding) unless $encoding eq 'binary';
True;
}
......@@ -292,7 +292,7 @@ my class IO::Path is Cool does IO::FileTestable {
sub dir(Cool $path = '.', Mu :$test = none('.', '..')) {
my Mu $RSA := pir::new__PS('OS').readdir(nqp::unbox_s($path.Str));
my int $elems = pir::set__IP($RSA);
my int $elems = nqp::elems($RSA);
my @res;
loop (my int $i = 0; $i < $elems; $i = $i + 1) {
my Str $file := nqp::p6box_s(pir::trans_encoding__Ssi(
......
......@@ -27,8 +27,8 @@ my role IO::Socket {
fail('Socket not available') unless $!PIO;
my $buf := nqp::create(Buf);
my Mu $parrot_buf := pir::new__PS('ByteBuffer');
pir::set__vPS($parrot_buf, $!PIO.read(nqp::unbox_i($bufsize)));
nqp::bindattr($buf, Buf, '$!buffer', $parrot_buf);
nqp::bindattr_s($buf, Buf, '$!buffer',
$parrot_buf.get_string('binary'));
$buf;
}
......
......@@ -27,7 +27,7 @@ my class MapIter is Iterator {
method reify($n = 1) {
unless nqp::isconcrete($!reified) {
my $argc = $!block.count;
$argc = 1 if $argc < 1;
$argc = 1 if $argc < 1 || $argc ~~ Inf;
my $block := nqp::p6decont($!block);
my Mu $rpa := nqp::list();
......
my class Match is Capture is Cool {
has $.orig;
has $.from;
has $.to;
has int $.from;
has int $.to;
has $.CURSOR;
has $.ast;
......
......@@ -89,7 +89,7 @@ my class Mu {
# that slurpy hashes sometimes lead to double containers
# somehow...
nqp::getattr(self, nqp::atpos($task, 1),
nqp::atpos($task, 3)) = pir::nqp_decontainerize__PP(%attrinit{$key_name});
nqp::atpos($task, 3)) = nqp::p6decont(%attrinit{$key_name});
}
}
elsif nqp::iseq_i(nqp::atpos_i($task, 0), 4) {
......@@ -123,7 +123,7 @@ my class Mu {
my $key_name := nqp::p6box_s(nqp::atpos_s($task, 2));
if %attrinit.exists($key_name) {
nqp::getattr(self, nqp::atpos($task, 1),
nqp::atpos_s($task, 3)) = pir::nqp_decontainerize__PP(%attrinit{$key_name});
nqp::atpos_s($task, 3)) = nqp::p6decont(%attrinit{$key_name});
}
}
elsif nqp::iseq_i(nqp::atpos_i($task, 0), 4) {
......
......@@ -24,12 +24,12 @@ my class Parameter {
method constraint_list() {
nqp::isnull($!post_constraints) ?? () !!
pir::perl6ize_type__PP($!post_constraints)
nqp::p6type($!post_constraints)
}
method constraints() {
all(nqp::isnull($!post_constraints) ?? () !!
pir::perl6ize_type__PP($!post_constraints))
nqp::p6type($!post_constraints))
}