On Tuesday, March 25, 2003, at 12:59 PM, Smylers wrote:
Michael Lazzaro writes:
Larry Wall wrote:
We don't have a word for START right now. It's somewhat equivalent
to
state $foo //= 0
unless $foo gets undefined, I suppose.
Assuming we have a static-like scope called Cstate, one can
Michael Lazzaro writes:
On Wednesday, March 19, 2003, at 08:30 AM, Larry Wall wrote:
We don't have a word for START right now. It's somewhat equivalent
to
state $foo //= 0
unless $foo gets undefined, I suppose.
Assuming we have a static-like scope called Cstate, one can
On Tuesday, March 25, 2003, at 06:17 PM, Damian Conway wrote:
Likewise, I read
sub foo($x //= 1) {...}
as saying the value stored in $x is a constant, but if the caller
passed an undefined value (or didn't pass anything at all), we're
going to instead pretend they passed us a
Michael Lazzaro wrote:
OK, I buy that, I think. But does that mean that fixing edge cases in
your arguments doesn't work at all, i.e. you can't even do this?
sub foo(?$x) {
$x //= 1; # if they passed an undef, init it to 1
...
}
That's right. It's an error. You need:
Getting back to A6, a few thoughts. From the 'Re: is static?' thread:
On Wednesday, March 19, 2003, at 08:30 AM, Larry Wall wrote:
Well, people *will* write
state $foo = 0;
The question is what that should mean, and which major set of people
we want to give the minor surprise to, and how
On Tue, Mar 25, 2003 at 10:42:39AM -0800, Michael Lazzaro wrote:
But it is certainly possible to extend the initialization capabilities
to be more robust:
sub foo($x = 'blah') {...} # wrong: use one of the below
sub foo($x ::= 'blah') {...} # same as C$x is default('blah')
(Note forwarded to the list as penance for my silliness. :)
sub foo($x .= foo) {...} # Append foo to whatever $x given
sub foo($x ~= foo) {...} # smart-test $x against foo
Well, last time I looked (granted, it could've changed numerous times
since then) ~ was the string concatenator
On Tue, Mar 25, 2003 at 12:19:30PM -0800, Paul wrote:
Is there a page up anywhere that summarizes the latest
prognostications?
Mike Lazzaro had compiled the state-of-the-ops for perl6, but I don't
know if it's anywhere other than in the archives for this list. Just
go to google groups and
On Tue, Mar 25, 2003 at 01:47:32PM -0800, Michael Lazzaro wrote:
On Tuesday, March 25, 2003, at 11:08 AM, Jonathan Scott Duff wrote:
On Tue, Mar 25, 2003 at 10:42:39AM -0800, Michael Lazzaro wrote:
But it is certainly possible to extend the initialization capabilities
to be more
I don't see how ::= (compile-time-bind) can be used as the
initialize-if-non-existent operator.
I mean, it happens in the wrong phase (compile-time, not run-time) and it does
the wrong thing (binding, not assignment).
For example:
sub foo {
state $count ::= 0;# $count
On Wed, Mar 26, 2003 at 09:19:42AM +1100, Damian Conway wrote:
my $x = 1;# initialization
$x = 1;# assignment
Woo, C++ :-)
Considering 'our' merely declares a lexical alias to a package var, how
do we initialize package vars?
--
Matthijs van Duin -- May the Forth
On Wed, Mar 26, 2003 at 09:19:42AM +1100, Damian Conway wrote:
We then simply define the = in:
sub foo ( ?$bar = $baz ) {...}
to be an initialization (since it's on the declaration of the
parameter). If the parameter has already be bound to some other
container, then that other
On Tue, Mar 25, 2003 at 11:27:55PM +0100, Matthijs van Duin wrote:
On Wed, Mar 26, 2003 at 09:19:42AM +1100, Damian Conway wrote:
my $x = 1;# initialization
$x = 1;# assignment
Woo, C++ :-)
Considering 'our' merely declares a lexical alias to a package var, how
do
Damian Conway wrote:
I don't see how ::= (compile-time-bind) can be used as the
initialize-if-non-existent operator.
I mean, it happens in the wrong phase (compile-time, not run-time) and
it does the wrong thing (binding, not assignment).
The only case I can think of where is might be useful is
On Tuesday, March 25, 2003, at 03:35 PM, Mark Biggar wrote:
sub myprint(+$file is IO:File is rw ::= IO:STDOUT, [EMAIL PROTECTED]) {...}
open f /a/d/v/f/r;
myprint file = f, Hello World!\n; # goes to f
myprint Differnet World!\n;# goes to IO:STDOUT
As a side note... that sig will not do
On Tuesday, March 25, 2003, at 02:19 PM, Damian Conway wrote:
And I don't think that allowing 20 different types of assignment in
the parameter list of a subroutine actually helps at all. Especially
since the vast majority of parameters in Perl 6 will be constant.
Twenty types of
sub myprint(+$file is IO:File is rw ::= IO:STDOUT, [EMAIL PROTECTED]) {...}
As a side note... that sig will not do the behavior you've described.
You instead want this:
sub myprint([EMAIL PROTECTED], +$file is IO:File is rw ::= IO:STDOUT) {...}
The named parameter +$file has to go behind
--- Damian Conway [EMAIL PROTECTED] wrote:
However I still think we're probably multiplying entities
unnecessarily.
A beautiful if somewhat understated reference to Occam's Razor.
While the synoptic synthesis of the writing of William of Occam is
often translated into English as One should not
18 matches
Mail list logo