Re: Catching exceptions with the // operator

2008-08-06 Thread Paul Seamons
in my mind, this strays too far from the meaning of C// and adds ambiguity that makes the operator unusable. perhaps there's room for an operator that gives some sugar for my $bill = try { ack() CATCH { thpp() } }; but to me that code is concise enough that it doesn't warrant syntactic

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-04 Thread Paul Seamons
I disagree with the idea that humans don't think concurrently (though more often they think in terms of data dependencies). I think this is more analogous to event based programming rather than parallel programming. Event based and parallel based have some similarities but the are

Re: [svn:perl6-synopsis] r14449 - doc/trunk/design/syn

2007-09-07 Thread Paul Seamons
Other available chars: `ws ^ws ws *ws -ws |ws :ws ;ws /ws I'd vote for :ws which is vaguely reminiscent of the former non-capturing parens (?:). It (:ws) also bears little similarity to any other regex construct - although it looks a bit like a

Re: Referring to source code within Perldoc: the new A code

2007-06-21 Thread Paul Seamons
The outcome is that poddoc can be Pod6 pure and perldoc can be (as its name suggests) documentation for Perl. I failed to mention that it also has the benefit that developers can read the perldoc if they care about method details - or they could read poddoc if they only want a 7000 ft view

Re: Referring to source code within Perldoc: the new A code

2007-06-21 Thread Paul Seamons
The outcome is that poddoc can be Pod6 pure and perldoc can be (as its name suggests) documentation for Perl. Sorry to reply to myself twice. Making poddoc independent of Perl 6 opens the doors a little further for having pythondoc and phpdoc and yourlanguageheredoc which extract the POD

Re: for ... else

2007-03-02 Thread Paul Seamons
foreach my $item (@items) { #process each item } else { #handle the empty list case } What do you think? I'm not sure if I like it, but there have been several times that I would've used it recently. I think it would certainly have utility. Paul

Re: Fwd: Numeric Semantics

2007-01-23 Thread Paul Seamons
While I'm in general agreement with everything you've said it makes me a tad nervous to hinge so much on the difference of one character. Can you imagine trying to track down the bug where if ($alpha === $beta) { ... } really should have been if ($alpha == $beta) { ... }

Re: Smart Matching clarification

2006-11-17 Thread Paul Seamons
So maybe we have some or all of: .keys .sortkeys .values .sortvalues .kv .sortkv .pairs.sortpairs Possible variations: .skeys, .ordkeys, etc. Also could flip the default and make .keys sort by default and then you use .rawkeys to get

Re: generic ordinal-relevant operators

2006-11-16 Thread Paul Seamons
Yes. He also accepted the proposal to add min and max operators - although I'm unsure why they weren't included as functions/methods instead. It seems more natural to me to say 'max($a, $b, $c)' or '($a, $b, $c).max' instead of '[max] $a, $b, $c' or '$a max $b max $c'. Although it _does_

Re: List assignment question

2006-11-15 Thread Paul Seamons
my ($a, undef, $b) = 1..3; Huh. I didn't think that worked in Perl 5, either. What am I misremembering? I distinctly recall having to do things like (my $a, undef, my $b) to avoid errors because you can't assign to undef. Maybe I'm just hallucinating. Are you remembering this: my

Re: Runtime role issues

2006-10-11 Thread Paul Seamons
First, when a role is applied to a class at runtime, a instance of that class in another scope may specifically *not* want that role. Is there a way of restricting a role to a particular lexical scope short of applying that role to instances instead of classes? Seems like you could use an

Re: Nested statement modifiers.

2006-10-04 Thread Paul Seamons
It may be more useful to discuss this issue using less contrived examples. :) I would agree. I haven't had any use for a double if or a double for. The double if case is handled by . The double for case is handled by for and map. The interesting cases are combinations of if and for and

Re: Nested statement modifiers.

2006-10-03 Thread Paul Seamons
Of course, that wasn't exactly what you were asking, but it does present a practical solution when you want to: {say $_ for =}.() if $do_read_input; Which I just verified works fine under current pugs. Thank you. Hadn't thought of that. I think that is workable. But it also brings

Re: Nested statement modifiers.

2006-10-03 Thread Paul Seamons
It relates to some old problems in the early part of the RFC/Apocalypse process, and the fact that: say $_ for 1..10 for 1..10 Was ambiguous. The bottom line was that you needed to define your parameter name for that to work, and defining a parameter name on a modifier means that you

Re: Nested statement modifiers.

2006-09-02 Thread Paul Seamons
From my early conversations with Larry, I recall that the reason is that RSTS/E BASIC-PLUS had nested trailing modifiers, and both Larry and I saw many abuses of these over the years. Therefore, he decided not to repeat that abomination, limiting it to precisely one level deep. I'm happy for

Re: Nested statement modifiers.

2006-09-02 Thread Paul Seamons
Yeah, every once in a while, I've wanted the second layer, but I'm willing to rewrite the statement as a true normal if/while instead of a backwards if/while, and it *does* help the overall readability. I'd concede that the actual useful uses are rare enough to not warrant giving a

Nested statement modifiers.

2006-09-01 Thread Paul Seamons
it? Paul Seamons Section of pge2past.tg that re-writes the expression to be enclosed by an if block: transform past (Perl6::Grammar::statement) :language('PIR') { $P0 = node['statement_control'] if $P0 goto statement_control $P0 = node['block'] if $P0 goto statement_block $P0

Re: Nested statement modifiers.

2006-09-01 Thread Paul Seamons
This was definitively rejected by Larry in 2002: Yes. That is good to see and I do think I remember seeing that or some similar postings come to think of it. Thank you for shaking my memory. Now it is 2006. Object syntax has changed. Little bits and pieces (and sometimes larger chunks) of

Re: Nested statement modifiers.

2006-09-01 Thread Paul Seamons
$no or $false or $yes and $true and say OK then ; $no or $false or say OK then if $yes and $true ; Thank you for your reply. I know there are other ways to do it. I've had no choice but to do it other ways in Perl5. I don't think I have ever used that notation (outside of file open and

Re: clarifying the spec for 'ref'

2006-08-25 Thread Paul Seamons
similar to read only strings. Paul Seamons

Re: Using Rules Today

2006-07-03 Thread Paul Seamons
could be cut down considerably if all you want to parse is math (no variables). Paul Seamons

Re: Demagicalizing pairs

2005-08-24 Thread Paul Seamons
I don't think this example reads very clearly. Visually you have to parse until you see the next = and then back track one word to figure out the key. move( from= $x, $y, delta= $up, $right ); Personally I'd write that as either move(from = [$x, $y], delta = [$up, $right]); OR

Re: Do I need has $.foo; for accessor-only virtual attributes?

2005-07-21 Thread Paul Seamons
On Thursday 21 July 2005 12:48 pm, Larry Wall wrote:     * Don't need to topicalize self any more.     * .foo can (again) always be the topic without warnings. Thank you. Do the following exist then: has @x; # private, lexically scoped has @_x; # private, class scoped, rw _x accessor

Re: WTF? - Re: method calls on $self

2005-07-15 Thread Paul Seamons
I'd have to agree. I also think that .foo should always mean $_.foo in methods, without causing any errors if $?SELF =:= $_ becomes false. OK. There is a lot of historical threads on the subject and already a lot of legacy in the Perl6 language. OK - As I understand it, this is what A12

Re: File.seek() interface

2005-07-07 Thread Paul Seamons
We should approach this from the perspective that $fh is an iterator, so the general problem is how do we navigate a random-access iterator?. Well - I kind of thought that $fh was a filehandle that knew how to behave like an iterator if asked to do so. There are too many applications that

Re: date and time formatting

2005-06-02 Thread Paul Seamons
So, if we continue following this API, Perl6 core will contain time(), but no localtime() nor gmtime(). The Date module will provide human readable date and time strings, and basic date math. localtime() and gmtime() seem fairly core to me. The array contexts are simple, and the scalar

Re: Nested captures

2005-05-09 Thread Paul Seamons
=item * Quantifiers (except C? and C??) cause a matched subrule or subpattern to return an array of CMatch objects, instead of just a single object. What is the effect of the quantifiers C**{0,1} and C**{0,1}? ? Will they behave like ? and ?? and return a single object - or will they cause

Re: Malfunction Junction, what's your function?

2005-04-27 Thread Paul Seamons
Minor note. Would you want this: sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a : ''; } to be: sub infix:myeq(Str $a, Str $b) { return ($a eq $b) ? $a but bool::true: ''; } (Is that the right way to do it ?) Paul

Re: -X's auto-(un)quoting?

2005-04-25 Thread Paul Seamons
I think the original (or the latest original) reason for breaking .meth from meaning $_.meth is that $_ is transitory and there was no way back to the nameless invocant. In the absense of having a way back, I and others strongly advocated breaking the link. I think we hated to do it. Now if

Re: -X's auto-(un)quoting?

2005-04-25 Thread Paul Seamons
What is this way back you repeatedly mention? If it is having a name for the invocant, then there has always been one: method foo ($self:) { for (1..10) { $self.method(.sqrt) } } Or, well, two: method foo { my $self := $_; ...

Re: -X's auto-(un)quoting?

2005-04-25 Thread Paul Seamons
Paul Seamons wrote: Yes, I know there can be a way back. In this thread, none of the examples give one using existing Perl 6 syntax. They are all proposing new ways. This is one more. Sorry if this sounded brash. I have a habit of not figuring out that there is more of the message to read

Statement modifier scope

2005-04-15 Thread Paul Seamons
The following chunks behave the same in Perl 5.6 as in Perl 5.8. Notice the output of branching statement modifiers vs. looping statement modifiers. perl -e '$f=1; {local $f=2; print $f} print - $f\n' # prints 2 - 1 perl -e '$f=1; {local $f=2 if 1; print $f} print - $f\n # prints 2 - 1

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
On Friday 15 April 2005 11:57 am, Juerd wrote: Paul Seamons skribis 2005-04-15 11:50 (-0600): my %h = a 1 b 2 c 3; { temp %h{$_} ++ for %h.keys; Just make that two lines. Is that so bad? temp %h; %h.values »++; For the given example, your code fits perfectly. A more common

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
temp %h; %h{ %other.keys } = %other.values; or even temp %h{ %other.keys } = %other.values; should work well already? Almost - but not quite. In Perl5 perl -MData::Dumper -e '%h=qw(a 1 b 2); {local %h; $h{a}=one; print Dumper \%h} print Dumper \%h; $VAR1 = { 'a' =

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
On Friday 15 April 2005 12:28 pm, Juerd wrote: temp %h{ %other.keys } = %other.values; Oops missed that - I like that for solving this particular problem. It does even work in Perl5: perl -MData::Dumper -e '%h=qw(a 1 b 2); {local @h{qw(a b)}=(one,two); print Dumper \%h} print Dumper \%h'

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
I'm imagining it will be different, as I expect temp to not hide the old thing. I'm not sure it will. That is another good question. I just searched through the S and A's and couldn't find if temp will blank it out. I am thinking it will act like local. Each of the declarations my, our and

Re: .method == $self.method or $_.method?

2005-03-18 Thread Paul Seamons
as the invocant for most of the time. Paul Seamons I'll go back to lurking about now.

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Paul Seamons
eval read :file(foo) How about: eval slurp foo; Paul Seamons

Re: Instantiation

2004-08-23 Thread Paul Seamons
be a full fledged class which inherits from Some::Module::That::Defines::A::Class. I doubt that it is optimal - but it does give a little bit of flexibility. Paul Seamons

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Paul Seamons
'); # index 3 gets 'value' # which is harder han @array[3] = 'value' Paul Seamons

Re: Synopsis 2 draft 1 -- each and every

2004-08-19 Thread Paul Seamons
On Thursday 19 August 2004 02:14 pm, Paul Seamons wrote: @array.push(3 = 'value'); # index 3 gets 'value' Hmm. Well that makes it hard to have an array of pairs - so never mind. Paul Seamons

Re: FW: Periodic Table of the Operators

2004-06-01 Thread Paul Seamons
Or for the few Perl emacs people out there: C-x 8 Y C-x 8 C-x 8 Paul On Tuesday 01 June 2004 10:27 am, Gabriel Ebner wrote: Hello, Aaron Sherman wrote: Well, first off my US keyboard doesn't contain it. Sorry, mistakenly picked an US-International chart. Second, you're not supposed