[perl #63152] [PATCH] implement 'make' and support '$/' a method parameter
# New Ticket Created by Chris Dolan # Please include the string: [perl #63152] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63152 > The attached patch brings Rakudo up to the level of NQP as a language for grammar actions. I added a builtin method called 'make' that is sugar for $/.result_object(...). I also modified the grammar to allow special variables ($/, $_, $) to be method arguments. The latter has a little more copy-and-paste than I wanted, but it works well. To apply: git pull git://github.com/chrisdolan/rakudo.git match-make or git am -3 0001-Implement-make-builtin-and-support-as-a-metho.patch Description: Binary data I intend to add some spec tests for this, too.
[perl #63154] [PATCH] support :lang(Perl6) embedded in PGE
# New Ticket Created by Chris Dolan # Please include the string: [perl #63154] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63154 > The simple attached patch allows embedded code in PGE to call back into Rakudo. The double curlies are still necessary due to PGE implementation details. With this patch the following simple examples work: % perl6 -e '"" ~~ m/:lang(Perl6) {{ say "hi"; }}/' % perl6 -e '"" ~~ m/:lang(Perl6) {{ say 2+2; }}/' % perl6 -e '"" ~~ m/:lang(Perl6) {{ say 2**45; }}/' % perl6 -e '"" ~~ m/:lang(Perl6) {{ say exp(1); }}/' % perl6 -e '"" ~~ m/:lang(Perl6) {{ say pi; }}/' The invoker created by this patch does not perform any exception handling, nor does it return a value. In that sense, it's probably incorrect... git pull git://github.com/chrisdolan/rakudo.git pge-invoke 0001-Add-invoke-method-to-perl6-HLLCompiler-to-allow-em.patch Description: Binary data
[perl #62894] Rakudo thinks that protoobjects are defined
On Thu Jan 29 02:18:55 2009, masak wrote: > so protoobjects are defined? > rakudo: class A {}; my A $a; say $a.defined > rakudo 36139: OUTPUT«1» > well, that's wrong > * masak submits rakudobug > perl6: my $a; say $a.defined > rakudo 36139: OUTPUT«0» > ..elf 25110, pugs: OUTPUT«» > perl6: class A { }; my A $a; say $a.defined > rakudo 36139: OUTPUT«1» > ..elf 25110, pugs: OUTPUT«» > hah, two against one :) Fixed in git d668ca9 and tests added to S12-class/basic.t to make sure we don't regress on it. Thanks, Jonathan
[perl #62828] .clone inside while loop which shifts off an array doesn't clone properly in Rakudo
On Tue Jan 27 05:27:07 2009, masak wrote: > rakudo: class A { has $.b; }; while shift [A.new( :b(0) )] -> > $a { say $a.b; $a.clone( :b($a.b + 1) ); say $a.b; last; } > OUTPUT[01] > * masak submits rakudobug Fixed in git 59024e0 and added pretty much this exact code as a test case to S12-attributes/clone.t. Thanks! Jonathan
[perl #63002] Int values cannot be passed as params and then used in ranges in Rakudo
On Tue Feb 03 07:25:43 2009, masak wrote: > Parrot r36318 (before the merge that broke Rakudo), and Rakudo 21f374. > > $ perl6 -e 'my $a = 5; say $a.PARROT; say $a .. 5' > Int > 5 > $ perl6 -e 'my $a = 5; sub foo($a) { say $a.PARROT; say $a .. 5 }; foo($a)' > ObjectRef->Int > Undefined value shifted from empty range > > $ > > Note that not only is a warning emitted, but the second 'say' outputs > a blank line. Was more clone-related fun. I suspect when we've been calling Parrot's clone directly, we'll usually want to really be calling .clone() on the object, since it can handle ObjectRef chains. That fixes this issue. (Of course, in a Perl 6 prelude we'd call the .clone() method too...) So, resolved in git 1beabec and added a test for this into S02-builtin-datatypes/range.t. This also made one of the 99-problems tests that had been failing pass, so un-todo'd that. :-) Thanks, Jonathan
[perl #62768] Rakudo dies when PIR-compiling a module that depends on a module with undeclared barewords
On Wed Feb 11 05:15:12 2009, jn...@jnthn.net wrote: > On Fri Jan 30 01:29:38 2009, masak wrote: > > The failure during PIR compilation turned out to be due to an undeclared > > identifier 'B'. > > > > $ cat A.pm > > use v6; > > > > class A { > > has B $!b; > > } > > $ cat A/B.pm > > use v6; > > use A; > > > > class A::B is A { > > } > > $ perl6 --target=pir --output=A.pir A.pm > > $ perl6 --target=pir --output=A/B.pir A/B.pm > > Lexical 'self' not found > > [...] > > > > But that makes this bug a variant of #67268. Marking it as such. > > Actually you don't need anything fancy to re-produce this, just: > > class A { has B $.x } > > In the REPL does it. > And that now reports a "Malformed declaration" at compile time, following STD.pm's lead (though we can't say it's a my or has declaration yet, but I've put in a comment noting the difference). So, fixed in git fba805c. Thanks, Jonathan
[perl #61682] Cloning affects the original object under certain conditions in Rakudo
On Thu Dec 25 06:49:28 2008, masak wrote: > Rakudo r34342 sometimes destroys the original object when running > .clone(). This works: > > $ cat right.p6 class A { has $.b; } > my @q = A.new( :b(1) ); > my $p = shift @q; > $p.clone( :b($p.b + 1) ); > say $p.b; > > $ perl6 right.p6 > 1 > > But when a while loop is introduced, the original object is changed: > > $ cat wrong.p6 > class A { has $.b; } > my @q = A.new( :b(1) ); > while shift @q -> $p { > $p.clone( :b($p.b + 1) ); > say $p.b; > } > > $ perl6 wrong.p6 > 2 I think this is pretty much the same as a bug I fixed earlier today. Anyway, it now in latest Rakudo gives 1, which is the Right Answer, so resolving. :-) Thanks, Jonathan
[perl #58676] [BUG] smart-matching to Grammar should check type, not set $/
On Mon Sep 08 08:46:20 2008, cjfie...@illinois.edu wrote: > The following is an example: > > grammar Foo { > rule TOP {\d+}; > }; > > my $x = '12345'; > > $x ~~ Foo; # Is $x a Foo? (No) This now today will do a type-check. (Note that .new on grammars is still a bit kinky, but .parse and .parsefile are the official ways to do matching of a grammar now - .new will be dealt with by pm during other PGE changes, I expect :-)). So I think the main issue in this ticket is now resolved. Thanks! Jonathan
[perl #59828] Rakudo parses equals sign in rule declaration, whereas STD doesn't
On Sun Oct 12 04:59:26 2008, masak wrote: > r31879: > > $ perl6 -e 'rule x = { x }' > get_iter() not implemented in class 'Closure' > [...] > > STD considers this faulty syntax (and I do, too), but Rakudo > apparently tries to make sense of it, and fails at runtime trying to > apply prefix:<=> to the closure { x }. As of GIT 1b7a3e3 this reports: Malformed regex definition As STD.pm does. Also pulled in those for methods and routines, so we shouldn't get similar bugs in those. Thanks, Jonathan
[perl #60826] Subset types and lexicals don't mix
On Tue Nov 25 13:56:09 2008, moritz wrote: > Rakudo r33193: > > > my $x = 5; subset MyInt of Int where { $^num % $x == 0}; my MyInt $a > = 10; say $a; > Type mismatch in assignment. > > If I use a constant instead of the lexical $x, it works just fine. > > There's a test for that in t/spec/S12-subset/subtypes.t > This is working in current Rakudo. I unfudged the tests, and also stuck in a couple of parens to one of them, since we don't currently parse item assignment right and it was getting in the way of passing it. So, resolving the ticket. Thanks! Jonathan
[perl #62702] Rakudo misparses empty regex definitions as sub calls
On Sat Jan 24 08:40:24 2009, masak wrote: > Rakudo r35957: > > $ perl6 -e 'grammar G { regex TOP {} }' > Could not find non-existent sub TOP > [...] > > This is the wrong error message to give. The empty regex in TOP should > be disallowed. After fixes for a related ticket earlier, this now reports: Malformed regex definition at line 1, near "TOP {} }\n" Thanks! Jonathan
Re: [perl #63154] [PATCH] support :lang(Perl6) embedded in PGE
On Tue, Feb 10, 2009 at 08:32:50PM -0800, Chris Dolan wrote: > The simple attached patch allows embedded code in PGE to call back > into Rakudo. The double curlies are still necessary due to PGE > implementation details. With this patch the following simple > examples work: > > % perl6 -e '"" ~~ m/:lang(Perl6) {{ say "hi"; }}/' > % perl6 -e '"" ~~ m/:lang(Perl6) {{ say 2+2; }}/' > % perl6 -e '"" ~~ m/:lang(Perl6) {{ say 2**45; }}/' > % perl6 -e '"" ~~ m/:lang(Perl6) {{ say exp(1); }}/' > % perl6 -e '"" ~~ m/:lang(Perl6) {{ say pi; }}/' Patch rejected, at least for the moment. I'm not wanting to turn compilers into invokable objects (that's an outdated Parrot model that we're working to eliminate), and my experience with grammar matching leads me to want to avoid creating special syntax workarounds. When PCT::HLLCompiler gets its refactor (soon) then PGE will also be updated to correctly parse code blocks written in other languages. Thanks, Pm
[perl #61886] [TODO] Grammar.parse and Grammar.parsefile
On Wed Dec 31 13:10:48 2008, masak wrote: > and Grammar.parse($string) should work > is that specced? > or StoryGrammar.new($string).TOP > <[particle]> yes, trying to help you Get It Right. > TimToady: I gotta write this down somewhere. > .parse($string) on a grammar doesn't seem to be implemented > in rakudo atm > also .parsefile($filename) pmichaud++ already implemented .parse a while ago, and today I added both .parsefile in git 7b867b7 and tests for the pair of them to the spectests. And .new already worked like that. So, resolving ticket. Thanks! Jonathan
[perl #62700] .parse hangs on empty grammar
On Sat Jan 24 08:38:49 2009, masak wrote: > It's r35957, and Rakudo seems to hang on the following: > > $ perl6 -e 'grammar G {}; G.parse("")' > > Putting in a 'regex TOP { something }' seems to work... but it's a bit > unintuitive that nothing happens without it, not even an error > message. Fixed in git 8b8095c; this now dies with: The grammar has no TOP rule to invoke. Thanks, Jonathan
Re: [perl #63002] Int values cannot be passed as params and then used in ranges in Rakudo
On Wed, Feb 11, 2009 at 05:02:52AM -0800, jn...@jnthn.net via RT wrote: > Was more clone-related fun. I suspect when we've been calling Parrot's > clone directly, we'll usually want to really be calling .clone() on the > object, since it can handle ObjectRef chains. That fixes this issue. (Of > course, in a Perl 6 prelude we'd call the .clone() method too...) Just to echo a couple of comments from #parrot: For language interop reasons I suspect that we really want to bias towards the Parrot opcodes and not towards Rakudo methods. Rakudo will then need to map the Parrot vtable functions into the appropriate (overridable) method calls in Perl 6. However, I haven't totally convinced myself that this is the correct approach, so I'm not looking to immediately convert everything in the Rakudo source to use one approach or the other. Just keep in mind that at the moment my general bias for PIR builtins is to use the opcode-based invocations instead of the method-based ones. Pm
[perl #60380] [TODO] catch modification of read-only arguments
On Thu Nov 06 10:37:55 2008, mor...@casella.verplant.org wrote: > Rakudo r32373: > > $ ./perl6 -e 'sub f($x) {$x++}; my $y = 2; f($y); say "still here"' > still here > > that should die, because subroutine arguments are read-only by default. > A test for that is in t/spec/S06-traits/misc.t. > Fixed in git 45cf376 and that test is un-fudged. Thanks, Jonathan
[perl #61824] ++ makes variables rw, <-> seemingly doesn't
On Mon Dec 29 10:17:11 2008, masak wrote: > rakudo: my @a = <1 2 3 4 5 6>; my @b = (10..16); for @a Z @b > <-> $a,$b { $a++ }; say @a; > rakudo 34586: OUTPUT«234567» > rakudo: my @a = <1 2 3 4 5 6>; my @b = (10..16); for @a Z @b > <-> $a,$b { $a = $a +1 }; say @a; > rakudo 34586: OUTPUT«Cannot assign to readonly variable. [...] > rakudo: my @a = <1 2 3 4 5 6>; my @b = (10..16); for @a Z @b > -> $a,$b { $a++ }; say @a; > rakudo 34586: OUTPUT«234567» > yea ++ is working regardless of anything else ;) how odd > * masak submits rakudobug ++ now doesn't work regardless any more as of git 45cf376, and <-> is now also implemented in git bb2cdb7 (didn't add any more tests, since once the ++ problem is solved then we can't really pass both that test and the <-> one without having both done properly, so I think coverage is enough). Thanks! Jonathan
[perl #61528] Optional typed parameters can cause type check failure when no value passed
On Fri Dec 19 08:49:28 2008, cspencer wrote: > > When defining a subroutine such as the following: > >sub foo (Int $x?) { say "x = $x" }; > > and calling it without passing in a value as in: > >foo(); > > a type check error will occur: > >Parameter type check failed in call to foo >... Fixed this in git 50a61ae. Thanks, Jonathan
[perl #63048] Omitted typed named params cause errors in Rakudo
On Fri Feb 06 23:12:31 2009, mberends wrote: > Improving the signal-to-noise ratio of the above, using perl6 -e'...': > > class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m("HAI") > class A {method m(Str :$p){my $p2=$p // "";say "m$p2"}}; A.new.m() > > The first line works. > The second dies saying 'Parameter type check failed for $p in call to m' > Now as of git 50a61ae they both work, as they should. Thanks, Jonathan
[perl #61348] Rakudo dies strangely when classes are extended with "is also" without first being defined
On Thu Jan 29 21:08:33 2009, s1n wrote: > On Sun Dec 14 02:12:09 2008, masak wrote: > > Rakudo r33860 can handle extending classes with new methods just fine... > > > > $ perl6 -e 'class A {}; class A is also { method foo() { say "OH HAI" > > } }' # works > > > > ...but not when the class wasn't first defined. > > > > $ perl6 -e 'class A is also { method foo() { say "OH HAI" } }' # mwhahaha > > Null PMC access in find_method() > > [...] > > > > Maybe the above _should_ be an error (though I don't immediately see a > > reason), but I don't think it should be a Null PMC access. > > As of r36167, this will no longer crash as described, nut a different > crash will occur if A is used: > > $ ./ -e 'class A is also { method foo() { say "OH HAI" } }; my $t = > A.new; $t.foo();' > Null PMC access in getprop() > [...] > This now fails at compile time with: Cannot use 'is also' on non-existent class A As of git b2e7ac9. Plus added test to help make sure even the declaration against a non-existent type fails. Thanks, Jonathan
References to parts of declared packages
Hi, If we declared, for example: role A::B {}; Then what should a reference to A be here? At the moment, Rakudo treats it as a post-declared listop, however I suspect we should be doing something a bit smarter? If so, what should the answer to ~A.WHAT be? Thanks, Jonathan
Re: References to parts of declared packages
On Wed, Feb 11, 2009 at 12:15 PM, Jonathan Worthington wrote: > Hi, > > If we declared, for example: > > role A::B {}; > > Then what should a reference to A be here? At the moment, Rakudo treats it > as a post-declared listop, however I suspect we should be doing something a > bit smarter? If so, what should the answer to ~A.WHAT be? > > Thanks, I'd go with one of two possibilities: * Don't allow the declaration of A::B unless A has already been declared. or * A should be treated as a post-declared package. -- Jonathan "Dataweaver" Lang
Re: References to parts of declared packages
Jon (>), Jonasthan (>>): >> If we declared, for example: >> >> role A::B {}; >> >> Then what should a reference to A be here? At the moment, Rakudo treats it >> as a post-declared listop, however I suspect we should be doing something a >> bit smarter? If so, what should the answer to ~A.WHAT be? > > I'd go with one of two possibilities: > > * Don't allow the declaration of A::B unless A has already been declared. > [...] Please don't go with this former alternative. In a project even of moderate size like Druid, many packages of type A::B are declared before the corresponding A package is, for perfectly legitimate reasons. > * A should be treated as a post-declared package. Whatever this means, it sounds preferable. :) // Carl
[nicho...@hexten.net: [1255] Avoid using -l in the one liner that determines @INC, for the benefit of Rakudo]
Patrick, done: - Forwarded message from nicho...@hexten.net - Envelope-to: n...@ccl4.org Delivery-date: Wed, 11 Feb 2009 20:45:22 + Delivered-To: tapx-com...@hexten.net From: nicho...@hexten.net To: tapx-com...@hexten.net Subject: [1255] Avoid using -l in the one liner that determines @INC, for the benefit of Rakudo X-Mailer: SVN::Notify 1.0: http://search.cpan.org/dist/SVN-Notify/ Date: Wed, 11 Feb 2009 20:45:13 + (GMT) Reply-To: tapx-...@hexten.net Errors-To: tapx-commit-boun...@hexten.net Revision: 1255 Author: nicholas Date: 2009-02-11 20:45:13 + (Wed, 11 Feb 2009) Log Message: --- Avoid using -l in the one liner that determines @INC, for the benefit of Rakudo (The Perl 6 command line has removed -l, and when used to test Rakudo, T::H ends up calling Rakudo as $perl at this point, to determine its @INC) Modified Paths: -- trunk/lib/Test/Harness.pm Modified: trunk/lib/Test/Harness.pm === --- trunk/lib/Test/Harness.pm 2009-02-11 12:40:55 UTC (rev 1254) +++ trunk/lib/Test/Harness.pm 2009-02-11 20:45:13 UTC (rev 1255) @@ -305,7 +305,8 @@ local $ENV{PERLLIB}; my $perl = $ENV{HARNESS_PERL} || $^X; -chomp( @inc = `$perl -le "print join qq[\\n], \...@inc"` ); +# Avoid using -l for the benefit of Perl 6 +chomp( @inc = `$perl -e "print join qq[\\n], \...@inc, q[]"` ); return @inc; } } ___ tapx-commit mailing list tapx-com...@hexten.net http://hexten.net/mailman/listinfo/tapx-commit - End forwarded message -
Re: References to parts of declared packages
Carl Mäsak wrote: >> * A should be treated as a post-declared package. > > Whatever this means, it sounds preferable. :) It means that you can define package A without ever declaring it, by declaring all of its contents using such statements as 'role A::B ', 'sub A::Foo', and so on. -- Jonathan "Dataweaver" Lang
S03: how many metaoperators?
With the addition of the reversing metaoperator, the claim that there are six metaoperators (made in the second paragraph of the meta operators section) is no longer true. Likewise, the reduction operator is no longer the fourth metaoperator (as stated in the first sentence of the reduction operators section). For now, the cross operator _is_ still the final metaoperator, as it states in its first paragraph; but it's possible that that might change eventually. -- Jonathan "Dataweaver" Lang
Re: [perl #36283] [TODO] pasm/pir: forbid assignment syntax for inout params
I almost couldn't believe how I could have missed that, until I remembered what was the problem.Thing is, there are some ops (and of course, this should be possible, as users can load dynops) that have different variants, with different directions for the first arg. For instance: (can't remember the real example; just try run make test with the patch) $P0 = foo "x" # foo_p_sc, variant 1 $P0 = foo # foo_p, variant 2 If you know the short name of an op, you get a semi-random variant of that op (that is, the byte code). So, you can't know which opinfo you get (for what variant). You can ONLY know the right variant, if you know the full signature of the op, something that you don't know until bytecode generation (happens way later in imcc). I'm probably not explaining this correctly or very clearly, but I can guarantee it will never work. (unless, of course, you precalculate the full signature right there, but... let's just stick with "good luck" as the appropriate message for that :-) I've tried this approach, it doesn't work, unfortunately. Also, I would strongly suggest that we disallow use of full-signatured opnames in PIR. It's not needed, as literally nobody uses ops like "print_sc". Also, it might be slightly more efficient, as whenever an is_op() call is done with a non-op, there's 2 searches, 1 for the short name, 1 for the long name. (and I think PIRC can't even handle it as it stands now, although implementability shouldn't be a valid reason, I admit that. I wonder whether IMCC will handle it fully correctly in all cases) kjs On Wed, Feb 11, 2009 at 8:54 PM, Andrew Whitworth via RT < parrotbug-follo...@parrotcode.org> wrote: > I've attached my first attempt to make this work. I had hoped we could > combine the is_op check in imcc.l with this check in imcc.y to prevent > having to dig into the oplib twice for each op, but that's an > optimization to consider at a later date. > > The patch checks the op to ensure that it's first argument is an "OUT" > argument. If it is not, we throw a syntax error exception. > > I haven't tested this yet, no flex/bison on this computer. I'll do it at > home tonight. If anybody else can test this, or has an opinion on it, or > whatever let me know. >
Perl 6 pod processor in Perl 5
As an experiment to check how we could reuse CPAN to distribute Perl 6 packages I uploaded Perl6::Conf The code itself is not interesting, my main interest is the "distribution". One of the issues I encountered is the display on the two search engines: http://search.cpan.org/dist/Perl6-Conf/ http://kobesearch.cpan.org/dist/Perl6-Conf Not surprisingly neither of them can handle the perl pod. I contacted both maintainers asking to look into it suggesting to use Perl6::Perldoc of Damian but it is quite old. Is there any other module written in Perl 5 that could parse a perl 6 file, recognize the pod and help with the display? Gabor
Re: Perl 6 pod processor in Perl 5
* Gabor Szabo (szab...@gmail.com) [090212 06:44]: > As an experiment to check how we could reuse CPAN to distribute Perl 6 > packages. > > Not surprisingly neither of them can handle the perl pod. > I contacted both maintainers asking to look into it suggesting > to use Perl6::Perldoc of Damian but it is quite old. The reason for that may be that (after a very long discussion) Damian promissed me to have a serious look at a more powerful documentation systems, like there is in python or Java. And he never found time to look into that. -- Regards, MarkOv Mark Overmeer MScMARKOV Solutions m...@overmeer.net soluti...@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net