I don't like the distinction between "anonymous" and other blocks.
On Tue, 8 Aug 2000 17:44:56 +0100, Graham Barr wrote:
>How usable is this ?
>
>I may be missing something, but if every variable mentioned in an anonymous
>block is assumed to be declared with my, then how do you access or modify
> > Do you mean the whole thing, or just the `blocks' part?
>
> Any feature which subverts "use strict" by attempting to declare my
> variables for me. In this case -- `blocks'. But also `subs' scope,
> since that makes anonymous subs useless.
As the RFC notes:
=head2 Incompatibility with s
> while($x)
> {
> $y += foo($x);
> $x = bar($x);
> $big_global_variable = analyze($y,$x);
> }
>
> This leaves you with three variables that may or may not be dependent
> on the upper scope for resolution by default.
As the RFC is written, only *anonymous* blocks are auto-
On Tue, 08 Aug 2000, Nathan Wiger wrote:
> There's two ways I see it:
>
> 1) do {} block
>
>$val = do {
> $x = 10;
> # ... stuff happens ...
> $y;
>};
>
> In which case $val = $y.
>
> 2) explicit our() scoping
>
>$x = 10;
>our $y = 10;
>{
> $
Ariel Scolnicov wrote:
>
> I rarely use a `now' scope,
Well, 'now' is a declaration; the scope is "temporal", aka "dynamic".
> Variable declaration is good (except for some trivial programs)!
I agree 1000%!
--
John Porter
Nathan Wiger <[EMAIL PROTECTED]> writes:
[...]
> > I, for one, will *never* use such a construct. It provides the user
> > with the dangers of `no strict' combined with the illusion of safety
> > of `use strict'.
>
> Do you mean the whole thing, or just the `blocks' part?
Any feature which su
> fluid-let should *really* be called `now'),
Agreed (about the `now' part)
> Will this also apply to `use scope 'subs''?
No. Only subs are affected, which is a clear and easy dividing line I
believe.
> I, for one, will *never* use such a construct. It provides the user
> with the dangers of
Nathan Wiger <[EMAIL PROTECTED]> writes:
> > How usable is this ?
> >
> > I may be missing something, but if every variable mentioned in an anonymous
> > block is assumed to be declared with my, then how do you access or modify
> > the value of any variable outside the block ?
> >
> > Graham.
>
Graham Barr said:
> > Would result in "25" being printed out. Here's why:
> >
> >1. The C<$x = 10> is automatically scoped with its own C.
> >
> >2. The C<$x = 5> inside the B block is automatically
> > scoped with its own C.
> >
> >3. The C<$x = 25> code, however, inside the C s
> How usable is this ?
>
> I may be missing something, but if every variable mentioned in an anonymous
> block is assumed to be declared with my, then how do you access or modify
> the value of any variable outside the block ?
>
> Graham.
I knew someone was going to ask this; after I sent it I r
On Tue, Aug 08, 2000 at 02:37:54PM -, Perl6 RFC Librarian wrote:
> =head3 blocks
>
> The C scoping pragma automatically scopes variables to the
> innermost B block. The key work here is anonymous. The main
> program itself is seen as the outermost block. So, this code:
>
>$x = 10;
>
This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
New pragma 'scope' to change Perl's default scoping
=head1 VERSION
Maintainer: Nathan Wiger <[EMAIL PROTECTED]>
Date: 07 Aug 2000
Version: 1
Mailing List: [EMAIL PROTECTED]
Number: 64
=head1 ABST
12 matches
Mail list logo