Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'cool'
  • Loading branch information
moritz committed Apr 20, 2010
2 parents ad01dca + aa12544 commit 77b52fd
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 30 deletions.
6 changes: 4 additions & 2 deletions build/Makefile.in
Expand Up @@ -93,6 +93,7 @@ BUILTINS_PIR = \
src/gen/RoleToInstanceApplier.pir \
src/metamodel/GrammarHOW.pir \
src/builtins/Any.pir \
src/builtins/Cool.pir \
src/builtins/Role.pir \
src/builtins/ConcreteRole.pir \
src/builtins/Abstraction.pir \
Expand Down Expand Up @@ -169,9 +170,10 @@ CORE_SOURCES = \
src/core/Mu.pm \
src/core/Bool.pm \
src/core/Parcel.pm \
src/core/Any.pm \
src/core/Any-list.pm \
src/core/Any-num.pm \
src/core/Any-str.pm \
src/core/Cool-num.pm \
src/core/Cool-str.pm \
src/core/Seq.pm \
src/core/Set.pm \
src/core/Array.pm \
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Bool.pir
Expand Up @@ -21,7 +21,7 @@ symbols for C<Bool::True> and C<Bool::False>.
.local pmc p6meta, boolproto, abstraction
p6meta = get_hll_global ['Mu'], '$!P6META'
abstraction = get_hll_global 'Abstraction'
boolproto = p6meta.'new_class'('Bool', 'parent'=>'parrot;Boolean Any', 'does_role'=>abstraction)
boolproto = p6meta.'new_class'('Bool', 'parent'=>'parrot;Boolean Cool', 'does_role'=>abstraction)

$P0 = boolproto.'new'()
$P0 = 0
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Capture.pir
Expand Up @@ -15,7 +15,7 @@ This file sets up the Perl 6 C<Capture> class.
.sub 'onload' :anon :init :load
.local pmc p6meta, captureproto
p6meta = get_hll_global ['Mu'], '$!P6META'
captureproto = p6meta.'new_class'('Capture', 'parent'=>'Any', 'attr'=>'$!pos $!named')
captureproto = p6meta.'new_class'('Capture', 'parent'=>'Cool', 'attr'=>'$!pos $!named')
.end


Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Code.pir
Expand Up @@ -17,7 +17,7 @@ for executable objects.
.local pmc p6meta, codeproto
p6meta = get_hll_global ['Mu'], '$!P6META'
$P0 = get_hll_global 'Callable'
codeproto = p6meta.'new_class'('Code', 'parent'=>'Any', 'attr'=>'$!do $!multi $!signature $!lazy_sig_init', 'does_role'=>$P0)
codeproto = p6meta.'new_class'('Code', 'parent'=>'Cool', 'attr'=>'$!do $!multi $!signature $!lazy_sig_init', 'does_role'=>$P0)
$P1 = new ['Role']
$P1.'name'('invokable')
p6meta.'compose_role'(codeproto, $P1)
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/ConcreteRole.pir
Expand Up @@ -22,7 +22,7 @@ dispatch.
.sub 'onload' :anon :init :load
.local pmc p6meta, proto
p6meta = get_hll_global ['Mu'], '$!P6META'
proto = p6meta.'new_class'('ConcreteRole', 'parent'=>'Any')
proto = p6meta.'new_class'('ConcreteRole', 'parent'=>'Cool')
.end

.sub 'PROTOOVERRIDES' :method
Expand Down
23 changes: 23 additions & 0 deletions src/builtins/Cool.pir
@@ -0,0 +1,23 @@
=head1 TITLE

Cool - Perl 6 Cool class

=head1 DESCRIPTION

This is a class that most builtin classes should inherit from

=cut

.namespace['Cool']
.sub 'onload' :anon :init :load
.local pmc p6meta, proto
p6meta = get_hll_global ['Mu'], '$!P6META'
proto = p6meta.'new_class'('Cool', 'parent'=>'Any')
.end

# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:

2 changes: 1 addition & 1 deletion src/builtins/Enum.pir
Expand Up @@ -15,7 +15,7 @@ src/classes/Enum.pir - methods for the Enum class
.sub 'onload' :anon :load :init
.local pmc p6meta, pairproto
p6meta = get_hll_global ['Mu'], '$!P6META'
pairproto = p6meta.'new_class'('Enum', 'parent'=>'Any', 'attr'=>'$!key $!value')
pairproto = p6meta.'new_class'('Enum', 'parent'=>'Cool', 'attr'=>'$!key $!value')
.end


Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Exception.pir
Expand Up @@ -17,7 +17,7 @@ A Perl 6 Exception object.
.sub '' :anon :init :load
.local pmc p6meta, exceptionproto
p6meta = get_hll_global ['Mu'], '$!P6META'
exceptionproto = p6meta.'new_class'('Perl6Exception', 'parent'=>'Any', 'attr'=>'$!exception', 'name'=>'Exception')
exceptionproto = p6meta.'new_class'('Perl6Exception', 'parent'=>'Cool', 'attr'=>'$!exception', 'name'=>'Exception')
p6meta.'register'('Exception', 'protoobject'=>exceptionproto)
.end

Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Int.pir
Expand Up @@ -15,7 +15,7 @@ Int - Perl 6 integers
.sub 'onload' :anon :init :load
.local pmc p6meta, intproto
p6meta = get_hll_global ['Mu'], '$!P6META'
intproto = p6meta.'new_class'('Int', 'parent'=>'parrot;Integer Any')
intproto = p6meta.'new_class'('Int', 'parent'=>'parrot;Integer Cool')
.end

