', '3', [ \[ '**', '4', '2' ], 0 ] ], 0 ], '5' ],
0 ];
I apologize that the expression parsing isn't a little more abstracted for
you, but the result should be usable. Also, the parse_expr is designed for
also parsing variable names in the TT2 language, so the first portion of the
method applies variable names. The entire thing could be cut down
considerably if all you want to parse is math (no variables).
Paul Seamons
on that particular class.
No methods are removed.
This is very similar to read only strings.
Paul Seamons
that it shouldn't be too hard to change. The question is
would a patch to add the functionality be accepted if I went to the trouble
of figuring out how to do it?
Paul Seamons
Section of pge2past.tg that re-writes the expression to be enclosed by an if
block:
transform past (Perl6::G
> 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
> $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 a
> 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
> > 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
> 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
> 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 t
> 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 "
> 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
> > 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:
> 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 _doe
> 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
> unor
> 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) { ... }
> 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
> 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 co
> 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 tha
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 say
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 access
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 as
hould work on the invocant period - it just happens to be a
coincidence that $_ is the same as the invocant for most of the time.
Paul Seamons
I'll go back to lurking about now.
> eval read :file("foo")
How about:
eval slurp "foo";
Paul Seamons
I would think that :p5 should behave as perl5 does by default. That would
mean that /x and /s aren't on by default (for p5).
As this is my first post about pugs - all I can say is "wow." It is great to
already be coding perl6.
Thanks Autrijus and crew.
Paul
On Thursday 14 April 2005 07:36 a
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"
# pr
On Friday 15 April 2005 11:57 am, Juerd wrote:
> Paul Seamons skribis 2005-04-15 11:50 (-0600):
> > my %h = ;
> > {
> > temp %h{$_} ++ for %h.keys;
>
> Just make that two lines. Is that so bad?
>
> temp %h;
> %h.values »++;
>
For the given exa
>
> 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 = {
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'
> 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 an
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 i
> 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 := $_
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
> > meth foo {
> > $_.meth; # defaults to the invocant
> > .meth; # operates on $_ which defaults to the invocant
> > $^.meth; # is the invocant
> > $^1.meth; # is the first invocant
> > $^2.meth; # is the second invocant
>
> I'm starting to get confused at the "need" fo
Minor note.
Would you want this:
>sub &infix:(Str $a, Str $b) { return ($a eq $b) ? $a : ''; }
to be:
sub &infix:(Str $a, Str $b) { return ($a eq $b) ? $a but bool::true:
''; }
(Is that the right way to do it ?)
Paul
> =item *
>
> Quantifiers (except C and C) cause a matched subrule or subpattern to
> return an array of C 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 t
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 no
if you can do
@array.push(3 => 'value'); # index 3 gets 'value'
# which is harder han @array[3] = 'value'
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
guess Foo would 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
integer return values
The current example is listed below. I am very much a novice at reading PASM
so hopefully I didn't interpret the program wrong.
Paul Seamons
PS - By the way the new examples (I think they are new - they are new to me)
are very nice and descriptive of
Sigh - sheepishly read that I can't even spell "There" correctly. - double
sigh.
On Wednesday 13 October 2004 12:13 pm, Paul Seamons wrote:
> Their is an example at http://www.parrotcode.org/examples/ that returns a
> list of integers that span two integers. The return t
to offer enough justification for the creation of
new syntax in either language.
Paul Seamons
as well - if the code doesn't compile, then perldoc would
not be able to generate the code - but it could always show an error that the
code doesn't compile and then show what poddoc would show.
The outcome is that poddoc can be Pod6 "pure" and perldoc can be (as its name
suggests) documentation for Perl.
Just my opinions.
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
> 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
> Other available chars:
>
> <`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 -
altho
are fired?
I don't think I've been clear enough, but I'll post and then answer
questions. I think that it would be good to have something that
libraries could use without having to drop down to the C level - I
just am not sure if this is too much bloat to implement it.
Paul Seamons
I've been here all along - I'm just really quiet.
> 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 syntacti
> 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 fundament
> I am starting to implement a GLUT and OpenGL binding for Parrot. GLUT
> is extremely callback-oriented. You essentially can't do anything
> beyond open the top-level window until callbacks are functional. You
> can't even draw in that window -- the rendered image never actually
> appears, and
50 matches
Mail list logo