Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Shuffle Int/Num/Str setup into the initial meta-model bootstrap; seem…
…s they gotta be at least partially done there.
  • Loading branch information
jnthn committed May 30, 2011
1 parent 0ab409e commit 6c4de02
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/CORE.setting/stubs.pm
@@ -1,7 +1,7 @@
# This file contains various stubs. Note that a few are created already
# outside of the setting, such as Mu/Any/Cool, Attribute, Signature/Parameter
# and Code/Block/Routine/Sub/Method. They are built in Perl6::Metamodel's
# BOOTSTRAP.pm.
my class Int is Cool { ... }
my class Num is Cool { ... }
my class Str is Cool { ... }
# outside of the setting, such as Mu/Any/Cool, Attribute, Signature/Parameter,
# Code/Block/Routine/Sub/Method and Str/Int/Num. They are built in BOOTSTRAP.pm
# in Perl6::Metamodel for now, though should be a BEGIN block in CORE.setting
# in the end.
my class Junction is Mu { }
my class Whatever is Cool { }
32 changes: 32 additions & 0 deletions src/Perl6/Metamodel/BOOTSTRAP.pm
Expand Up @@ -22,8 +22,10 @@
my class BOOTSTRAPATTR {
has $!name;
has $!type;
has $!box_target;
method name() { $!name }
method type() { $!type }
method box_target() { $!box_target }
method compose($obj) { }
}

Expand Down Expand Up @@ -120,6 +122,30 @@ my stub Method metaclass Perl6::Metamodel::ClassHOW { ... };
Method.HOW.add_parent(Method, Routine);
Method.HOW.publish_parrot_vtable_handler_mapping(Method);

# class Str is Cool {
# has str $!value is box_target;
# ...
# }
my stub Str metaclass Perl6::Metamodel::ClassHOW { ... };
Str.HOW.add_parent(Str, Cool);
Str.HOW.add_attribute(Str, BOOTSTRAPATTR.new(:name<$!value>, :type(str), :box_target(1)));

# class Int is Cool {
# has int $!value is box_target;
# ...
# }
my stub Int metaclass Perl6::Metamodel::ClassHOW { ... };
Int.HOW.add_parent(Int, Cool);
Int.HOW.add_attribute(Int, BOOTSTRAPATTR.new(:name<$!value>, :type(int), :box_target(1)));

# class Num is Cool {
# has num $!value is box_target;
# ...
# }
my stub Num metaclass Perl6::Metamodel::ClassHOW { ... };
Num.HOW.add_parent(Num, Cool);
Num.HOW.add_attribute(Num, BOOTSTRAPATTR.new(:name<$!value>, :type(num), :box_target(1)));

# Set up Stash type, using a Parrot hash under the hood for storage.
my stub Stash metaclass Perl6::Metamodel::ClassHOW { ... };
Stash.HOW.add_parent(Stash, Cool);
Expand Down Expand Up @@ -149,6 +175,9 @@ Perl6::Metamodel::ClassHOW.add_stash(Block);
Perl6::Metamodel::ClassHOW.add_stash(Routine);
Perl6::Metamodel::ClassHOW.add_stash(Sub);
Perl6::Metamodel::ClassHOW.add_stash(Method);
Perl6::Metamodel::ClassHOW.add_stash(Str);
Perl6::Metamodel::ClassHOW.add_stash(Int);
Perl6::Metamodel::ClassHOW.add_stash(Num);
Perl6::Metamodel::ClassHOW.add_stash(Stash);

# Build up EXPORT::DEFAULT.
Expand All @@ -165,6 +194,9 @@ my module EXPORT {
$?PACKAGE.WHO<Routine> := Routine;
$?PACKAGE.WHO<Sub> := Sub;
$?PACKAGE.WHO<Method> := Method;
$?PACKAGE.WHO<Str> := Str;
$?PACKAGE.WHO<Int> := Int;
$?PACKAGE.WHO<Num> := Num;
$?PACKAGE.WHO<Stash> := Stash;
}
}

0 comments on commit 6c4de02

Please sign in to comment.