Re: S5 updated
I've been working at updating the various synopses on dev.perl.org. In particular, you folks might like to know that the regex synopsis at: http://dev.perl.org/perl6/synopsis/S05.html is no longer two years out of date :-) Larry ok, cool, I'm beginning to understand perl6 patterns a bit better. Just a tiny request though (and I seem to remember this being discussed) - I wish that there was an easy syntax to turn regexes inside out as it were, to be able to generate text strings given a certain rule, especially at border cases - something like: rule nonquote { [^\n]+ } rule slashchar { \\ [^\n] } m:gen('1000')/( ( nonquote | slashchar )* )/ generating x \x \\x ie - 1000 matching strings for the particular rule. If this isn't possible in the core itself, I'd be interested in seeing how it would be possible to program outside it as a user defined modifier. Ed ( ps - is there a 'metaphor translation guide' between perl5 and perl6 regex? ex - what does ?: translate to? is '?' subsumed by backtracking control and if so, how? )
[perl #31647] Segfault when calling dynamically compiled code from dynamically compiled code
# New Ticket Created by Matt Diephouse # Please include the string: [perl #31647] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31647 --- osname= darwin osvers= 7.0 arch= darwin-thread-multi-2level cc= cc --- Flags: category=core severity=critical ack=no --- The following PIR segfaults. However, if you switch the order and call builtin before dynamic, it runs smoothly. .sub main @MAIN $P1 = new PerlHash newsub $P0, .Sub, _builtin $P1['builtin'] = $P0 $P2 = compreg PIR $S0 = .sub main\nprint \dynamic\\n\\nend\n.end $P0 = compile $P2, $S0 $P1['dynamic'] = $P0 store_global funcs, $P1 $S0 = .sub main\n$P1 = find_global\funcs\\n $S0 .= $P0 = $P1['dynamic']\n$P0()\n $S0 .= $P0 = $P1['builtin']\n$P0()\n $S0 .= end\n.end $P2 = compreg PIR $P0 = compile $P2, $S0 $P0() end .end .sub _builtin print builtin\n .pcc_begin_return .pcc_end_return .end -- matt --- Summary of my parrot 0.1.0 configuration: configdate='Wed Sep 15 18:14:17 2004' Platform: osname=darwin, archname=darwin-thread-multi-2level jitcapable=1, jitarchname=ppc-darwin, jitosname=DARWIN, jitcpuarch=ppc execcapable=1 perl=perl Compiler: cc='cc', ccflags='-g -pipe -pipe -fno-common -no-cpp-precomp -I/usr/local/include -pipe -fno-common -Wno-long-double ', Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags='-L/usr/local/lib -flat_namespace ', cc_ldflags='', libs='-lm' Dynamic Linking: so='.dylib', ld_shared='-bundle -undefined dynamic_lookup -L/usr/local/lib', ld_shared_flags='' Types: iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4, ptrsize=4, ptr_alignment=1 byteorder=4321, nv=double, numvalsize=8, doublesize=8 --- Environment: DYLD_LIBRARY_PATHHOMELANGLANGUAGELD_LIBRARY_PATHLOGDIRPATH SHELL
Re: S5 updated
Edward Peschko writes: I've been working at updating the various synopses on dev.perl.org. In particular, you folks might like to know that the regex synopsis at: http://dev.perl.org/perl6/synopsis/S05.html is no longer two years out of date :-) Larry ok, cool, I'm beginning to understand perl6 patterns a bit better. Just a tiny request though (and I seem to remember this being discussed) You were the one who initiated the thread :-) - I wish that there was an easy syntax to turn regexes inside out as it were, to be able to generate text strings given a certain rule, especially at border cases - something like: rule nonquote { [^\n]+ } rule slashchar { \\ [^\n] } m:gen('1000')/( ( nonquote | slashchar )* )/ generating x \x \\x ie - 1000 matching strings for the particular rule. If this isn't possible in the core itself, I'd be interested in seeing how it would be possible to program outside it as a user defined modifier. http://www.nntp.perl.org/group/perl.perl6.language/14458 If you replace the first line: method Rule::Group::generate(Int $n) { With multi generate (Rule::Group $group: Int $n) { Everything ought still to work. I think the best you can do is to implement it as a routine. You can't really make it a modifier, because it's pretty separate from actually matching anything. Ed ( ps - is there a 'metaphor translation guide' between perl5 and perl6 regex? ex - what does ?: translate to? is '?' subsumed by backtracking control and if so, how? ) Are you asking, or asking whether there's some official guide somewhere? To answer the latter question: no. Luke
Re: Still about subroutines...
On Thu, 16 Sep 2004, Jonathan Scott Duff wrote: And FWIW, I kinda like $ even with the over-done :-) me too! Michele -- [...] is like requiring to play tennis with a square ball. Which admittedly makes the game more interesting. - Giuseppe Oblomov Bilotta in comp.text.tex (edited)
Re: Still about subroutines...
On Thu, 16 Sep 2004, Larry Wall wrote: Except that only one of these variables' meanings is actually associated with subs. And I kind of like to read the C? as which. So if we actually make use of our sigils, we get possibilities like this: [snip useful examples] at first I didn't get what you mean, but now I must admit it does make sense and looks smart too. Michele -- Yesterday I was in doubt whether to add you to my killfile. Today, I no longer have that doubt. - Alan J. Flavell in clpmisc, Re: short script differences
Re: Still about subroutines...
On Fri, 17 Sep 2004, Larry Wall wrote: with a named abstraction is not terribly useful. The whichness of C? happens subconsciously, whereas having a named hash forces As I said in my other mail, the more I think of this the more it seems to me to be reasonable and even natural. It's which?-ness, though! ;-) Michele -- I hold a square measuring 10x10 metres away from a person who is standing 100 metres away. I ask them to shoot the square with a high-accuracy gun. Don't stand there holding the square when they are shooting... - Robert Israel in sci.math, Re: Scaling
Re: Pipeline Performance
On Sat, 18 Sep 2004, Luke Palmer wrote: Example above becomes: sub MediansBy5 ([EMAIL PROTECTED]) { while @list.length = 5 { emit (sort @list.splice(0,5))[2]; }} That's actually a very good idea. That's why Perl 6 has it :-) sub MediansBy5 ([EMAIL PROTECTED]) { gather { while @list = 5 { # there's no .length; it's .elems take (sort @list.splice(0,5))[2]; } } Cgather returns a list of everything that was Ctaken inside of it. It does this by building a coroutine out of its argument, so it works lazily. I suppose that this construct may be used in a wider range of circumstance and will allow some other extra features too (Cuntake?), OTOH the simplicity ogf Cemit was indeed striking. The cmt about its short length in comparison with Creturn's one is worth taking into account though... Michele -- l'Italia e' una penisola bagnata da tre mari e prosciugata da tremonti - chronos12 su it.hobby.umorismo
Re: Pipeline Performance
On Sat, 18 Sep 2004, Rod Adams wrote: 2. Should a subsequent implicit return behave differently than usual if some values have already been emitted? It seems clear to me that behind the scenes there should be a stack into which Cemitted stuff is pushed and that this is returned upon either explicit or implicit Creturn at the end of the sub. Now a possible issue, and maybe a more subtle one is that some care should be used when one doesn't want to return anything but what has been Cemitted: and explicit Creturn with no arguments should be needed in that case, wouldn't it? Michele -- No one can ever predict all of the possible error conditions, of course; as soon as we write idiot-proof code, along comes a better idiot. But it's still worth making the attempt. - Sherm Pendley in clpmisc (edited)
S5 and overlap
# With the new :ov (:overlap) modifier, the current rule will match at all possible character positions (including overlapping) and return all matches in a list context, or a disjunction of matches in a scalar context. The first match at any position is returned. $str = abracadabra; @substrings = $str ~~ m:overlap/ a (.*) a /; # bracadabr cadabr dabr br Maybe I'm wrong here, but I'd get $str = abracadabra; bracadabr cadabr dabr br (so far identical), but then I'd also expect bracad cad d brac c br which gets me to the question, if there'll be some elements multiple times in the array (they should), and in which order they appear (first match to (nth .. 1st) match, 2nd to (nth .. 2nd)) and so on ... BTW: will $str = abracadabra; @substrings = $str ~~ m:overlap/ a (.*) (b|d) /; get some empty strings as well (I believe it should)? Regards, Phil
Re: S5 and overlap
# With the new :ov (:overlap) modifier, the current rule will match at all possible character positions (including overlapping) and return all matches in a list context, or a disjunction of matches in a scalar context. The first match at any position is returned. $str = abracadabra; @substrings = $str ~~ m:overlap/ a (.*) a /; # bracadabr cadabr dabr br Maybe I'm wrong here, but I'd get Just found the answer, sorry. But that gets me to the next question, ie I don't understand the difference between exhaustive and overlap. Is it that overlap fixes the first point of the pattern match and does further scanning for all possibilities, and exhaustive then *after* this processing searches for another first point? Regards, Phil
Re: running Devel::Cover in mod_perl (1.3)
Hi, On Mon, 20 Sep 2004, Kevin Scaldeferri wrote: The current version of Devel::Cover asserts that running it on a mod_perl server ought to be as simple as adding 'use Devel::Cover' to your startup script. However, when I do this, I get the following failure: Syntax error on line 1225 of /home/kevin/.../conf/httpd.conf: Can't use an undefined value as a HASH reference at /home/kevin/lib/perl5/site_perl/5.8.0/i686-linux-64int/Devel/Cover.pm line 310. BEGIN failed--compilation aborted at /home/kevin/.../conf/startup.pl line 7. Any help would be appreciated. I use the patch listed below. It fixes this bug and also sets permission 0777 to a cover_db directory as it is created when apache runs as root, so when it changes it's UID it can write to this directory. P.S. And don't forget to use -X switch when starting httpd. Vadim. diff -ur Devel-Cover-0.47.orig/lib/Devel/Cover.pm Devel-Cover-0.47/lib/Devel/Cover.pm --- Devel-Cover-0.47.orig/lib/Devel/Cover.pm2004-08-27 17:08:09.0 +0400 +++ Devel-Cover-0.47/lib/Devel/Cover.pm 2004-09-21 13:52:12.0 +0400 @@ -30,6 +30,7 @@ # use Carp; $SIG{__DIE__} = \Carp::confess; my $Initialised; # import() has been called. +my $Checked = 0; my $Dir; # Directory in which coverage will be # collected. @@ -170,6 +171,7 @@ sub import { +return if $Checked++; my $class = shift; my @o = (@_, split ,, $ENV{DEVEL_COVER_OPTIONS} || ); @@ -211,7 +213,10 @@ $Dir = $1 if Cwd::getcwd() =~ /(.*)/; } -mkdir $DB unless -d $DB; # Nasty hack to keep 5.6.1 happy. +unless(-d $DB){ # Nasty hack to keep 5.6.1 happy. +mkdir $DB; +chmod 0777, $DB; +} $DB = $1 if Cwd::abs_path($DB) =~ /(.*)/; Devel::Cover::DB-delete($DB) unless $Merge; @@ -240,6 +245,7 @@ if ($ENV{MOD_PERL}) { +eval 'BEGIN{1}'; check(); set_first_init_and_end(); }
Re: S5 updated
On Tue, 2004-09-21 at 02:52 -0600, Luke Palmer wrote: If you replace the first line: method Rule::Group::generate(Int $n) { With multi generate (Rule::Group $group: Int $n) { Everything ought still to work. I think the best you can do is to implement it as a routine. You can't really make it a modifier, because it's pretty separate from actually matching anything. Minor nitpick, you can do away with the integer parameter - to me it makes more sense to just lazily spew an infinite list of generated matches. Then you'd do @results = generate(/a*/) [0..999]; to get 1000 results, but you can also do @results = generate(/a*/); while !$hell.frozen() { shift @results; } Miro
attributes/methods on sigils?
I fear, and with good reasons, that this may be too wild a case of an extremization, but I wonder wether, just like for example strings are implemented by means of special (quote-like) operators, sigils, instead of being syntactical creatures could be (sort of special) operators themselved and thus allow attributes/methods or even adverbs... Michele -- The reason I want to do this is that I am drawing up legal documents, and sometimes when I send out to a client I want to have a footnote to explain some point of godawful convoluted legal prose (why don't I just write it clearly in the first place??! Different topic) - DrMemory in comp.text.tex, Re: Footnotes: turning them on/off
Re: [perl #31647] Segfault when calling dynamically compiled code from dynamically compiled code
Matt Diephouse [EMAIL PROTECTED] wrote: The following PIR segfaults. However, if you switch the order and call builtin before dynamic, it runs smoothly. Ah, yep. The switching to the new bytecode segment happened twice, with messed up returning properly. Thanks, fixed. leo
misc remarks WRT YAPC::EU
First I'd like to thank all who donated to TPF: a shiny new 12 Powerbook G4 ran the presentation in Belfast. Thanks to Allison bringing it with her and to TPF. The speed comparison of b2.py was done with an unoptimized Parrot build. Turning on --optimize gives 0.35s vs 0.6s (Parrot vs Python) on that Powerbook. A first patch enabling the pipe open on OS X is already in CVS. Bernd the vaxman will have a look at Parrots VMS port. A french teacher is using Parrot for teaching assembly language. A guy from India (whos name I didn't get) is gonna doing his master thesis on implementing Java on Parrot. Thanks to all organizers of the conference, leo
[perl #31657] [TODO] Convert IMCC/Bugs to RT Tickets
# New Ticket Created by Will Coleda # Please include the string: [perl #31657] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31657
Re: S5 and overlap
On Tue, Sep 21, 2004 at 12:37:09PM +0200, Ph. Marek wrote: But that gets me to the next question, ie I don't understand the difference between exhaustive and overlap. Is it that overlap fixes the first point of the pattern match and does further scanning for all possibilities, and exhaustive then *after* this processing searches for another first point? :overlap gives you all of the matches as if you'd anchored the pattern at the first character, then the second, then the third, and so on until there are no more characters. So, for abbabbabba ~~ m:ov/a.*a/ It'll match abbabbabba at the first position, then fail on the two b characters, and succeed on the next a giving you abbabba, etc. :exhaustive is the same but you get in between greediness results too. For instance, abbabbabba ~~ m:ex/a.*a/ when matched starting at the first character will give you abbabbabba because of the greediness of *. But there are also abba and abbabba that match along the way. So ... here's a little table comparing the two (ignoring the positions where there is no match). Maybe it'll help. Assuming $_ contains abbabbabba, we have Positionm:ov/a.*a/ m:ex/a.*a/ 0 abbabbabba abbabbabba abbabba abba 3 abbabba abbabba abba 6 abbaabba You'll note that :exhaustive matches the string abba at different locations. One thing S5 didn't mention was how to know at which position each substring matched. I'm sure that's filed away in the magic $0 object though. Hopefully, I'm being clear. -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
Re: Still about subroutines...
On Tue, Sep 21, 2004 at 11:45:55AM +0200, Michele Dondi wrote: : at first I didn't get what you mean, but now I must admit it does make : sense and looks smart too. I can be very persuasive when I'm right, as well as the rest of the time. :-) Larry
Re: attributes/methods on sigils?
On Tue, Sep 21, 2004 at 01:49:07PM +0200, Michele Dondi wrote: : I fear, and with good reasons, that this may be too wild a case of an : extremization, but I wonder wether, just like for example strings are : implemented by means of special (quote-like) operators, sigils, instead of : being syntactical creatures could be (sort of special) operators : themselved and thus allow attributes/methods or even adverbs... We can do better than that--let's just define every Unicode character to be an object with various roles and attributes, and the roles of each character tell how to parse it in any context and what it means in that role. Then we add all these object characters to Intercal, and we're done. Larry
[perl #31634] [BUG] -G masking parrot failure from TCL
Dan's recent patch to io/io_buf.c seems to have resolved this particular issue. Thanks, Dan! [coke - Sun Sep 19 00:48:26 2004]: Just committed some patches to languages/tcl to make it start passing all tests again. However, one of my patches was to force the tests to /always/ run with -G. I was seeing several failures which go away when I disable GC. For example, after building tcl, if you (in the root directory), do: % cat foo.tcl set a 20 while {$a} { incr a -1 if {$a 10} { break } } puts $a % ./parrot languages/tcl/tcl.pbc foo.tcl can't read : no such variable% ./parrot -G languages/tcl/tcl.pbc foo.tcl 9 So, something's borked in garbage collection again. I'm on OS X 10.3.5, if that matters.
Re: attributes/methods on sigils?
Now you're underusing smileys. I hope. On Tue, 21 Sep 2004 12:04:01 -0700, Larry Wall [EMAIL PROTECTED] wrote: On Tue, Sep 21, 2004 at 01:49:07PM +0200, Michele Dondi wrote: : I fear, and with good reasons, that this may be too wild a case of an : extremization, but I wonder wether, just like for example strings are : implemented by means of special (quote-like) operators, sigils, instead of : being syntactical creatures could be (sort of special) operators : themselved and thus allow attributes/methods or even adverbs... We can do better than that--let's just define every Unicode character to be an object with various roles and attributes, and the roles of each character tell how to parse it in any context and what it means in that role. Then we add all these object characters to Intercal, and we're done. Larry -- Schwäche zeigen heißt verlieren; härte heißt regieren. - Glas und Tränen, Megaherz
Re: misc remarks WRT YAPC::EU
On Tue 21 Sep 2004 15:43, Leopold Toetsch [EMAIL PROTECTED] wrote: First I'd like to thank all who donated to TPF: a shiny new 12 Powerbook G4 ran the presentation in Belfast. Thanks to Allison bringing it with her and to TPF. The speed comparison of b2.py was done with an unoptimized Parrot build. Turning on --optimize gives 0.35s vs 0.6s (Parrot vs Python) on that Powerbook. A first patch enabling the pipe open on OS X is already in CVS. Bernd the vaxman will have a look at Parrots VMS port. And he has a brand new Itanium OpenVMS machine which the perl community can use for testing. Parrot and Perl5 smokes. A french teacher is using Parrot for teaching assembly language. A guy from India (whos name I didn't get) is gonna doing his master thesis on implementing Java on Parrot. Nice addition: this guy doesn't like java at all :) Thanks to all organizers of the conference, leo -- H.Merijn BrandAmsterdam Perl Mongers (http://amsterdam.pm.org/) using perl-5.6.1, 5.8.3, 5.9.x, and 809 on HP-UX 10.20 11.00, 11i, AIX 4.3, SuSE 9.0, and Win2k. http://www.cmve.net/~merijn/ http://archives.develooper.com/[EMAIL PROTECTED]/ [EMAIL PROTECTED] send smoke reports to: [EMAIL PROTECTED], QA: http://qa.perl.org
Re: running Devel::Cover in mod_perl (1.3)
On Sep 21, 2004, at 2:58 AM, [EMAIL PROTECTED] wrote: On Mon, 20 Sep 2004, Kevin Scaldeferri wrote: The current version of Devel::Cover asserts that running it on a mod_perl server ought to be as simple as adding 'use Devel::Cover' to your startup script. However, when I do this, I get the following failure: ... I use the patch listed below. It fixes this bug and also sets permission 0777 to a cover_db directory as it is created when apache runs as root, so when it changes it's UID it can write to this directory. P.S. And don't forget to use -X switch when starting httpd. Hi Vadim, This patch gets rid of that error, and now my server starts up. I admit that I don't really understand its magic (eval 'BEGIN{1}'???), but it's progress. Now, I can get my server to start and it more-or-less seems to work if I send a couple queries through. That is, if I run 'cover' right after starting, it shows some coverage that seems to reasonably correspond to my startup script. And, after querying it and killing httpd, I get some coverage increase that seems right. However, I seem to be having problems with stability when I run lots of tests (a couple thousand). After I do this, something seems unhappy in the internals, and when I try to kill apache, I get a bunch of this sort of stuff: - Call Stack Trace - Cannot open /proc/16071/exe. calling call entryargument values in hex location type point(? means dubious value) Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. Cannot find symbol in /proc/16071/exe. 41261E1B CALL 410E2CF0 BFFF269C ? 41261DDD ? 41906F4C ? 418D8440 ? 4E455645 ? 31325F54 ? 4163B5BA CALLr BDAAC4C ? BDAAC4C ? BFFF2B24 ? 4000D4E0 ? 4149B41C CALL 410CB940 4149B280 ? 0 ? 0 ? 0 ? 41372C16 CALLr BDBB56C ? 4148CEAD ? 41906F4C ? BDB995C ? 411C6D9E CALLr BDBB56C ? BFFF2BBC ? 41906F4C ? 0 ? 9 ? 0 ? ... many hundreds of lines ... and if I run 'cover', none of the coverage from my tests appears. So, I don't expect anyone to try to figure out this stack trace stuff, but I'm curious if other people have seen stability problems like this? Alternatively, if someone can tell me the exact logistics of how they get the coverage out in the end, I'd appreciate it. Is there another way than 'kill'ing the apache process to get Devel::Cover to write its data? It seems to do it at one point during startup, but after that it looks like it just stays in memory, which I end up losing when things go bad terminating the process. Thanks, Kevin
[perl #31659] [PATCH] Parrot m4 0.0.8
# New Ticket Created by Bernhard Schmalhofer # Please include the string: [perl #31659] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31659 Hi, this revision of Parrot m4 has no new features. Sorry, it isn't ready for 'autoconf' yet :;). I fiddled a little bit with the harness script. Mostly I played with the 'eval' command, which is actually a compiler implemented in C. The generated bytecode should now be more conformant to the Parrot calling conventions. The problems with the 'eval' tests were propable due to a missing 'end' in the generated bytecode. CU, Bernhard -- /* [EMAIL PROTECTED] */ +++ GMX DSL Premiumtarife 3 Monate gratis* + WLAN-Router 0,- EUR* +++ Clevere DSL-Nutzer wechseln jetzt zu GMX: http://www.gmx.net/de/go/dsl Parrot_m4-0.0.8.patch Description: Binary data
A..Z alternatives
Larry Wall wrote: Somebody needs to talk me out of using A..Z for the simple cases. Larry The Turing programming language uses splat to stand in for the length of the array, so in Turing *a[*-1]* means what Perl 5 programmers mean when they say *$a[-1]*. However, splat is already quite heavily loaded in Perl 6. So I got to thinking of Ada's empty box operator, **. Maybe it would be a good stand-in for the temporary it that represents a dimension's length. So [EMAIL PROTECTED]-3..-1]* could be the syntax to grab the last 3 three elements of [EMAIL PROTECTED] That might confuse users of languages that were not C-syntax-influenced, who think that '**' means not equal. But surely old Modula hacks like me are in a minority in the Perl world (and Pascal programmers would never do Perl, would they? Algol, anybody?) So maybe I'm the only one who runs the risk of that particular confusion. :-) 'Course, I don't pretend to understand all the possible existing meanings that '**' and '**' already have in Perl 6, either. =thom Q. How many Malkieri does it take to screw in a light bulb? A. Well, it better not be more than one.
Re: Synopsis 9 draft 1
John Macdonald [EMAIL PROTECTED] writes: If a int1 (or int2 or nybble or other sub-addressable sized value) is being referred to, a similar issue arises since most machines these days have byte addressing, but do not have bit addressing. If you can't refer directly to it, the value will have to be extracted and re-inserted to provide is rw access. I surely must be misunderstanding what you're saying... the way I read that, you're suggesting that it will matter to Perl -- not only to the compiler but even to user code -- how the underlying hardware addresses its memory. I really hope that's not the case. I thought Parrot would take care of all that fiddly platform-dependent stuff so that Perl doesn't have to know or care about it. Perl6 code shouldn't have to even *know* whether it's running on a big or little (or middle) endian system, how many bits wide the BUS is, how many bits are in an integer, whether there's a math coprocessor, whether the instruction set is RISC or CISC, how many CPUs there are, what kind of filesystem the underlying OS has, or whether the underlying GUI is Win32 or Aqua or GTK or Qt. Perl6 code shouldn't have to know that stuff *even* to call libraries written in another language; even the compiler shouldn't have to know about it. Parrot should have a wrapper API thingydo that makes it Just Work. That's the point of having a VM, or such was my understanding. I don't think I'm dreaming the impossible here, because Inform seems to manage this stuff just fine, with either of the VMs it compiles to (except for the parts about calling libraries written in other languages, and having a GUI; Inform doesn't support those things). You can write the code and compile it on a DOS system, stick the binary on an ftp server, and J. Random Nerd can download it, and assuming he has the appropriate version of the VM for his system, it will run your code -- whether his system is SPARC/Solaris or Nintendo Gameboy, your code will never know the difference; as far as your code is concerned, it's running on the z-machine. Parrot should be like that (except that Parrot's minimum requirements for the underlying system will have to be a little higher, because we want to support things like disk I/O and allocating more RAM after the program starts running). So if the underlying hardware doesn't know how to write a single byte, then Parrot should have workaround code for that. Perl shouldn't even need to know about it. -- $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b-()}} split//,[EMAIL PROTECTED]/ --;$\=$ ;- ();print$/
Re: Synopsis 9 draft 1
--- Jonadab the Unsightly One [EMAIL PROTECTED] wrote: I surely must be misunderstanding what you're saying... the way I read that, you're suggesting that it will matter to Perl -- not only to the compiler but even to user code -- how the underlying hardware addresses its memory. I really hope that's not the case. Perhaps I'm misunderstanding things, but I thought that Perl6 should be able to *optionally* allow such things if platform specific fine-grained code tuning is necessary. Most of the time it shouldn't be, but if it's required that .01% of the time why force someone to reach for another language, regardless of how easy the languages are to integrate? Cheers, Ovid = Silence is Evilhttp://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/
Re: Synopsis 9 draft 1
Aaron Sherman [EMAIL PROTECTED] writes: It took us some time discussing this... we weren't sure what tense you were using. At first we thought it might be the past subjective, but after a while, we decided to coin a new tense: the vapor tense. ;-) Actually, it's not new at all; there's already a quite established terminology for that tense. It's called the prophetic past. HTH.HAND. -- $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b-()}} split//,[EMAIL PROTECTED]/ --;$\=$ ;- ();print$/
Re: Synopsis 9 draft 1
Larry Wall [EMAIL PROTECTED] writes: int1, int2, int4, int8, int16, int32, int64, uint1, uint2, uint4, uint8, uint16, uint32, uint64, num32, num64, num128, complex32, complex64, complex128, ... Well, all that is harmless enough, as long as I don't ever have the misfortune to inherit maintenance of any code that *uses* those lowlevel types. We are also getting a holds whatever size number you put in it, up to the limits of available system resources type, right? Good. say @x = @x[]; # prints @x = 1 2 3 Nice. Until now I wasn't sure I liked the new interpolation rules, but this looks good. -- $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b-()}} split//,[EMAIL PROTECTED]/ --;$\=$ ;- ();print$/
Re: S5 updated
Edward Peschko writes: Ok, fair enough.. although I'm not sure that I'm all that sure I'm completely happy-with/understand the syntax described in that article. It works for the trivial cases, but what about complex grammars? It works for anything. It gets pretty inefficient in the case of code assertions, but there's no way around that. Testing your assertions isn't going to be the useful thing about this, anyway. I just defined for Rule::Group, which was a simple concatenation of elements. The others follow from that. At the end of this message I've rewritten Group and written a few more just to show how it's done. I've annotated them, too, so maybe someone will be able to understand it. The reason for the modifier (or even a new operator (g/ for example) is that you can easily test your regular expressions. The interface is trivial - all you have to do is switch your m/ out for g/, and sit back and see how your patterns translate into strings. Yeah, that looks pretty easy. Until you see what that looks like in a program. What does it mean to change an m// to a g//? if $str ~~ m/foo bar/ {...} Changes to: say for g/foo bar/; Which isn't all that different from: say for generate(/foo bar/); Eyeballing and fixing the regular expression then becomes trivial (or relatively trivial). I definitely see the use. If you need to match the regex engine in reverse, in a totally unattached way via subroutine, then I would think the chance for subtle mistakes and errors would be exceedingly great. I don't understand how. Or, I could be missing something. How would you generalize multi generate Rule::Group $group: Int $n) .. to work with (( nonquote | slashchar )* ) as input? I'll show you. Here are some of the generators. This is very dense, functional code. Read at your own risk (but I'm certainly not writing it to be executed!). use Permutations compositions outer; # compositions($length, $n) gives all lists of length $n whose # elements sum to $length. # outer(@ary1, @ary2, ...) gives the cartesian product of its # arguments. That is, outer([1,2], [3,4]) gives ([1,3], [1,4], # [2,3], [2,4]); Also note that outer([1,2], [], [3,4]) gives # simply ([]). # Generate all strings of length $length that $group matches. multi generate(Rule::Group $group: Int $length) { # For each assignent of lengths to each of $groups children # such that they sum to $length... compositions($length, +$group.children) == map - @comp { @comp $group.children == map - $n, $pat { # Generate every string of length $n that the subpattern # matches [ $pat.generate($n) ] } == # Join our results together outer == join '' } } # Generate all strings of length $length that $const matches. multi generate(Rule::Constant $const: Int $length) { # This is nice and easy if $length == $const.chars { $const } else { () } } # Generate all strings that any of the subpatterns match. multi generate(Rule::Alternation $alt: Int $length) { $alt.children == map - $child { $child.generate($length) } } Etc. There would need to be some context added so that captures could be made to work, but it wouldn't be that hard. It would stop being so elegant, but it wouldn't be hard. And then to generate all possibilities of your regular expression: (( nonquote | slashchar )* ) You just pass it to generate. It recursively calls itself until it's down to constant strings, which are always a well-defined match (or character classes, which are tricky and computationally intractible in the presence of unicode). I love programming in theoretical Perl 6. Luke
Re: [perl #31652] [TODO] Win32 - Microsoft Visual C++ Toolkit 2003
Thanks! I just cut and pasted this from TODO.win32 - you might want to ping the list, as I have no idea who requested the original item. =-) Jonathan Worthington via RT wrote: [coke - Mon Sep 20 18:35:04 2004]: Provide setup and build instructions for Microsoft Visual C++ Toolkit 2003 (http://msdn.microsoft.com/visualc/vctoolkit2003). It's somewhat hard to test this out without finding a box that is missing Visual Studio, which exludes any of mine. Looking at what is included in the toolkit, I expect that you'd also need nmake (which is already discussed in README.win32) and probably the Windows Platform SDK. With those, the build process should be the same as it would if you had MS Visual Studio. I'll try and test this out for real at some point soon, but I fear that point may not be all that soon. :-) For now, I've attached a patch to README.win32 that does some general updates, including addressing building with the Visual C++ Toolkit 2003 to the best of my knowledge. Hope this helps, Jonathan
[perl #31662] [RFE] Allow PIR to declare/init .locals in one line
# New Ticket Created by Will Coleda # Please include the string: [perl #31662] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31662 It would be nice if we had some syntactic sugar in PIR, such that: .sub main @MAIN .local int foo = 1 print foo end .end Were treated like: .sub main @MAIN .local int foo foo = 1 print foo end .end ... for any type of intializer code... .local pmc undef = new PerlUndef .local int math = 2 + 2 .local string concat = $S0 . whee!\n
Re: S5 updated
Luke Palmer wrote: Edward Peschko writes: Ok, fair enough.. although I'm not sure that I'm all that sure I'm completely happy-with/understand the syntax described in that article. It works for the trivial cases, but what about complex grammars? It works for anything. It gets pretty inefficient in the case of code assertions, but there's no way around that. Testing your assertions isn't going to be the useful thing about this, anyway. Eyeballing and fixing the regular expression then becomes trivial (or relatively trivial). I definitely see the use. You just pass it to generate. It recursively calls itself until it's down to constant strings, which are always a well-defined match (or character classes, which are tricky and computationally intractible in the presence of unicode). I love programming in theoretical Perl 6. Luke Now this is truly useful. Especially when one realizes that all of Perl 6 is already expressed in these handy regular expressions. It's therefore possible to generate all possible Perl 6 programs, then simply see which one(s) satisfy your test cases, and there's no need to do any silly programming ever again! And just think... All the p6c group has to do is a little prep work, and P6 will then write itself! Just think of the marketing ploy: Other languages were written _in_ themselves. Perl was written _by_ itself. This solution definitely has Laziness and Hubris going for it, though I suspect it may be lacking in the Impatience department. (I need more sleep) -- Rod Adams
Re: A..Z alternatives
On Tuesday 21 September 2004 07:18 pm, Thomas A. Boyer wrote: Larry Wall wrote: Somebody needs to talk me out of using A..Z for the simple cases. Larry [ for array dimension placeholder ] That might confuse users of languages that were not C-syntax-influenced, who think that '**' means not equal. But surely old Modula hacks like me are in a minority in the Perl world (and Pascal programmers would never do Perl, would they? Algol, anybody?) So maybe I'm the only one who runs the risk of that particular confusion. :-) What about BASIC? Aren't all the little kids today raised on BASIC? :) --Andrew
[perl #31665] [BUG] incorrect line number reported during compilation
# New Ticket Created by Will Coleda # Please include the string: [perl #31665] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=31665 I just spent an hour or so chasing my tail trying to figure out where an error in my code was. (Turned out I had put a letter before a # in a file.) This shows the same mis-reporting of the error: oolong:~/research/parrot coke$ cat a.imc .sub leo @MAIN load_bytecode b.imc end .end oolong:~/research/parrot coke$ cat b.imc .include c.imc oolong:~/research/parrot coke$ cat c.imc Eek oolong:~/research/parrot coke$ ./parrot a.imc error:imcc:parse error, unexpected IDENTIFIER in file 'b.imc' line 1 I would EXPECT this to show the error in c.imc instead of b.imc. ... Eeek. I just trying to run ./parrot b.imc, to show the error I expect to get about c.imc... but I get the same error. the error is being reported at the .include instead of the actual error.