=item perl()
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Iterable.pir
Expand Up @@ -24,7 +24,7 @@ as "is Iterable" should be come "does Iterable".
.sub 'onload' :anon :init :load
.local pmc p6meta, proto
p6meta = get_hll_global ['Mu'], '$!P6META'
proto = p6meta.'new_class'('Iterable', 'parent'=>'Any')
proto = p6meta.'new_class'('Iterable', 'parent'=>'Cool')
.end

=item list()
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Num.pir
Expand Up @@ -15,7 +15,7 @@ Num - Perl 6 numbers
.sub 'onload' :anon :init :load
.local pmc p6meta, numproto
p6meta = get_hll_global ['Mu'], '$!P6META'
numproto = p6meta.'new_class'('Num', 'parent'=>'parrot;Float Any')
numproto = p6meta.'new_class'('Num', 'parent'=>'parrot;Float Cool')

# Override the proto's ACCEPT method so we also accept Ints.
.const 'Sub' $P0 = "Num::ACCEPTS"
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Proxy.pir
Expand Up @@ -18,7 +18,7 @@ aggregate if written to.
.sub 'onload' :anon :init :load
.local pmc p6meta, listproto
p6meta = get_hll_global ['Mu'], '$!P6META'
listproto = p6meta.'new_class'('Proxy', 'parent'=>'parrot;Undef Any', 'attr'=>'$!base $!key &!vivibase')
listproto = p6meta.'new_class'('Proxy', 'parent'=>'parrot;Undef Cool', 'attr'=>'$!base $!key &!vivibase')
.end

=back
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Role.pir
Expand Up @@ -23,7 +23,7 @@ short name for a particular set of parameters.
.sub 'onload' :anon :init :load
.local pmc p6meta, roleproto
p6meta = get_hll_global ['Mu'], '$!P6META'
roleproto = p6meta.'new_class'('Perl6Role', 'parent'=>'Any', 'name'=>'Role', 'attr'=>'$!selector $!created $!shortname')
roleproto = p6meta.'new_class'('Perl6Role', 'parent'=>'Cool', 'name'=>'Role', 'attr'=>'$!selector $!created $!shortname')
.end


Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Signature.pir
Expand Up @@ -16,7 +16,7 @@ P6LowLevelSig and provides higher level access to it.
.sub 'onload' :anon :init :load
.local pmc p6meta
p6meta = get_hll_global ['Mu'], '$!P6META'
p6meta.'new_class'('Signature', 'parent'=>'Any', 'attr'=>'$!ll_sig $!param_cache $!try_bind_sub $!bind_target')
p6meta.'new_class'('Signature', 'parent'=>'Cool', 'attr'=>'$!ll_sig $!param_cache $!try_bind_sub $!bind_target')
.end


Expand Down
2 changes: 1 addition & 1 deletion src/builtins/Str.pir
Expand Up @@ -20,7 +20,7 @@ as the Perl 6 C<Str> class.
.sub 'onload' :anon :init :load
.local pmc p6meta, strproto
p6meta = get_hll_global ['Mu'], '$!P6META'
strproto = p6meta.'new_class'('Str', 'parent'=>'parrot;Perl6Str Any')
strproto = p6meta.'new_class'('Str', 'parent'=>'parrot;Perl6Str Cool')
.end

.sub 'ACCEPTS' :method
Expand Down
11 changes: 11 additions & 0 deletions src/core/Any.pm
@@ -0,0 +1,11 @@
augment class Any {
method ACCEPTS($topic) {
self === $topic
}

multi method Str() {
sprintf '%s<0x%x>', self.WHAT, self.WHERE;
}
}

# vim: ft=perl6
2 changes: 1 addition & 1 deletion src/core/Complex.pm
@@ -1,4 +1,4 @@
class Complex does Numeric {
class Complex does Numeric is Cool {
has $.re;
has $.im;

Expand Down
2 changes: 1 addition & 1 deletion src/core/Any-num.pm → src/core/Cool-num.pm
@@ -1,4 +1,4 @@
augment class Any {
augment class Cool {
method abs() {
(+self).abs;
}
Expand Down
9 changes: 1 addition & 8 deletions src/core/Any-str.pm → src/core/Cool-str.pm
@@ -1,7 +1,4 @@
augment class Any {
method ACCEPTS($topic) {
self === $topic
}
augment class Cool {

our Int multi method bytes() is export {
pir::box__PI(pir::bytelength__IS(self))
Expand Down Expand Up @@ -253,10 +250,6 @@ augment class Any {
}
$! ?? fail( "Insufficient arguments supplied to sprintf") !! $result
}

multi method Str() {
sprintf '%s<0x%x>', self.WHAT, self.WHERE;
}
}

multi sub ord($string) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/EnumMap.pm
@@ -1,4 +1,4 @@
class EnumMap does Associative {
class EnumMap is Cool does Associative {
has $!storage;

method new(*%values) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO.pm
@@ -1,4 +1,4 @@
class IO {
class IO is Cool {
has $!PIO;
has $!ins;

Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Socket/INET.pm
@@ -1,4 +1,4 @@
class IO::Socket::INET does IO::Socket {
class IO::Socket::INET is Cool does IO::Socket {

method open (Str $hostname, Int $port) {

Expand Down
2 changes: 1 addition & 1 deletion src/core/Mu.pm
Expand Up @@ -9,7 +9,7 @@ augment class Mu {
multi method notdef() { !self.defined; }

multi method perl {
self.WHAT.substr(0, -2) ~ '.new()';
substr(~self.WHAT, 0, -2) ~ '.new()';
}

method print() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Rat.pm
@@ -1,4 +1,4 @@
class Rat does Real {
class Rat is Cool does Real {
has $.numerator;
has $.denominator;

Expand Down

0 comments on commit 77b52fd

Please sign in to comment.