Re: Time::Local

2005-07-05 Thread Ingo Blechschmidt
Hi, Dave Whipp wrote: > Larry Wall wrote: >> The time function always returns the time in floating point. > > I don't understand why time() should return a numeric value at all. > Surely it should return a DateTime (or Time) object. Using epochs in a > high level language seems like a really bad

Re: Time::Local

2005-07-05 Thread Ingo Blechschmidt
Hi, Juerd wrote: > Ingo Blechschmidt skribis 2005-07-05 20:08 (+0200): >> FWIW, I agree, but I'd like to propose standard overloadings: >> say ~$time; # "Di 05 Jul 2005 20:01:42 CEST" > > Or perhaps not. In fact, rather not. Please let string

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) > >

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

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: f

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. si

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 mak

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,

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 %hash;# 1 Can somebody confirm this? --Ingo -- Linux, the choice of a GNU | Mathematicians practice abs

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 = %h

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 = ; say ~foo(@array);# "a b c d" (or "a"?) say ~foo(@array, "z"); # "a b c d" (or "a"?) say ~foo([EMAIL PROTECTED]); # "a" s

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 t

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

$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 = ; my $arrayref := @array; push $arrayref, "c"; say [EMAIL PROTECTED]; # a b c d, no problem $arrayref = []; say [EMAIL PROTECTED]; # d e f, still no problem $arrayref = 42;# !!! 42 is not a Ref of Array Sho

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 = ; my %hash := @array; say %hash; # b push @array, ; say %hash; # f? %hash = "Y"; say [EMAIL PROTECTED]; # ??? # (o

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 = ; > : my $arrayref := @array; [...] > : $arrayref = 42;# !!! 42 is not a Ref of Array > : > : Should the last line be treated as >

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 = ; foo @array; The binding used by the parameter binding code does not use the standard := operator then, right?

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 ap

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]; [...] > : s

[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 135724

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; #

Re: zip with ()

2005-08-01 Thread Ingo Blechschmidt
Hi, TSa (Thomas Sandlaß 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 *

$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['na

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.

Various questions on .ref and .meta

2005-08-05 Thread Ingo Blechschmidt
Hi, ~Str;# ""? "Str"? ~::Str; # ""? "Str"? ~Str.meta; # ""? (fill in please)? ~::Str.meta; # ""? (fill in please)? +Str; +::Str; +Str.meta; +::Str.meta; # all errors? ?Str;

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"?

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

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.de

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 acc

Re: Serializing code

2005-08-18 Thread Ingo Blechschmidt
Hi, Yuval Kogman 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("hello world!") }.emit( > :runtime($browser_autodetect_object), >

Re: Serializing code

2005-08-20 Thread Ingo Blechschmidt
Hi, Yuval Kogman woobling.org> writes: > On Thu, Aug 18, 2005 at 12:24:40 +, Ingo Blechschmidt wrote: > > Yuval Kogman woobling.org> writes: > > > So now that the skeptics can see why this is important, on the > > > design side I'd like to ask f

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?

Re: Serializing code

2005-08-21 Thread Ingo Blechschmidt
Hi, Yuval Kogman 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

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:

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 +0000, Ingo Blechschmidt wrote: > : S02 says: > : our $a; say $::("a"); # works > : > : my $a; say $::("a"); # dies, you should use: > : my $a; say $::("MY::a");

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

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 re

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" == "1

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

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, t

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

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 erro

Does list construction create new containers?

2005-08-27 Thread Ingo Blechschmidt
Hi, * my @array = ; @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 about lis

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. Wi

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 mor

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? > >

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();

@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 = ();

for $arrayref {...}

2005-09-01 Thread Ingo Blechschmidt
Hi, my $arrayref = ; 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 three t

perl6-language@perl.org

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? > &

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 --

\(...)?

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 \(...) s

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

Re: \(...)?

2005-09-09 Thread Ingo Blechschmidt
Hi, Juerd 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: > > T

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: >

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 contai

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. > :

Accessing a list literal by key?

2005-09-09 Thread Ingo Blechschmidt
Hi, # Should this work? say (a => 1, b => 2); # 2 or error? # Similarily: my @array = (a => 1, b => 2); say @array; my $arrayref = [ a => 1, b => 2 ]; say $arrayref; FWIW, I think accessing arrays and arrayrefs by key should probably not work, but I'm unsure on (...

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 t

Re: \(...)?

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

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 4

Re: \(...)?

2005-09-21 Thread Ingo Blechschmidt
Hi, (sorry for the long delay.) Juerd 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

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

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 d

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

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" (witho

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

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 > ove

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

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: > >&g

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

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 becau

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, "acc

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 >> f

=>'s container and binding semantics

2005-11-06 Thread Ingo Blechschmidt
Hi, my ($key, $value) = ; 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? $pair.value

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 => $va

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

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 > u

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 t

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, C wants to iterate several lists > in parallel, while array and hash subscripts want to process > multidimensional slices. The set of underlying argument list (List

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 = ; >> my @array2 = ; >> >> my @AoA = foo @array1, @array2; >> say [EMAIL PROTECTED]; #

Re: statement_control() (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:, with the >> signature ([EMAIL PROTECTED

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.

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&#x

Binding of list slice elements

2005-11-24 Thread Ingo Blechschmidt
Hi, my ($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

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 closur

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 >

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_param

Apocalypse 6: IDs of subroutine wrappers should be objects

2004-06-08 Thread Ingo Blechschmidt
t->Canvas; my $id = $canvas->createLine(...); ...; $canvas->raise($id); # Better: $id->raise; Sorry if this was discussed before, didn't found anything. Ingo Blechschmidt

Re: Instantiation

2004-08-23 Thread Ingo Blechschmidt
:Module::That::Defines::A::Class).new(...); If C's argument is a Module object, C should return the first class of that module. I like the C form the best, because it allows you to pass parameters to C. Ingo Blechschmidt -- Linux, the choice of a GNU | Running Windows on a Pentium is like h

Re: CLI signature?

2005-02-05 Thread Ingo Blechschmidt
Hi, Juerd wrote: > This probably goes against everything a shell based platform wants, > but would it be possible to give the program a sub-like signature? I like that idea very much, but... > signature ( > Rule $pattern, > bool +$help:short('h'), > Int +$verbos

  1   2   >