diff --git a/DEPRECATED.yaml b/DEPRECATED.yaml index 805835e534..ba9879c843 100644 --- a/DEPRECATED.yaml +++ b/DEPRECATED.yaml @@ -154,12 +154,6 @@ Action methods in rules: - functions - experimental ticket: https://trac.parrot.org/parrot/ticket/1628 -'Protoobject [eligible in 2.7]': - eligible: 2.7 - note: Use P6Object instead. - tags: - - Parrot library - ticket: http://trac.parrot.org/parrot/ticket/1337 'Threads and Parallelism [experimental]': tags: - experimental diff --git a/MANIFEST b/MANIFEST index ea4809ff3e..d8cc2a0b0d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1110,7 +1110,6 @@ runtime/parrot/library/ProfTest/Matcher.nqp [library] runtime/parrot/library/ProfTest/NQPProfile.nqp [library] runtime/parrot/library/ProfTest/PIRProfile.nqp [library] runtime/parrot/library/ProfTest/Want.nqp [library] -runtime/parrot/library/Protoobject.pir [library] runtime/parrot/library/Range.pir [library] runtime/parrot/library/Rules.mak [library] runtime/parrot/library/SDL.pir [library] @@ -1679,7 +1678,6 @@ t/library/parrotlib.t [test] t/library/pcre.t [test] t/library/perlhist.txt [test] t/library/pg.t [test] -t/library/protoobject.t [test] t/library/rand.t [test] t/library/range.t [test] t/library/sha.t [test] diff --git a/config/gen/makefiles/root.in b/config/gen/makefiles/root.in index 4be06ad7c5..b95894e605 100644 --- a/config/gen/makefiles/root.in +++ b/config/gen/makefiles/root.in @@ -296,7 +296,6 @@ GEN_LIBRARY = \ $(LIBRARY_DIR)/PGE/Perl6Grammar.pbc \ $(LIBRARY_DIR)/PGE/Text.pbc \ $(LIBRARY_DIR)/PGE/Util.pbc \ - $(LIBRARY_DIR)/Protoobject.pbc \ $(LIBRARY_DIR)/Range.pbc \ $(LIBRARY_DIR)/Stream/Base.pbc \ $(LIBRARY_DIR)/Stream/Combiner.pbc \ diff --git a/runtime/parrot/library/Protoobject.pir b/runtime/parrot/library/Protoobject.pir deleted file mode 100644 index c610ead24d..0000000000 --- a/runtime/parrot/library/Protoobject.pir +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright (C) 2007-2009, Parrot Foundation. - -=head1 TITLE - -Protoobject.pir - PIR implementation for creating protoobjects - -=head1 SYNOPSIS - - load_bytecode 'Protoobject.pbc' - .local pmc protomaker, fooclass, fooproto - - # create a protoobject for existing class Foo - protomaker = get_hll_global 'Protomaker' - fooclass = get_class 'Foo' - fooproto = protomaker.'new_proto'(fooclass) - - # create a subclass 'NS::Bar' from 'Foo' with attributes - .local pmc bclass, bproto - fooclass = get_class 'Foo' - (bclass, bproto) = protomaker.'new_subclass'(fooclass, 'NS::Bar', '$attr') - -=head1 DESCRIPTION - -Objects of class C are used to construct and initialize -"protoobjects" for Parrot classes. The concept of protoobjects -comes from Perl 6; I are "empty" instances of a class -- -i.e., they are instances that are simply more undefined than a -normal instance. - -Newly created protoobjects are automatically added as symbols in -a corresponding namespace -- for example, the protoobject for -C is automatically entered as the 'Baz' symbol -in the C<['Foo';'Bar']> namespace. - -=head2 Methods - -=over 4 - -=item new_proto(class) - -Create and initialize a new protoobject for C. -The newly created protoobject is placed as an entry in -the appropriate namespace and returned. - -=cut - -.namespace [ 'Protomaker' ] - -.sub '__onload' :init :load - $P0 = newclass 'Protoobject' - - $P0 = subclass $P0, 'Protomaker' - $P1 = new 'Protomaker' - set_hll_global 'Protomaker', $P1 -.end - - -.sub 'new_proto' :method - .param pmc class - - ## make sure we really have a class - $I0 = isa class, 'Class' - if $I0 goto have_class - class = get_class class - have_class: - - ## add Protoobject as a parent class - $I0 = isa class, 'Protoobject' - if $I0 goto protoclass_done - $P0 = get_class 'Protoobject' - class.'add_parent'($P0) - protoclass_done: - - # create a protoobject - .local pmc protoobject - protoobject = new class - - # now, store the protoobject into the appropriate namespace - # split class into namespace components - .local pmc ns - .local string basename - $S0 = class - ns = split ';', $S0 - basename = pop ns - if ns goto have_ns - # If we didn't find a separate namespace, perhaps it's a - # (legacy) double-colon separated classname - ns = split '::', basename - basename = pop ns - have_ns: - - set_hll_global ns, basename, protoobject - .return (protoobject) -.end - - -=item new_subclass(baseclass, name [, attr1, attr2, ...] ) - -Helper method to create subclasses and their corresponding -protoobjects as a single method call. This method creates -a subclass of C with the given C, adds -attributes C, C, etc. to the subclass, and -then creates a corresponding protoobject for the subclass. - -The C parameter is either an array of strings or a -string with namespace identifiers separated by double colons (C<::>). - -The method returns the subclass object and its corresponding -protoobject. - -=cut - -.sub 'new_subclass' :method - .param pmc baseclass - .param pmc name - .param pmc attrs :slurpy - - .local pmc subc - subc = subclass baseclass, name - - unless attrs goto done_attrs - .local pmc it - it = iter attrs - iter_loop: - unless it goto done_attrs - $S0 = shift it - addattribute subc, $S0 - goto iter_loop - done_attrs: - - .local pmc subp - subp = self.'new_proto'(subc) - .return (subc, subp) -.end - - -.namespace ['Protoobject'] - -.sub 'new' :method - $P0 = typeof self - $P1 = new $P0 - .return ($P1) -.end - -.sub 'WHAT' :method - $P0 = typeof self - $S0 = $P0.'name'() - $P0 = split '::', $S0 - $S0 = pop $P0 - .return ($S0) -.end - -# Local Variables: -# mode: pir -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4 ft=pir: - diff --git a/t/library/protoobject.t b/t/library/protoobject.t deleted file mode 100644 index ba8c5f7c74..0000000000 --- a/t/library/protoobject.t +++ /dev/null @@ -1,151 +0,0 @@ -#!./parrot -# Copyright (C) 2001-2010, Parrot Foundation. - -=head1 NAME - -t/library/protoobject.t - testing Protoobject.pir - -=head1 SYNOPSIS - - % prove t/library/protoobject.t - -=head1 DESCRIPTION - -This test exercises the protoobject/Protomaker implementations. - -=cut - -.sub main :main - load_bytecode 'Protoobject.pbc' - - .include 'test_more.pir' - plan(13) - - test_basic_load() - test_type_of_protoobject() - test_type_of_ns_based_protoobject() - test_protoobject_symbol_1() - test_protoobject_symbol_2() - test_protoobject_symbol_for_classes() - test_new_subclass_for_classes() - test_new_subclass_with_attrs() - test_method_new_on_protoobject() -.end - - -.sub test_basic_load - $P0 = get_hll_global 'Protomaker' - $S0 = typeof $P0 - is($S0, 'Protomaker', 'basic load') -.end - - -.sub test_type_of_protoobject - $P0 = get_hll_global 'Protomaker' - $P1 = newclass 'XYZ' - $P2 = $P0.'new_proto'($P1) - - $S0 = typeof $P2 - is($S0, 'XYZ', 'type of protoobject') -.end - - -.sub test_type_of_ns_based_protoobject - $P0 = get_hll_global 'Protomaker' - $P1 = newclass ['Foo';'Bar1'] - $P2 = $P0.'new_proto'($P1) - - $S0 = typeof $P2 - is($S0, 'Foo;Bar1', 'type of ns-based protoobject') -.end - - -.sub test_protoobject_symbol_1 - $P0 = get_hll_global 'Protomaker' - $P1 = newclass ['Foo';'Bar2'] - $P2 = $P0.'new_proto'($P1) - - $P2 = get_hll_global ['Foo'], 'Bar2' - $S0 = typeof $P2 - is($S0, 'Foo;Bar2', 'protoobject symbol 1') -.end - - -.sub test_protoobject_symbol_2 - $P0 = get_hll_global 'Protomaker' - $P1 = newclass 'Foo' - $P2 = $P0.'new_proto'($P1) - - $P2 = get_hll_global 'Foo' - $S0 = typeof $P2 - is($S0, 'Foo', 'protoobject symbol 2') -.end - - -.sub test_protoobject_symbol_for_classes - $P0 = get_hll_global 'Protomaker' - $P1 = newclass 'Foo::Bar3' - $P2 = $P0.'new_proto'($P1) - - $P2 = get_hll_global ['Foo'], 'Bar3' - $S0 = typeof $P2 - is($S0, 'Foo::Bar3', 'protoobject symbol for :: classes') -.end - - -.sub test_new_subclass_for_classes - $P0 = get_hll_global 'Protomaker' - $P1 = get_class 'Hash' - $P0.'new_subclass'($P1, 'Foo::Bar4') - - $P2 = new 'Foo::Bar4' - $S0 = typeof $P2 - is($S0, 'Foo::Bar4', 'new_subclass for :: classes') - - $P2 = get_hll_global ['Foo'], 'Bar4' - $S0 = typeof $P2 - is($S0, 'Foo::Bar4', 'new_subclass for :: classes') -.end - - -.sub test_new_subclass_with_attrs - .local pmc protomaker, hashclass, attrs - protomaker = get_hll_global 'Protomaker' - hashclass = get_class 'Hash' - attrs = split ' ', '$a $b $c $d' - protomaker.'new_subclass'(hashclass, 'Foo::Bar', attrs :flat) - - .local pmc object, it - object = new 'Foo::Bar' - it = iter attrs - iter_loop: - unless it goto iter_end - $P0 = shift it - $S0 = $P0 - setattribute object, $S0, $P0 - $P1 = getattribute object, $S0 - is($P1, $P0,'new_subclass with attrs') - goto iter_loop - iter_end: -.end - - -.sub test_method_new_on_protoobject - $P0 = newclass 'Foo1' - - .local pmc protomaker - protomaker = get_hll_global 'Protomaker' - protomaker.'new_proto'('Foo1') - - $P0 = get_hll_global 'Foo1' - $P1 = $P0.'new'() - $S0 = typeof $P1 - is($S0, 'Foo1', 'method "new" on protoobject') -.end - - -# Local Variables: -# mode: pir -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4 ft=pir: