Skip to content

Commit

Permalink
[S06,S11] kill infix:<defines>, replace with statement_control:<import>
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@28506 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
lwall committed Sep 29, 2009
1 parent 0c4a49e commit b1fb049
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion S06-routines.pod
Expand Up @@ -289,7 +289,7 @@ The fact that this is verbose is construed to be a feature. Alternately,
you may play aliasing tricks like this:

module B {
GLOBAL defines <&saith $next_id>;
import GLOBAL <&saith $next_id>;
saith($next_id); # Unambiguously the global definitions
}

Expand Down
22 changes: 12 additions & 10 deletions S11-modules.pod
Expand Up @@ -154,14 +154,14 @@ tags as arguments to C<is export>. (Of course, mixing incompatible scoping
in different scopes is likely to lead to confusion.)

The C<use> declaration is actually a composite of two other declarations,
C<need> and C<defines>. Saying
C<need> and C<import>. Saying

use Sense <common @horse>;

breaks down into:

need Sense;
Sense defines <common @horse>;
import Sense <common @horse>;

These further break down into:

Expand Down Expand Up @@ -232,18 +232,18 @@ do not automatically get imported into their surrounding scope:
multi fact (Int $n) is export { [*] 1..$n }
}
...
Factorial defines 'fact'; # imports the multi
import Factorial 'fact'; # imports the multi

The last declaration is syntactic sugar for:

BEGIN MY.import_alias(Factorial, <fact>);

Despite having the form of an infix operator, this form functions as
a compile-time declarator, so that these notations can be combined:
This form functions as a compile-time declarator, so that these
notations can be combined by putting a declarator in parentheses:

role Silly {
import (role Silly {
enum Ness is export <Dilly String Putty>;
} defines <Ness>;
}) <Ness>;

This really means:

Expand All @@ -254,6 +254,8 @@ This really means:
<Ness>
);

Without an import list, C<import> imports the C<:DEFAULT> imports.

=head1 Runtime Importation

Importing via C<require> also installs names into the current lexical scope by
Expand Down Expand Up @@ -310,8 +312,8 @@ to the package scope instead:
You may also import symbols from the various pseudo-packages listed in S02.
They behave as if all their symbols are in the C<:ALL> export list:

CONTEXT defines <$IN $OUT $ERR>;
CALLER defines <$x $y>;
import CONTEXT <$IN $OUT $ERR>;
import CALLER <$x $y>;

# Same as:
# my ($IN, $OUT, $ERR) ::= ($*IN, $*OUT, $*ERR)
Expand Down Expand Up @@ -381,7 +383,7 @@ For example:
class Dog:auth<http://www.some.com/~jrandom>:ver<1.2.1>;
class Dog:auth<mailto:jrandom@some.com>:ver<1.2.1>;

Since these are somewhat unwieldy to look at, we allow a shorthand in
Since these are somewhat unweildy to look at, we allow a shorthand in
which a bare subscripty adverb interprets its elements according to their
form:

Expand Down

0 comments on commit b1fb049

Please sign in to comment.