Changeset 5171

Show
Ignore:
Timestamp:
07/04/05 00:39:16 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
6965
Message:

* new trait, is builtin, for Prelude.pm which installs the symbol

into the global namespace.

Location:
src/perl6
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/Prelude.pm

    r5143 r5171  
    2121    # on p6-l. 
    2222 
    23     multi sub open (Str $filename, Str +$layer, Bool +$r, Bool +$w, Bool +$rw, Bool +$a) returns IO is primitive is unsafe is export { 
     23    multi sub open (Str $filename, Str +$layer, Bool +$r, Bool +$w, Bool +$rw, Bool +$a) returns IO is primitive is unsafe is builtin { 
    2424        die "fancy open modes not supported yet" if $a & any($r, $w, $rw); 
    2525        my $mode; 
     
    8585    # (maybe :lang<YAML> doesn't quite belong here?) 
    8686    multi sub eval (Str ?$code = $CALLER::_, Str +$lang = 'Perl6') 
    87             is primitive is safe is export { 
     87            is primitive is safe is builtin { 
    8888        given lc $lang { 
    8989            when 'perl6'   { Pugs::Internals::eval($code) }; 
     
    118118    has Str $.params;   # FIXME: needs attention; don't use yet. 
    119119 
    120     multi sub caller (Class ?$kind = Any, Int +$skip = 0, Str +$label) returns Control::Caller is primitive is export is safe { 
     120    multi sub caller (Class ?$kind = Any, Int +$skip = 0, Str +$label) returns Control::Caller is primitive is builtin is safe { 
    121121        my @caller = Pugs::Internals::caller($kind, $skip, $label); 
    122122 
  • src/perl6/Prelude/PIR.pm

    r5001 r5171  
    33 
    44# our &prefix:<?> := &true doesn't work yet. 
    5 sub prefix:<?> ($var) returns Bool is primitive { true $var } 
     5sub prefix:<?> ($var) returns Bool is builtin is primitive { true $var } 
    66 
    7 sub chomp (Str $str) returns Str is primitive { 
     7sub chomp (Str $str) returns Str is builtin is primitive { 
    88    # XXX return $str but newline("\n") 
    99    if substr($str, -1, 1) eq "\n" { 
     
    1414} 
    1515 
    16 sub chop (Str $str is rw) returns Str is primitive { 
     16sub chop (Str $str is rw) returns Str is builtin is primitive { 
    1717    if chars($str) == 0 { 
    1818        undef; 
     
    2424} 
    2525 
    26 sub sleep (Num $seconds) returns Num is primitive { 
     26sub sleep (Num $seconds) returns Num is builtin is primitive { 
    2727    my $time = time; 
    2828    Perl6::Internals::sleep $seconds; 
     
    3131} 
    3232 
    33 sub exit (Int ?$status = 0) is primitive { 
     33sub exit (Int ?$status = 0) is builtin is primitive { 
    3434    Perl6::Internals::exit $status; 
    3535} 
    3636 
    37 sub Perl6::Internals::eval_parrot (Str $code) is primitive { 
     37sub Perl6::Internals::eval_parrot (Str $code) is builtin is primitive { 
    3838    my $sub = substr($code, 0, 1) eq "." 
    3939        ?? Perl6::Internals::compile_pir($code) 
     
    4242} 
    4343 
    44 sub pi () returns Num is primitive { 
     44sub pi () returns Num is builtin is primitive { 
    4545    3.14159265358979323846264338327950288419716939937510; 
    4646} 
    4747 
    48 sub lcfirst (Str $str) returns Str is primitive { 
     48sub lcfirst (Str $str) returns Str is builtin is primitive { 
    4949    lc(substr $str, 0, 1) ~ substr $str, 1, chars($str) - 1; 
    5050} 
    5151 
    52 sub ucfirst (Str $str) returns Str is primitive { 
     52sub ucfirst (Str $str) returns Str is builtin is primitive { 
    5353    uc(substr $str, 0, 1) ~ substr $str, 1, chars($str) - 1; 
    5454} 
    5555 
    56 sub shift (@a) is primitive { 
     56sub shift (@a) is builtin is primitive { 
    5757    my $top = +@a -1; 
    5858    return undef if $top < 0; 
     
    6767 
    6868# splice entirely untested. 
    69 sub splice (@a, ?$offset=0, ?$length, *@list) is primitive { 
     69sub splice (@a, ?$offset=0, ?$length, *@list) is builtin is primitive { 
    7070    my $off = $offset; 
    7171    my $len = $length;