Re: Synopses on the smoke server are a bit out-of-date

2006-10-01 Thread Ingo Blechschmidt
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

Re: synopses on smoke server

2006-09-06 Thread Ingo Blechschmidt
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

Re: synopses on smoke server

2006-09-06 Thread Ingo Blechschmidt
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

Re: binding arguments

2006-01-05 Thread Ingo Blechschmidt
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

Re: for loop list of lists: flattening arguments to pointy sub

2005-12-25 Thread Ingo Blechschmidt
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

Re: binding arguments

2005-12-25 Thread Ingo Blechschmidt
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

Binding of list slice elements

2005-11-24 Thread Ingo Blechschmidt
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; #

Re: Multidimensional argument list binding (*@;foo)

2005-11-21 Thread Ingo Blechschmidt
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

Re: statement_controlfoo() (was Re: lvalue reverse and array views)

2005-11-21 Thread Ingo Blechschmidt
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

Re: till (the flipflop operator, formerly ..)

2005-11-21 Thread Ingo Blechschmidt
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

Re: Multidimensional argument list binding (*@;foo)

2005-11-21 Thread Ingo Blechschmidt
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

Re: lvalue reverse and array views

2005-11-20 Thread Ingo Blechschmidt
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

Re: lvalue reverse and array views

2005-11-20 Thread Ingo Blechschmidt
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

till (the flipflop operator, formerly ..)

2005-11-20 Thread Ingo Blechschmidt
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

Multidimensional argument list binding (*@;foo)

2005-11-20 Thread Ingo Blechschmidt
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

Re: ='s container and binding semantics

2005-11-07 Thread Ingo Blechschmidt
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

='s container and binding semantics

2005-11-06 Thread Ingo Blechschmidt
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?

Re: Sane (less insane) pair semantics

2005-10-12 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-11 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Re: Sane (less insane) pair semantics

2005-10-10 Thread Ingo Blechschmidt
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

Sane (less insane) pair semantics

2005-10-09 Thread Ingo Blechschmidt
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 =

Re: Sane (less insane) pair semantics

2005-10-09 Thread Ingo Blechschmidt
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

Re: use fatal err fail

2005-09-29 Thread Ingo Blechschmidt
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

Stringification, numification, and booleanification of pairs

2005-09-21 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-21 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-21 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-21 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-19 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-11 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-09 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-09 Thread Ingo Blechschmidt
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

Accessing a list literal by key?

2005-09-09 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-09 Thread Ingo Blechschmidt
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

Re: \(...)?

2005-09-09 Thread Ingo Blechschmidt
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

\(...)?

2005-09-06 Thread Ingo Blechschmidt
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 \(...)

Re: \(...)?

2005-09-06 Thread Ingo Blechschmidt
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

our constant pi, my constant pi?

2005-09-05 Thread Ingo Blechschmidt
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 --

multisub.arity?

2005-09-02 Thread Ingo Blechschmidt
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!|

undef but 1..2?

2005-09-02 Thread Ingo Blechschmidt
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

for $arrayref {...}

2005-09-01 Thread Ingo Blechschmidt
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

@array = $scalar

2005-08-31 Thread Ingo Blechschmidt
Hi, @array = $scalar;# really means @array = ($scalar,); # same as @array = (); @array[0] = $scalar; # Correct? @array = $arrayref; # really means @array = ($arrayref,); # same as @array = ();

Re: Binding of array elements

2005-08-27 Thread Ingo Blechschmidt
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

Does list construction create new containers?

2005-08-27 Thread Ingo Blechschmidt
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

Using lists containing arrays as lvalues

2005-08-27 Thread Ingo Blechschmidt
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.

Re: Does list construction create new containers?

2005-08-27 Thread Ingo Blechschmidt
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

Re: Binding of array elements

2005-08-27 Thread Ingo Blechschmidt
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

Re: Using lists containing arrays as lvalues

2005-08-27 Thread Ingo Blechschmidt
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

Re: Perl 6 code - a possible compile, link, run cycle

2005-08-25 Thread Ingo Blechschmidt
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

Re: Perl 6 code - a possible compile, link, run cycle

2005-08-25 Thread Ingo Blechschmidt
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

