Re: Hyperoperators and dimensional extension
At 12:04 AM -0700 9/18/02, Brent Dax wrote: >The Apocalypse on operators says that if one of the operands of a >hyperoperator is a scalar, then that scalar is (nominally) treated as an >array of copies of that scalar. In other words: > > my $foo=1; > my @bar=(2, 3, 4); > > my @baz=$foo ^+ @bar; # @baz=(3, 4, 5) > >Does that extend to multiple dimensions? Sort of, yes. Basically the behaviour of hyper-operated operators is delegated via multimethod dispatch to the hyper-operator functions. By default the base perl variables will expand themselves out, but the engine itself won't enforce this, as the classes can potentially overload the hyper-operators. So if the multiple-dimensional aggregate provides a proper "operate against a single scalar" method that goes multidimensionally, then we'll do that. If it doesn't, we won't. -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: hotplug regexes, other misc regex questions
Steve Fink wrote: > What should this do: > > my $x = "the letter x"; > print "yes" if $x =~ /the { $x .= "!" } .* !/; > > Does this print "yes"? If it's allowed at all, I think the match should succeed. > print "yes" if "helo" =~ /hel { .pos-- } lo/; This definitely has to work. But remember the call to C is on the "match object" (i.e. $0), not the string. > Would it be correct for this to print 0? Would it be correct for this > to print 2? > > my $n = 0; > "aargh" =~ /a* { $n++ } aargh/; > print $n; Yes. ;-) > What possible outputs are legal for this: > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/ Unless Larry specifies a required semantics, there are potentially very many acceptable outputs from this, depending on implementation. Therefore, your implementation must print the superposition of all possible outputs. ;-) Actually, I would expect that *any* pattern with closures in it should act as though it were trying each branch and loop in the normal sequence (even if it optimizes that sequence away (which probably means it can't do that optimization in the first place (which means it should act as though it were trying each branch and loop in the normal sequence %-))). Of course, LMMV. Damian
Re: hotplug regexes, other misc regex questions
On Wed, 18 Sep 2002, Damian Conway wrote: > > Would it be correct for this to print 0? Would it be correct for this > > to print 2? > > > > my $n = 0; > > "aargh" =~ /a* { $n++ } aargh/; > > print $n; > > Yes. ;-) Wouldn't that print 2 if $n is lexical and 0 if it's localized? Or are lexicals localized now? > > What possible outputs are legal for this: > > > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/ I take it that what I've learned from _Mastering_Regular_Expressions_ doesn't quite apply here? From that interpretation I'd think it'd print "111\n" since the second part of the alternation wouldn't be tried. Joshua b. Jore http://www.greentechnologist.org
Re: Perl 6 Summary for week ending 2002-09-15
On Wed, 2002-09-18 at 11:42, Piers Cawley wrote: > The Perl 6 Summary for the Week Ending 20020915 > Happy birthday to me! Indeed! And thank you so much for this. You have a way of taking a tangled mess of discussion that's even confusing the participants and making it easy to digest (no pun intended). I even come out of it with a smile at the end. Thanks again! -- Aaron Sherman <[EMAIL PROTECTED]> http://www.ajs.com/~ajs
Perl 6 Summary for week ending 2002-09-15
The Perl 6 Summary for the Week Ending 20020915 Happy birthday to me! Happy birthday to me! Happy birthday dear me! Happy birthday to me! And, with a single breech of copyright, Piers was free. The production of this summary was delayed by my turning 35 on the 15th and then spending the Monday train journey reading one of my birthday presents (*Dead Air* by Iain Banks, it's jolly good) instead of writing a summary. So this morning I left the book at home. So, what's been going on with Perl 6. We'll start, as usual with perl6-internals. Goal call for 0.0.9 The week before, Dan had asked for some suggestions as to what should be the priorities for the 0.0.9 release of Parrot. One of Nicholas Clark's goals from last week was the `Careful elimination of all compiler warnings, particularly on non x86 platforms, and for builds with non-default INTVAL size', and discussions of how to go about doing this (and indeed some doing) carried on into this week. There was also some discussion about whether IMCC and the Perl 6 compiler should be built by default. On the one hand, it would mean that the tinderboxes were testing those important subsystems, on the other hand, it was thought that there were some people who wouldn't be interested in testing those things. Consensus seemed to be that we should just build and test them anyway. http://makeashorterlink.com/?M2E0225D1 Scheme Implementation Details Jürgen Bömmels and Piers Cawley continued their discussion of how to go about implementing a scheme interpreter, and "lambda" in particular. Piers made noises about a proof of concept implementation of Scheme that he'd made using Perl objects, but didn't show code. (And, I can exclusively reveal, will not be showing (the original) code owing to badness with backups and lackadaisical use of CVS). Jürgen, who had actually made the effort of writing some code, listened politely and agreed that Piers' suggestions looked like they might be a way forward. Jürgen went away and implemented a first cut at "quote", "define" and "set!". http://makeashorterlink.com/?O2F0325D1 http://makeashorterlink.com/?K101255D1 "chr", "ord" etc. Clinton A Pierce restarted this thread and discussed what he'd like to see (apart from a pony) from Parrot's equivalent of Perl 5's "pack". Clint wondered whether Parrot "pack" should use a template, or if it should be implemented as a horde of smaller ops, each handling a different conversion, so that a single, Perl level call to pack would become lots of op calls at the parrot level. Clint also drools at the thought of doing "sprintf" at the parrot level. Aaron Sherman agreed with most (all?) of Clint's proposals, and also wants a pony. (Who doesn't?). Peter Gibbs went so far as to offer a patch which implemented a subset of pack functionality, and was applauded. Graham Barr wondered if pack should also allow for packing to 'native' types, which wouldn't have to worry about endian issues. Peter thought that would be a good idea. Nicholas Clark pointed out that extending the code to cope with unsigned integers would be a good idea too. http://makeashorterlink.com/?A311215D1 Lexicals Jürgen Bömmels asked a pile of questions about the implementation of lexical variables and how one could use them to make a closure. Jonathan Sillito provided a mixture of answers and guesses. It seems that we're waiting on Dan to firm some things up about lexicals. http://makeashorterlink.com/?E221215D1 IMCC 0.0.9 Runs 100% Perl 6 Tests + Various Results Leopold Toetsch has been working on getting IMCC to generate parrot bytecode directly rather than going through a stage of generating an intermediate ".pasm" file, and had been having some problems with `writing out the .pbc, especially Const_Table, type PFC_KEY / PARROT_ARG_SC'. Two hours later he announced that he had all the perl6 tests running successfully within IMCC, but only if GC was turned off (there are problems with the longer running tests when GC is turned on). Things get progressively worse as first JIT, and then Predereferencing are turned on. Dan wondered what the GC bug could be. Leo wasn't sure but posted some possible pointers. Peter Gibbs thought that at least one of the bugs was in continuation.pmc and posted a patch which fixed one of the problems when running under parrot. Meanwhile Leo tracked down the bug to a bit of code that he'd appropriated from debug.c, so he fixed his IMCC and sent in a patch to fix debug.c as well. Applying both patches meant that the tests all passed under both IMCC and parrot. Dan applied both patches. Leo later fixed his problem with writing out a .pbc file directly from IMCC, and offered a patch to pa
Re: hotplug regexes, other misc regex questions
On Wed, 18 Sep 2002, Josh Jore wrote: > On Wed, 18 Sep 2002, Damian Conway wrote: > > > > Would it be correct for this to print 0? Would it be correct for this > > > to print 2? > > > > > > my $n = 0; > > > "aargh" =~ /a* { $n++ } aargh/; > > > print $n; > > > > Yes. ;-) > > Wouldn't that print 2 if $n is lexical and 0 if it's localized? Or are > lexicals localized now? Well, { $n++ } is within the lexical scope of $n, so it doesn't matter. What matters is whether $n++ was hypotheticalized like so: "aargh" =~ /a* { let $n++ } aargh/ # can it work that way? Then it would either print 1 or 0, because if it backtracked, the ++ would be undone. If the change is adopted that you can't optimize when there's a closure in the middle of the optimization, it would print 1. > > > What possible outputs are legal for this: > > > > > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/ > > I take it that what I've learned from _Mastering_Regular_Expressions_ > doesn't quite apply here? From that interpretation I'd think it'd print > "111\n" since the second part of the alternation wouldn't be tried. The first time through, yes. But then it tries to match the "x", and says "oops, that's not what I have" and backtracks. That tries the second of the alternation, which doesn't work either. So it backtracks so the * is only getting two of the first one, et cetera... Or are you talking about something else from Mastering Regular Expressions? Like some kind of optimization that happens? Luke
Re: Perl 6 Summary for week ending 2002-09-15
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Wed, 2002-09-18 at 11:42, Piers Cawley wrote: >> The Perl 6 Summary for the Week Ending 20020915 >> Happy birthday to me! > > Indeed! > > And thank you so much for this. You have a way of taking a tangled mess > of discussion that's even confusing the participants and making it easy > to digest (no pun intended). I even come out of it with a smile at the > end. Someone just pointed out that I called Tim Bunce "Tim Bunch" in the summary. I really should resist the temptation to post it before at least one extra pair of eyes has looked over it, but I was running my deadline pretty close. The typo makes me, at least, smile, but in a rueful kind of way. > Thanks again! No problem. It's fun, in a weird kind of way. And it definitely keeps me abreast of what's going on. -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?