src/builtins/guts.pir - subs that are part of the internals,
not for users
- !EXPORT(symbols,
from :named('from') [,
to :named('to')] )
Export symbols in namespace from
to the namespace given by to
.
If to
isn't given,
then exports into the HLL global namespace.
This function differs somewhat from Parrot's Exporter
PMC in that it understands how to properly merge MultiSub
PMCs.
- !CALLMETHOD('method',
obj)
Invoke a method on a possibly foreign object.
If the object supports the requested method,
we use it,
otherwise we assume the object is foreign and try using the corresponding method from Any
.
- !VAR
Helper function for implementing the VAR and .VAR macros.
- !DEREF
Helper function to dereference any chains
- !SAMETYPE_EXACT
Takes two types and returns true if they match exactly (not accounting for any subtyping relations,
etc).
- !CREATE_SUBSET_TYPE
Creates a subset type.
Basically,
we make an anonymous subclass of the original type,
attach the refinement and override ACCEPTS.
We also chase up to find a real,
non-subtype and stash that away for fast access later.
- !TOPERL6MULTISUB
At the moment,
we don't have the abilility to have Parrot use our own MultiSub type,
nor are we ready to (because built-ins need to get Perl 6 signatures first).
So for now we just transform multis in user code like this.
- !UNIT_START
- !capture
Combine slurpy positional and slurpy named args into a list.
Note that original order may be lost -- that's the nature of captures.
- !ADDTOROLE
Adds a given role initializing multi-variant to a Role object,
creating it and putting it in the namespace if it doesn't already exist.
- !meta_create(type,
name,
also)
Create a metaclass object for type
with the given name
.
This simply creates a handle on which we can hang methods,
attributes,
traits,
etc.
-- the class itself isn't created until the class is composed (see !meta_compose
below).
- !meta_compose(Class metaclass)
Compose the class.
This includes resolving any inconsistencies and creating the protoobjects.
- !meta_compose()
Default meta composer -- does nothing.
- !meta_trait(metaclass,
type,
name)
Add a trait with the given type
and name
to metaclass
.
- !meta_attribute(metaclass,
name,
itype [,
'type'=>type] )
Add attribute name
to metaclass
with the given itype
and type
.
- !sub_trait(sub,
type,
trait,
arg?)
- !sub_trait_default(trait,
block,
arg)
Sets the default trait,
which marks a multi candidate as the default choice in an ambiguous multiple dispatch.
- !sub_trait_export(trait,
block,
arg)
- !set_resolves_list(class)
Gets all the methods that the class has and adds them to the resolves list.
- !compose_role_attributes(class,
role)
Helper method to compose the attributes of a role into a class.
- !keyword_role(name)
Internal helper method to create a role.
- !keyword_enum(name)
Internal helper method to create an enum class.
- !keyword_does(class,
role)
Internal helper method to implement the functionality of the does keyword.
- !keyword_has(class,
attr_name,
type)
Adds an attribute with the given name to the class or role.
- !anon_enum(value_list)
Constructs a Mapping,
based upon the values list.
- !fixup_routine_type(sub,
new_type)
Reblesses a sub into a new type.