Binding of array elements

2005-08-25 Thread Ingo Blechschmidt
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

Calling positionals by name in presence of a slurpy hash

2005-08-23 Thread Ingo Blechschmidt
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

Re: ~ and + vs. generic eq

2005-08-23 Thread Ingo Blechschmidt
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

use language_with_different_indentifier_syntax:...

2005-08-22 Thread Ingo Blechschmidt
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...

Re: Symbolic dereferentiation of magical variables

2005-08-22 Thread Ingo Blechschmidt
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

Re: Can a scalar be lazy ?

2005-08-22 Thread Ingo Blechschmidt
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.

Re: Serializing code

2005-08-21 Thread Ingo Blechschmidt
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

Re: *%overflow

2005-08-21 Thread Ingo Blechschmidt
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

Re: Serializing code

2005-08-20 Thread Ingo Blechschmidt
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

Symbolic dereferentiation of magical variables

2005-08-20 Thread Ingo Blechschmidt
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

Re: Serializing code

2005-08-18 Thread Ingo Blechschmidt
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(

Re: scopes of $?SELF and $?CLASS

2005-08-17 Thread Ingo Blechschmidt
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

Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Ingo Blechschmidt
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; #

Re: BEGIN {...} and IO

2005-08-13 Thread Ingo Blechschmidt
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

Various questions on .ref and .meta

2005-08-05 Thread Ingo Blechschmidt
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?

Reassigning .ref and .meta? Rebinding class objects?

2005-08-05 Thread Ingo Blechschmidt
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

Re: Interpolation of arrays

2005-08-05 Thread Ingo Blechschmidt
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

$pair[0]?

2005-08-04 Thread Ingo Blechschmidt
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!|

undef.chars?

2005-08-04 Thread Ingo Blechschmidt
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 --

Re: $pair[0]?

2005-08-04 Thread Ingo Blechschmidt
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']; #

Re: $pair[0]?

2005-08-04 Thread Ingo Blechschmidt
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

[S29] Mutating map and grep

2005-08-01 Thread Ingo Blechschmidt
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

Re: zip with ()

2005-08-01 Thread Ingo Blechschmidt
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

Re: [S29] Mutating map and grep

2005-08-01 Thread Ingo Blechschmidt
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

Re: zip with ()

2005-08-01 Thread Ingo Blechschmidt
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

Stringification of pairs

2005-07-31 Thread Ingo Blechschmidt
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

Re: $arrayref.ref?

2005-07-31 Thread Ingo Blechschmidt
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

$arrayref.ref?

2005-07-30 Thread Ingo Blechschmidt
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?

Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
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

Binding hashes to arrays?

2005-07-30 Thread Ingo Blechschmidt
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]; #

Re: Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
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

Re: Binding scalars to aggregates

2005-07-30 Thread Ingo Blechschmidt
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,

Slurpy is rw arrays ([EMAIL PROTECTED] is rw)

2005-07-29 Thread Ingo Blechschmidt
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

Re: Messing with the type heirarchy

2005-07-27 Thread Ingo Blechschmidt
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

Do slurpy parameters auto-flatten arrays?

2005-07-26 Thread Ingo Blechschmidt
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

Hash creation with duplicate keys

2005-07-20 Thread Ingo Blechschmidt
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

User-defined behaviour of hashes in list context

2005-07-20 Thread Ingo Blechschmidt
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 =

How do subroutines check types?

2005-07-19 Thread Ingo Blechschmidt
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,

Re: creating threas in BEGIN

2005-07-14 Thread Ingo Blechschmidt
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

Re: User-defined infix subs/methods?

2005-07-13 Thread Ingo Blechschmidt
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

What do use and require evaluate to?

2005-07-12 Thread Ingo Blechschmidt
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.

Quick OO .isa question

2005-07-11 Thread Ingo Blechschmidt
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);

How do I... create a value type?

2005-07-11 Thread Ingo Blechschmidt
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

Re: Quick OO .isa question

2005-07-11 Thread Ingo Blechschmidt
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

Re: Quick OO .isa question

2005-07-11 Thread Ingo Blechschmidt
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

Re: Quick OO .isa question

2005-07-11 Thread Ingo Blechschmidt
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   2   >