Hi,
Agent Zhang wrote:
On 9/28/06, Agent Zhang [EMAIL PROTECTED] wrote:
lanny noticed yesterday that the Synopses on the smoke server were
different from the ones on feather. Because I am maintaining the
feather ones, I know the synopses there are being resync'd every hour
as expected.
Now
Hi,
Christopher D. Malon wrote:
Agentz++ writes, in a Pugs blog comment:
if someone can offer regular smoke results (i.e. the tests.yml
generated by `make smoke'), we can render the Synopses on feather
with smoke results as well
The obvious way to get this to happen, for all runtimes, is
Hi,
Christopher D. Malon wrote:
Currently, the smokeserver does not run smartlinks.pl etc., but
redirects to tests.pugscode.org via .htaccess:
Redirect /iblech/stuff/pugs-smokes/t http://tests.pugscode.org/t
Redirect /iblech/stuff/pugs-smokes/ext http://tests.pugscode.org/ext
The
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-12-25 17:37 (+0100):
I disagree about binding only being a language thing:
I fail to see how your example code illustrates your disagreement.
return 42
if (my $short := $long_parameter_name) == $specialcase;
I inferred
Hi,
Andrew Savige wrote:
In Pugs, you can process a simple list of lists like this:
my @lol = ( [ '1a', '1b' ], [ '2a', '2b' ], [ '3a', '3b' ] );
for @lol - $t { say 1st='$t[0]' 2nd='$t[1]' }
Yet the $t[0] and $t[1] look untidy to me, so I'd prefer to specify
that the for closure block
Hi,
Juerd wrote:
The next thing I thought was: hey, argument *passing* is actually
*binding* to variables in the sub, so why not use the := operator?
That works very well, because binding as an expression makes no sense
anyway, it being a language thing. And luckily, named arguments are
also
Hi,
my ($a, $b, $c) = a b c;
my $also_a := ($a,$b,$c)[0];
$also_a eq a; # correct?
$also_a = A; # does not die?
$a eq A; # true?
my $also_b = b;
($a,$b,$c)[1] := $also_b;
$b eq b; # true?
$b = B;# does not die?
$also_b eq B; #
Hi,
Luke Palmer wrote:
On 11/20/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
sub foo (*@;AoA) { @;AoA }
my @array1 = a b c;
my @array2 = d e f;
my @AoA = foo @array1, @array2;
say [EMAIL PROTECTED]; # 2?
1
say [EMAIL PROTECTED]; # a b c?
a b c d e f
Hi,
Rob Kinyon wrote:
On 11/20/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
Yep. Also note that for is not a special magical construct in Perl
6, it's a simple subroutine (statement_control:for, with the
signature ([EMAIL PROTECTED], Code *code)). (Of course, it'll usually be
optimized
Hi,
Larry Wall wrote:
On Sun, Nov 20, 2005 at 08:51:03PM +0100, Ingo Blechschmidt wrote:
: according to the new S03, till is the new name for the flipflop
: operator.
Presuming we can make it work out as an infix macro.
Ah, it's a macro. This clarifies things.
: Do the flipflop operators
Hi,
Luke Palmer wrote:
On 11/21/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
Hm. How is (*@;AoA) different from (Array [EMAIL PROTECTED]) then? (Assuming
that
foo(@a; @b) desugars to foo([EMAIL PROTECTED], [EMAIL PROTECTED]).)
Well, it's not at all, under that assumption
Hi,
Juerd wrote:
Will Perl 6 support mutable for-reverse?
I'd like it! :)
Some possible answers that I could think of:
(a) Yes, but as a special case
(b) Yes, because reverse returns lvalue aliases
(c) No
But there's another one, that I didn't immediately think of:
(d) Yes, because
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-11-20 16:44 (+0100):
Where is the difference (for the user) between a subroutine which
returns an appropriate proxy object and an array?
The big difference between pure arrays and referenced arrays, for the
user, is that pure arrays flatten
Hi,
according to the new S03, till is the new name for the flipflop
operator.
Do the flipflop operators of subroutines maintain own
per-invocation-of-the-sub states? I.e.:
sub foo (x) { x() till 0 }
foo { 0 }; # evaluates to a false value, of course
foo { 1 }; # evaluates to a
Hi,
quoting r6624 of S06 [1]:
Some functions take multiple Lists that they wish not to be flattened
into one list. For instance, Czip() wants to iterate several lists
in parallel, while array and hash subscripts want to process
multidimensional slices. The set of underlying argument list
Hi,
Larry Wall wrote:
On Sun, Nov 06, 2005 at 03:10:40PM +0100, Ingo Blechschmidt wrote:
[ = should not automatically bind its .value to the RHS ]
I think binding directly to .key or .value is different from what =
does. So after
$pair = $key = $value;
setting $value doesn't change
Hi,
my ($key, $value) = key val;
my $pair = ($key = $value);
$pair.key = new;
# Should this fail (cannot modify a constant)?
# Should this update $pair.key, but leave $key untouched?
# Should this update $pair.key, implicitly updating $key as well?
Hi,
TSa wrote:
Ingo Blechschmidt wrote:
Exactly. I'd like to add that, under the proposal, you always know
what things are passed how, only by looking for a *.
foo $var;# always positionally, even if $var isa Pair
foo *$pair; # always named
But where is the name
Hi,
Stuart Cook wrote:
On 11/10/05, Austin Hastings [EMAIL PROTECTED] wrote:
A rule that says
splatting
a list coerces all pairs into named args works just fine. The
corresponding rule, accessing the
Hi,
Austin Hastings wrote:
How about perl should DWIM? In this case, I'm with Juerd: splat
should pretend that my array is a series of args.
Yep.
So if I say:
foo [EMAIL PROTECTED];
or if I say:
foo([EMAIL PROTECTED]);
I still mean the same thing: shuck the array and get those
Hi,
Mark Reed wrote:
On 2005-10-10 13:36, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
Under the proposal, a Pair object doesn't have any special
magic
Right. So under this proposal, the key = value syntax is
overloaded: in some contexts it creates a Pair object, and in others
it assigns
Hi,
Dave Whipp wrote:
Austin Hastings wrote:
How about perl should DWIM? In this case, I'm with Juerd: splat
should pretend that my array is a series of args.
So if I say:
foo [EMAIL PROTECTED];
or if I say:
foo([EMAIL PROTECTED]);
I still mean the same thing: shuck the array
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-10-10 19:36 (+0200):
my @array = (42, hi, (a = 23));
It is worth pointing out that the inner parens here are merely for
grouping: this information is lost afterwards, hence this:
foo [EMAIL PROTECTED]; # same as
shouldn't
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-10-10 19:59 (+0200):
my @args = ( (a = 1), b = 2 ); # is sugar for
my @args = ( (a = 1), (b = 2) );
Please, no. Please let the pair constructor be =, not (=). There is
really no need for this operator to consist of both infix
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-10-10 20:08 (+0200):
Named arguments can -- under the proposal -- only ever exist in
calls.
Which leaves us with no basic datastructure that can hold both
positional and named arguments. This is a problem because in a call,
they can
Hi,
while fixing bugs for the imminent Pugs 6.2.10 release, we ran into
several issues with magical pairs (pairs which unexpectedly participate
in named binding) again. Based on Luke's Demagicalizing pairs thread
[1], #perl6 refined the exact semantics [2].
The proposed changes are:
* (key =
Hi,
Uri Guttman wrote:
IB == Ingo Blechschmidt [EMAIL PROTECTED] writes:
IB * (key = $value) (with the parens) is always a positionally
passed
IB Pair object. key = $value (without the parens) is a named
IB parameter:
IB sub foo ($a) {...}
IB * Unary * makes
Hi,
TSa wrote:
Yuval Kogman wrote:
On Wed, Sep 28, 2005 at 11:46:37 -0500, Adam D. Lopresto wrote:
thinking for a while. In short, I propose that use fatal be on by
default, and that err be turned into syntactic sugar for a very
small try/CATCH block.
I like it a lot. It gives the
Hi,
quick questions:
my $pair = (a = 42);
say ~$pair; # a\t42? a\t42\n? a 42?
say +$pair; # 0 (pairs aren't numbers)?
# 42?
# 0 (a is not a number)?
# 0 (~$pair can't be used as a number)?
say ?$pair; # true (because 42 is
Hi,
(sorry for the long delay.)
Juerd juerd at convolution.nl writes:
Ingo Blechschmidt skribis 2005-09-19 14:21 (+):
\(1,2,3);# Reference to a list promoted to an array (!)
\(((1,2,3)));# same
Except that it has to be a reference to a reference, because (1,2
Hi,
Matt Fowles wrote:
On 9/21/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
foo(1,2,3); # infix:, *not* called
foo (1,2,3); # same as
foo( (1,2,3) ); # infix:, called
Do you mean this to read?
foo(1,2,3); # infix:, *not* called
foo .(1,2,3
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-09-21 17:24 (+0200):
multi prefix:\ (Item $item) {...}
multi prefix:\ (@array) {...}
multi prefix:\ (%hash) {...}
I keep forgetting. What's the rule for determining that the (Item
$item) is used, rather than (@array
Hi,
TSa Thomas.Sandlass at orthogon.com writes:
Ingo Blechschmidt wrote:
[EMAIL PROTECTED];# Ref to array
\(@array); # List of refs to @array's elements, i.e. same as
map { \$_ } @array;
# Weird (violating the parens are only for grouping rule
Hi,
Larry Wall wrote:
The only questions in my mind are whether Perl 5's \($a,$b) is
what people expect (it's arguably counterintuitive to newbies),
and whether there's some other construct that would more naturally
construct a list of references. It's not just \« though, since it
has to
Hi,
Juerd juerd at convolution.nl writes:
Ingo Blechschmidt skribis 2005-09-06 21:24 (+0200):
\(@array,) is [ @array ], NOT map { \$_ } @array
I'm not sure of the []s, remember postcirumfix:[ ] creates *new*
containers:
That was the point.
[EMAIL PROTECTED] = $bar
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-09-09 11:59 (+):
\(@array,) is [ @array ], NOT map { \$_ } @array
I'm not sure of the []s, remember postcirumfix:[ ] creates
*new* containers:
That was the point.
[EMAIL PROTECTED] = $bar;
(@array,)[0] = $bar;
AFAIK
Hi,
# Should this work?
say (a = 1, b = 2)b; # 2 or error?
# Similarily:
my @array = (a = 1, b = 2);
say @arrayb;
my $arrayref = [ a = 1, b = 2 ];
say $arrayrefb;
FWIW, I think accessing arrays and arrayrefs by key should probably not
work, but I'm unsure on
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-09-09 15:12 (+0200):
I agree that the comma operator creates an anonymous array, but I do
not agree that it behaves as if it has [] around it.
Creating an anonymous array does not require creating new containers
--
So comma in scalar
Hi,
Larry Wall wrote:
On Fri, Sep 09, 2005 at 04:40:11PM +0200, Juerd wrote:
: Ingo Blechschmidt skribis 2005-09-09 15:12 (+0200):
: I agree that the comma operator creates an anonymous array, but I
: do not agree that it behaves as if it has [] around it.
:
: Creating an anonymous
Hi,
# Perl 5
my @array_of_references = \($foo, $bar, $baz);
print [EMAIL PROTECTED];# prints 3
print ${ $array_of_references[1] }; # prints $bar
# Perl 6
my @array = \($foo, $bar, $baz);
say [EMAIL PROTECTED];
# 3 (like Perl 5)?
# Or 1, making \(...)
Hi,
Juerd wrote:
Ingo Blechschmidt skribis 2005-09-06 19:46 (+0200):
If \(...) still constructs a list of references, are the following
assumptions correct?
IIRC, the RHS of \ is in scalar context, and the comma in scalar
context (the parens are just for precedence), creates an arrayref
Hi,
quick questions:
constant pi = 3; # works
# Is pi package- or lexically-scoped?
our constant pi = 3; # legal?
my constant pi = 3; # legal?
This is consistent with sub foo, our sub foo, and my sub foo,
which are all allowed.
--Ingo
--
Hi,
multi foo ($a) {...}
multi foo ($a, $b) {...}
say foo.arity;
# die? warn and return 0? warn and return undef? return 1|2?
--Ingo
--
Linux, the choice of a GNU | There are no answers, only
generation on a dual AMD | cross-references.
Athlon!|
Hi,
Larry Wall wrote:
On Fri, Sep 02, 2005 at 05:56:39PM +0200, Ingo Blechschmidt wrote:
: multi foo ($a) {...}
: multi foo ($a, $b) {...}
:
: say foo.arity;
: # die? warn and return 0? warn and return undef? return 1|2?
How 'bout undef but 1..2? :-)
Interesting
Hi,
my $arrayref = a b c;
for @$arrayref {...};# loop body executed three times, of course
for ($arrayref,) {...}; # loop body executed only one time
for ($arrayref) {...}; # loop body executed one or three times?
for $arrayref {...}; # loop body executed one or
Hi,
@array = $scalar;# really means
@array = ($scalar,); # same as
@array = (); @array[0] = $scalar;
# Correct?
@array = $arrayref; # really means
@array = ($arrayref,); # same as
@array = ();
Ingo Blechschmidt wrote:
Then we wondered what should happen to array elements which are bound
to other variables if some things happen to the array. (Of course, the
same thoughts apply to hashes as well).
Two more questions:
* @array[$out_of_bounds_index] := $var;
# Fatal error (Can't
Hi,
* my @array = a b c d;
@array[1] = new;
# Array elements are, of course, new (rw) containers.
* my @array = ($foo, $bar);
@array[0] =:= $foo;
# False -- array element are new containers.
@array[0] = $baz;
# $foo unchanged
I think these semantics are pretty clear. But what
Hi,
(sorry for me going into implementation details, but, as it's really a
language design question, I refrained from sending this to p6c.)
While trying to make the following work in PIL2JS...
my ($head, @tail) = foo();
it occured to me that this is bogus, or at least hard to implement.
Hi,
Yuval Kogman wrote:
On Sat, Aug 27, 2005 at 17:38:26 +0200, Ingo Blechschmidt wrote:
($foo, $bar)[0] =:= $foo;
# False (i.e. no difference to arrays) or true?
I think this is true, because you can say:
($foo, $bar) = (1, 2);
And more curiously:
for ($foo, $bar) { $_ = Value
Hi,
Yuval Kogman wrote:
On Sat, Aug 27, 2005 at 14:29:29 +0200, Ingo Blechschmidt wrote:
* @foo[$idx] := $var;
my @bar = @foo;
$var= $new_var;
# @foo[$idx] and $var are now $new_var, but @bar is unchanged,
# right?
Yes, I agree. But we do need a way in the middle
Hi,
Yuval Kogman wrote:
On Sat, Aug 27, 2005 at 19:16:55 +0200, Ingo Blechschmidt wrote:
my ($head, [EMAIL PROTECTED]) := foo();
if foo returns a list of scalars =2 this is like parameter
unpacking:
my ($head, [EMAIL PROTECTED]) = *foo();
[...]
Right, but I wanted to drive
Hi,
Yuval Kogman wrote:
On Thu, Aug 25, 2005 at 11:16:56 -, David Formosa (aka ? the
Platypus) wrote:
On Wed, 24 Aug 2005 16:13:03 +0300, Yuval Kogman
[EMAIL PROTECTED] wrote:
perl6 creates a new instance of the perl compiler (presumably an
object). The compiler will only compile the
Hi,
Yuval Kogman wrote:
On Thu, Aug 25, 2005 at 15:42:28 +0200, Ingo Blechschmidt wrote:
This section will contain all information needed:
* User-defined operators
* Other symbols exported by is export
* Exported macros
Okay, this raises a distinction:
Compile time exports
Runtime
Hi,
with PIL-Run (Perl 6 to Perl 5 compiler) progressing rapidly, the topic
binding came up on #perl6.
Binding is a simple symbol table manipulation, right?
No, consider @array[$idx] := $var or more generally
$sub(@args) := $var.
Then we wondered what should happen to array elements which
Hi,
(asking because a test testing for the converse was just checked in to
the Pugs repository [1])
sub foo ($n, *%rest) {...}
foo 13;
# $n receives 13, of course, %rest is ()
foo 13, foo = bar;
# $n receives 13 again, %rest is (foo = bar)
foo n = 13;
# $n receives
Hi,
Yuval Kogman wrote:
I think this is more consistent, and just as useful:
10 == 10; # dispatches to num
10 == 10; # dispatched to Num, by means of coercion (== has some
affinity to it for backwards compatibility) 10 == 10; # dispatches
to Str, due to better match 10.0 == 10; # unlike
Hi,
on #perl6, we were wondering how to use() modules from foreign
languages which have an incompatible identifier syntax. E.g.:
use perl5:Foo::Bar; # fine, no problem
# Load JavaScript modules from JSAN
use jsan:Test.Simple; # should we simply accept the dot, or...
Hi,
Larry Wall wrote:
On Sat, Aug 20, 2005 at 10:33:03PM +, Ingo Blechschmidt wrote:
: S02 says:
: our $a; say $::(a); # works
:
: my $a; say $::(a); # dies, you should use:
: my $a; say $::(MY::a); # works
That looks like somebody's relic of Perl 5 thinking
Hi,
Yiyi Hu wrote:
my( $s, $t ); $s = value t is $t; $t = xyz; print $s;
in perl 5, it will give a warning, and won't do right thing.
we have to use other way or eval '$s' before print to get a correct
answer.
So I wonder, If we can make $scalar lazy also. As array now is lazy by
default.
Hi,
Yuval Kogman nothingmuch at woobling.org writes:
On Sat, Aug 20, 2005 at 22:27:56 +, Ingo Blechschmidt wrote:
Not code, but the return value of code.emit
Hm, Str? Or possibly a subtype of Str, allowing:
I would guess an AST, that is, any object, that implements
Hi,
Luke Palmer wrote:
sub foo (+$a, *%overflow) {
say %overflow{};
}
foo(:a(1), :b(2)); # b2
foo(:a(1), :overflow{ b = 2 }); # b2
I'd think so, too.
foo(:a(1), :overflow{ b = 2 }, :c(3)); # ???
Error: Too many
Hi,
Yuval Kogman nothingmuch at woobling.org writes:
On Thu, Aug 18, 2005 at 12:24:40 +, Ingo Blechschmidt wrote:
Yuval Kogman nothingmuch at woobling.org writes:
So now that the skeptics can see why this is important, on the
design side I'd like to ask for ideas on how
Hi,
S02 says:
our $a; say $::(a); # works
my $a; say $::(a); # dies, you should use:
my $a; say $::(MY::a); # works
How can I use symbolic dereferentiation to get $?SELF, $?CLASS,
::?CLASS, %MY::, etc.?
say $::('$?SELF');# does this work?
say
Hi,
Yuval Kogman nothingmuch at woobling.org writes:
So now that the skeptics can see why this is important, on the
design side I'd like to ask for ideas on how the code serialization
looks...
sub { $?DOM.document.write(phello world!/p) }.emit(
Hi,
Stevan Little wrote:
So, onto my question, I am wondering what are the valid scopes for
$?SELF and $?CLASS.
Are these (magical) globals who only have bound values in certain
contexts? If that is so, what value do they have outside of a valid
context? undef? or is attempting to
Hi,
1_234; # surely 1234
1e23; # surely 1 * 10**23
1._5; # call of method _5 on 1?
1._foo; # call of method _foo on 1?
1.e5; # 1.0 * 10**5?
1.efoo; # call of method efoo on 1?
1.e_foo;# call of method e_foo on 1?
0xFF.dead; #
Hi,
Nicholas Clark wrote:
On Tue, Jun 14, 2005 at 07:56:32PM +0200, Ingo Blechschmidt wrote:
Maybe we should just hardcode the filehandles-leaking-into-runtime
case in the compiler? And, if the compiler can't detect the problem
at compile-time, just throw a runtime exception?
my $fh
Hi,
~Str;# class? Str?
~::Str; # class? Str?
~Str.meta; # class? (fill in please)?
~::Str.meta; # class? (fill in please)?
+Str; +::Str;
+Str.meta; +::Str.meta; # all errors?
Hi,
my $str = Hello;
$str.ref = Int; # allowed?
$str.meta = some_sub.meta; # allowed?
my $str = Hello;
Str ::= Int; # allowed?
::Str ::= ::Int;# or is this allowed?
say $str; # still Hello? Or is
Hi,
[EMAIL PROTECTED] wrote:
While trying to use say for debugging, I ran across an oddity. While
I can:
say [EMAIL PROTECTED];
and
say @some_array;
this doesn't work:
say @some_array;
Pugs is correct here, you need to use [] or {} to interpolate
aggregates:
say $scalar
Hi,
my $pair = (a = 1);
say $pair[0]; # a?
say $pair[1]; # 1?
I've found this in the Pugs testsuite -- is it legal?
--Ingo
--
Linux, the choice of a GNU | Black holes result when God divides the
generation on a dual AMD | universe by zero.
Athlon!|
Hi,
(found in the Pugs testsuite.)
my $undef = undef;
say $undef.chars? # 0? undef? die?
say chars $undef; # 0? undef? die?
I'd opt for undef.chars to be an error (no such method) and chars
undef to return 0 (with a warning printed to STDERR^W$*ERR).
Opinions?
--Ingo
--
Hi,
Andrew Shitov wrote:
say $pair[0]; # a?
It looks like $pair is an arrayref while 'say ref $pair' tells 'Pair'.
right, this is why I asked, IMHO it's bogus.
And may I ask a relating question:
my $pair = ('name' = 'age');
say $pair{'name'}; # prints 'age'
say $pair['name']; #
Hi,
Luke Palmer wrote:
On 8/4/05, Ingo Blechschmidt [EMAIL PROTECTED] wrote:
my $pair = (a = 1);
say $pair[0]; # a?
say $pair[1]; # 1?
I've found this in the Pugs testsuite -- is it legal?
Nope. That's:
say $pair.key;
say $pair.value;
Also:
say
Hi,
according to S29 [1], neither map nor grep allow mutation:
multi sub Perl6::Array::map (@values, Code $expression) returns Lazy
multi sub Perl6::List::map (Code $expression : [EMAIL PROTECTED]) returns
Lazy
multi sub Perl6::Array::grep (@values : Code *test ) returns
Hi,
Andrew Shitov wrote:
I tried zip under pugs.
my @odd = (1, 3, 5, 7);
my @even = (2, 4, 6, 8);
my @bothA = zip @odd, @even;
print @bothA;
This code prints 12345678 as expected.
After parenthesis were used to group zip arguments, results changes
to 13572468. Is it
Hi,
TSa (Thomas Sandlaß) wrote:
Ingo Blechschmidt wrote:
Is this a bug in S29 or will this be feature removed from Perl 6
and you'll have to say (for example)
use listops :mutating;
my @result = map { $_++; 42 } @array; # works now
Why not just
my @result = map - $_ is rw
Hi,
TSa (Thomas Sandlaß Thomas.Sandlass at orthogon.com writes:
Ingo Blechschmidt wrote:
say zip (@odd, @even); # zip gets only one argument, the flattened
# list ( @odd, @even), containing the
Why flattened? Shouldn't that be *(@odd, @even)?
IIUC
Hi,
quick question:
my $pair = (a = 1);
say ~$pair;
I assume that outputs a\t1, because of the pairs can pretend to be
one-element hashes-rule. Correct?
--Ingo
--
Linux, the choice of a GNU | We are Pentium of Borg. Division is futile.
generation on a dual AMD | You will be
Hi,
Larry Wall wrote:
On Sat, Jul 30, 2005 at 02:14:52PM +0200, Ingo Blechschmidt wrote:
: http://use.perl.org/~autrijus/journal/25337:
: deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception
:
: my $arrayref = [1,2,3];
[...]
: say $arrayref.isa(Ref); # true
Hi,
http://use.perl.org/~autrijus/journal/25337:
deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception
my $arrayref = [1,2,3];
say $arrayref.ref;# Ref or Array?
say $arrayref.isa(Ref); # true or false?
say $arrayref.isa(Array); # false or true?
Hi,
my @array = a b c;
my $arrayref := @array;
push $arrayref, c;
say [EMAIL PROTECTED]; # a b c d, no problem
$arrayref = [d e f];
say [EMAIL PROTECTED]; # d e f, still no problem
$arrayref = 42;# !!! 42 is not a Ref of
Hi,
is binding hashes to arrays (or arrays to hashes) legal? If not, please
ignore the following questions :)
my @array = a b c d;
my %hash := @array;
say %hasha; # b
push @array, e f;
say %hashe; # f?
%hashX = Y;
say [EMAIL PROTECTED]; #
Hi,
Larry Wall wrote:
On Sat, Jul 30, 2005 at 02:33:15PM +0200, Ingo Blechschmidt wrote:
: my @array = a b c;
: my $arrayref := @array;
[...]
: $arrayref = 42;# !!! 42 is not a Ref of Array
:
: Should the last line be treated as
: $arrayref = (42
Hi,
Larry Wall wrote:
Except that you've rebound the container. Hmm, maybe the original
binding is an error.
what about:
sub foo (Array $arrayref) {...}
my @array = a b c d;
foo @array;
The binding used by the parameter binding code does not use the
standard := operator then,
Hi,
are the following assumptions correct?
sub foo ([EMAIL PROTECTED]) { push @args, 42 }
sub bar ([EMAIL PROTECTED] is rw) { push @args, 42 }
foo @some_array; # dies (Can't modify constant array...)
bar @some_array;
# works, but does not change @some_array, as the
Hi,
Luke Palmer wrote:
http://repetae.net/john/recent/out/supertyping.html
This was a passing proposal to allow supertype declarations in
Haskell. I'm referencing it here because it's something that I've had
in the back of my mind for a while for Perl 6. I'm glad somebody else
has
Hi,
are the following assumptions correct?
sub foo ([EMAIL PROTECTED]) { @args[0] }
say ~foo(a, b, c); # a
my @array = a b c d;
say ~foo(@array);# a b c d (or a?)
say ~foo(@array, z); # a b c d (or a?)
say ~foo([EMAIL PROTECTED]); # a
say
Hi,
# Perl 5
my %hash = (a = 1, b = 2, a = 3);
warn $hash{a}; # 3
But I vaguely remember having seen...:
# Perl 6
my %hash = (a = 1, b = 2, a = 3);
say %hasha;# 1
Can somebody confirm this?
--Ingo
--
Linux, the choice of a GNU | Mathematicians practice
Hi,
according to Damian [1]...:
my %hash = (a = 1, b = 2);
my @array = %hash;
say @array[0].isa(Pair); # true
How can I override this behaviour?
class MyHash is Hash {
# Please fill in here
}
my %hash is MyHash = (a = 1, b = 2);
my @array =
Hi,
class Foo {...}
Foo.new.isa(Foo); # true
Foo.isa(Foo); # true (see [1])
Foo.does(Class);# true
sub blarb (Foo $foo, $arg) {
...; # Do something with instance $foo
}
blarb Foo.new(...), ...;
# No problem
blarb Foo,
Hi,
Luke Palmer wrote:
On 7/14/05, Nicholas Clark [EMAIL PROTECTED] wrote:
This is more a note to collective 'self' question than one I expect
the answer to right now. (The answer I expect right now is a glib it
will)
How will the perl6 compiler cope with people creating threads inside
Hi,
Michele Dondi wrote:
Good, I'd forgotten about that. Which means that it's even harder
for someone to compile a module in a strange dialect, since they'd
essentially have to write their own version of use that forces
recompilation (reuse, if you will). And the harder we make it to
Hi,
what do use and require evaluate to?
S06 suggests it's probably some kind of Module object:
The result of a use statement is a (compile-time) object that also has
an .assuming method, allowing the user to bind parameters in all the
module's subroutines/methods/etc.
Hi,
class Foo {}
class Bar is Foo {}
Bar.new.isa(Object);# true
Bar.new.isa(Class); # false
Bar.new.isa(Foo); # true
Bar.new.isa(Bar); # true
# These are clear, I think.
Bar.isa(Object);# true
Bar.isa(Class); # true
Bar.isa(Foo);
Hi,
my $x = 42;
my $y = $x;
$y++;
say $x; # Still 42, of course
class Foo {
has $.data;
method incr () { $.data++ }
# Please fill in appropriate magic here
}
my Foo $x .= new(:data(42));
my Foo $y = $x;
$y.incr();
say $x.data;# Should still be 42
Hi,
Stevan Little wrote:
On Jul 11, 2005, at 9:16 AM, Ingo Blechschmidt wrote:
Bar.isa(Object);# true
Bar.isa(Class); # true
Bar.isa(Foo); # ? (my guess: false)
Bar.isa(Bar); # ? (my guess: false)
I am not sure about this. I think that .isa
Hi,
Stevan Little wrote:
Actually I was thinking that MyClass.isa(...) would work much as it
did in Perl 5 (like an instance). But that access to the underlying
MyClass class instance would not be as simple. Something like
::MyClass would provide access to the Class instance.
class Foo
Hi,
Larry Wall wrote:
On Mon, Jul 11, 2005 at 09:46:30AM -0400, Stevan Little wrote:
: On Jul 11, 2005, at 9:16 AM, Ingo Blechschmidt wrote:
: Bar.isa(Object);# true
: Bar.isa(Class); # true
: Bar.isa(Foo); # ? (my guess: false)
: Bar.isa(Bar
1 - 100 of 176 matches
Mail list logo