Why are all classes in Rakudo src / core / Int.pm declared with mine?

Looking at the source for Int , I see that all classes are declared using my , so I would think they are closed and inaccessible outside this file. But obviously they are. Why should they be declared this way?

 my class Rat { ... } my class X::Numeric::DivideByZero { ... } my class X::NYI::BigInt { ... } my class Int { ... } my subset UInt of Int where {not .defined or $_ >= 0}; my class Int does Real { # declared in BOOTSTRAP 

I believe the BOOTSTRAP comment is relevant. Perl6 / Metamodel / BOOTSTRAP.nqp has lines such as:

 my stub Int metaclass Perl6::Metamodel::ClassHOW { ... }; 
+7
perl6 lexical-scope
source share
1 answer

Files in the Rakudo src/core/ directory are not compiled as separate modules with their own file-level level scope, but are combined into a single file, such as gen/moar/CORE.setting during the build procedure.

Stemically, this “tuning” (known as the “prelude” in other languges) forms an external lexical region that implicitly surrounds your program.

The design is described in S02: pseudo-packages , and parts of this section turned it into official documentation .

+7
source share

All Articles