Tom Metro <[email protected]> writes:
>  From a coder's perspective, will p6 code be elegant? Are the sorts of
> modules I need available? Will new p6 version break the code I write
> today? Will it be fast enough?

I was trying to understand better Tim's example where he tried to use a
sub that wasn't exported from its module by qualifying it with the
module name. He was questioning, I think, whether it's good that subs
default to having lexical scope in modules combined with the fact that
few Perl 6 modules seem to be putting our in front of sub, which would
make such examples work.  I remember it something like this:

module A {
  sub fn { ... }
  # our sub fn { ... }
}

module B {
       need A;
       A::fn(); # error, fn not accessible
}

There seems to be some related information in synopses 6 and 11, but I'm
not really understanding it very well, particularly parts of this
statement:

"Another difference is that subroutines default to my scope rather than
our scope. However, subroutine dispatch searches lexical scopes outward,
and subroutines are also allowed to be postdeclared after their use, so
you won't notice this much. A subroutine that is not declared yet may be
called using parentheses around the arguments, in the absence of
parentheses, the subroutine call is assumed to take multiple arguments
in the form of a list operator."
-- http://perlcabal.org/syn/S06.html#Globally_scoped_subroutines

Is there anything there that helps?  Otherwise, is this an example of
where Perl 6 inadvertantly became more difficult to use or an example
where defaults just changed and on purpose? i.e. did Perl 6 purposely
reconsider the Perl 5 custom (is it a Perl 5 custom, necessarily?  what
I write is trivial and done alone so I probably should be careful of
putting words in your mouths, particularly concerning modules) that you
shouldn't be prevented from accessing things the module writer didn't
think you needed access to?  What does not being able to do this lose
you? But if you can't normally use a name after "needing" and qualifying
it, what's _need_ for?

-- 
Mike Small
[email protected]

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to