Re: backticks
hash slices aren't used much at all. People *always* overgeneralize.
Re: Larry's State of the Onion slides
On Mon, May 13, 2002 at 05:48:17PM -0700, Ask Bjoern Hansen wrote: On Wed, 8 May 2002, Nathan Torkington wrote: Larry's State of the Onion slides from TPC5 are now available from http://dev.perl.org/perl6/talks/ http://dev.perl.org/perl6/talks/onion5.pdf Better sooner than never, I guess ;-) - ask Damian sent them to me in PPT form in January, and only now I converted them to PDF. Ask, could you put those onto the dev.perl.org site and announce to perl6-language? Thanks, -- ask bjoern hansen, http://ask.netcetera.dk/ http://askbjoernhansen.com !try; do(); -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Between-Opcode Callbacks
On Tue, Jul 10, 2001 at 09:45:19PM +0200, Paul Johnson wrote: On Mon, Jul 09, 2001 at 11:46:30PM -0500, Jarkko Hietaniemi wrote: comment language=en encoding=iso-8859-1 sentence subjectXML/subject verbis/verb adverbmuch/adverb adverbtoo/adverb objectverbose/adverb And it should be neither written nor read by people ;-) Thank you, at least someone got my point... XML is a nice data interchange format, no more, no less. punctuation./punctuation /sentence /comment -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Between-Opcode Callbacks
do s%([A-Z]+)([BE])%${\(($2 eq 'E')?'/':'')}$1%g on that and you've almost got XML! comment language=en encoding=iso-8859-1 sentence subjectXML/subject verbis/verb adverbmuch/adverb adverbtoo/adverb objectverbose/adverb punctuation./punctuation /sentence /comment -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Anyone actually experienced with object inheritance?
On Mon, Jul 02, 2001 at 01:30:11PM -0700, Damien Neil wrote: On Mon, Jul 02, 2001 at 12:59:51PM -0700, David Whipp wrote: Its not quite the same thing, but Java does have the concept of anonymous classes (it names them 'inner' classes): Is Perl6 going to have a similar concept? Inner classes and anonymous classes are actually different in Java. (Anonymous classes are always inner classes; inner classes are not always anonymous.) An inner class is a class contained within a class; only the containing class may use the contained class. An I forget... has the possibility/utility of having nested namespaces been discussed? anonymous inner class is an unnamed instantiation of an interface; these are often used in places where Perl coders would use a closure. (Java doesn't have closures.) Both inner classes and anonymous inner classes exist for reasons fairly specific to Java; they're very useful in a certain context, but Perl has other ways to accomplish the same things. - Damien -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: ~ for concat / negation (Re: The Perl 6 Emulator)
On Thu, Jun 21, 2001 at 11:49:21PM +0100, Simon Cozens wrote: On Thu, Jun 21, 2001 at 10:31:22PM +0100, Graham Barr wrote: We can have a huge thread, just like before, but until we see any kind of update from Larry as to if he has changed his mind it is all a bit pointless. For what it's worth, I like it. Does anyone else see a problem with =~ ? Does anyone else see a problem with $negated=~$scalar; ? :) ...and for three points, guess what $foo=~0 does in Perl 5? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: 'is' and action at a distance
On Fri, May 18, 2001 at 06:22:10AM -0700, Austin Hastings wrote: --- Damian Conway [EMAIL PROTECTED] wrote: It's probably just a matter of coding what you actually mean. In Perl 5 and 6 your version means if $fh is true in *any* possible way..., whereas you seem to want if $fh is defined, which is: Hmm. I can easily see this producing incomprehensible code when spread across large systems. To wit, those developers used to 0 means false Any feature is incomprehensible if one is not used to it. Pointers in C are incomprehensible if one has never met the concept before. As far as I understand one rationale behind the false (in Perl 5 terms) but true (in Perl 6 terms) is that you can write code like this if ($retval = func(@args)) { # it worked ... } else { # it didn't ... # but we still can dig out more information # about the result ... print $retval.what_went_wrong, \n; } semantics seeings a scalar that they just know has a 0 in it and wondering why the branch isn't doing what they know it should. Free your mind-- detach the truth of a scalar from its '0 or or undef' nature. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Properties and 0 but true.
The statement I read was true in any possible way, which implies that if $retval had a true property, the result of func would be irrelevant, since if func gave 0, any possible way would see the $retval is true property and take the it worked route. Thus, this code: my $retval is true; if ($retval = func(@args)) { # it worked... } else { # nope... print $retval.what_went_wrong, \n; } Yes... if you are using only the true property. But assume func() can attach either true or false to its return value (and in the latter case, also the what_went_wrong property to indicate the cause, $retval.what_went_wrong(Gorkulator borked.).) I don't mind the presence of these potentially horribly confusing thingys. After all, thanks to this list I'll be on the right side of the learning curve. However, I don't think that Poo, poo. is the correct answer to How about maintainability? on anybody's multiple choice exam. I understand your worry but if you are concerned about more features equals less maintainability you have obviously chosen the wrong language, be it Perl 5 or Perl 6. No, I'm rather serious. Perl has been, is, will be, a pragmatic language that borrows with gusto, and as a result it has a horde of features. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Separate as keyword? (Re: 'is' and action at a distance)
Maybe I missed it... but what is the relationship of (Perl 5) attributes and Perl 6 properties? my $answer : constant = 42; my $answer is constant = 42; my sub ... dang, no lexical subs, but can we please have them in Perl6? :-) sub terfuge : locked { ... } sub terfuge is locked { ... } -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: what I meant about hungarian notation
On Thu, May 10, 2001 at 12:43:13PM -0500, David L. Nicol wrote: John Porter wrote: Larry Wall wrote: : do you think conflating @ and % would be a perl6 design win? Nope, I still think most ordinary people want different operators for strings than for numbers. Different operators, conflated data type. That's what we have for scalars already. Makes sense to have it for containers indexed by scalar as well. add an explicit accuracy limit @container : accuracy 0.01; and you've got a language where $container[2/3] is guaranteed to access the same slot as $container[.6668] Now that's what I call going up to eleven! Suddenly, I feel like going back to C... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: So, we need a code name...
On Sun, May 06, 2001 at 01:31:17AM -0600, Dan Brian wrote: For your collective amuse() abuse() dismiss() I humbly submit: duran (or derivatives) Aside from conjuring images of reflex, rio, and maybe Barbarella for a select few, the word occurs in some interesting contexts. It means little aside from it being a last name, a city name, and bearing resemblence to some neat stuff. One bummer is the likeness to AMD's Duron. *shrug* durian. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: So, we need a code name...
On Sun, May 06, 2001 at 11:51:27AM -0700, Peter Scott wrote: At 08:33 AM 5/6/01 -0500, Jarkko Hietaniemi wrote: On Sun, May 06, 2001 at 01:31:17AM -0600, Dan Brian wrote: For your collective amuse() abuse() dismiss() I humbly submit: duran (or derivatives) Aside from conjuring images of reflex, rio, and maybe Barbarella for a select few, the word occurs in some interesting contexts. It means little aside from it being a last name, a city name, and bearing resemblence to some neat stuff. One bummer is the likeness to AMD's Duron. *shrug* durian. You want to name it after a fruit smelling of dead cows and sewer gas? Oy! *I* didn't suggest the Duran name :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Apoc2 - STDIN concerns
On Sun, May 06, 2001 at 10:10:24PM +0200, Bart Lateur wrote: On Sat, 5 May 2001 15:22:40 -0700, Nathan Wiger wrote: I suggest that we simply create another q-op to do the qw-ish things you're proposing. Perhaps qi() for interpolate or something else. qqw Why I'm reminded of car, cdr, cadr, cdar, cddar, cadar, ... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: sandboxing
Memory limits we should be able to do, assuming Perl 6 continues to have its own malloc. Well... Perl doesn't use it's own malloc *that* widely. E.g. Linux doesn't, since at least 5.005_03. FreeBSD doesn't. OpenBSD doesn't. Darwin doesn't. AIX doesn't. IRIX doesn't. Starting from 5.8.0 Solaris won't (at the behest of Alan Burlison and few others). The reason? Usually it has been the system malloc being (a) faster (I think the BSDs) (b) more robust under multithreading (IRIX). Also starting from 5.8.0 Tru64 or any other naturally 64bitall plaform won't (since the Perl malloc is not 64bitall-clean). CPU usage is a problem... we could provide two similar, but easier to implement, features. Throttling (by sticking a tiny little sleep between each opcode) and limited running (ie. kill yourself if you run longer than X seconds). The latter we might be able to pull of externally using SIGALRM, but not all systems have that. Or setrlimit() for the systems that have that. Also things like limiting the number of open filehandles and sockets and limiting network usage could be done inside perl. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: apo 2
On Fri, May 04, 2001 at 09:47:18AM -0600, Nathan Torkington wrote: Michael G Schwern writes: $foo has true doesn't flow as well as $foo is true. Dunno quite what the other expected uses are. $foo has truth; # :-) This leads naturally to: $foo has the_buddha_nature; $foo has ten_days_to_live; $foo has meddled_in_my_affairs_one_too_many_times! # ! as assertion $elvis has left(the building); $foo has no future; $we have fun_fun_fun; $we are hopeless; Okay, time to start working... Nat -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Please make last work in grep
On Wed, May 02, 2001 at 05:36:11PM +0100, Graham Barr wrote: On Wed, May 02, 2001 at 06:29:51PM +0200, Bart Lateur wrote: On Wed, 2 May 2001 17:05:31 +0100, Graham Barr wrote: wantarray-ness is already passed along the call stack today. Thats the whole point of it. So what is the difference in passing a number instead of a boolean ? Because you might have a wantarray situation that expects no values? () = whateveryouwant(); I am sure that situation is handled by the 'want' RFC. I have not read it recently, but I suspect in this case want('LIST') would return that magical 0 but true or something similar. Hopefully the something similar, I hope in Perl 6 we will able to bury the 0 but true workaround to the backyard on a moonless night :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: .NET
On Wed, May 02, 2001 at 05:22:26PM -0400, David Grove wrote: am seeing some similarities between some of the proposed goals of Perl 6 and the .NET platform. . . . many things in .NET have been discussed similarly here. That's because .NET attempts to address real-world issues. The goals of .NET are not evil in and of themselves, you know. Depends on whether you believe MS marketing. Once you dig through all the manure, you end up with some pretty basic concepts -- a new COM, the realization that C++ cause problems with mixed languages, and Microsoft's desperation to do something remotely interesting for a change (still waiting for something original for a change). You are saying that the Clippy wasn't originally and truly annoying? :-) Don't Let Architecture Astronauts Scare You http://joel.editthispage.com/stories/storyReader$320 -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Flexible parsing (was Tying Overloading)
On Thu, Apr 26, 2001 at 04:13:30PM -0700, Larry Wall wrote: Eric Roode writes: : John Porter wrote: : IIUC, this ability is precisely what Larry was saying Perl6 would have. : : I may have my history wrong here, but didn't Ada try that? Not at all. The syntax of Ada was nailed down tighter that almost any language that ever existed. In a sick way I kinda liked how compilers were able to give out error messages not unlike: foo.ada: line 231: Violation of sections 7.8.3, 9.11.5b and 10.0.16: see the LRM. (LRM being the Language Reference Manual.) Truly coding by the book. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Flexible parsing (was Tying Overloading)
On Fri, Apr 27, 2001 at 02:28:58AM +0100, Simon Cozens wrote: On Thu, Apr 26, 2001 at 06:25:03PM -0500, Jarkko Hietaniemi wrote: In a sick way I kinda liked how compilers were able to give out error messages not unlike: foo.ada: line 231: Violation of sections 7.8.3, 9.11.5b and 10.0.16: see the LRM. Ever used the Mac C compiler? Yes...? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
how about just juxtaposing? (Re: Sane + string concat proposal)
I think the magical + isn't going to work. Has the road of just putting things next to each other been extensively tried? It works for Awk... juxtapose, the Famous Invisible Perl Operator. Perl 5 Perl 6 $a = $b . $c; $a = $b $c; # or $b$c $a = foo.$c; $a = foo $c; # or foo$c $a = foo . $c; $a = foo$c; # foo $c wouldn't work... $a = $c . foo; $a = ${c}foo# (if foo is a function) $a = foo() . $c;$a = foo() $c; $a = $c . foo();$a = $c foo(); $a = $b-c . $d;$a = $b-c $d; # or $b-c$d; I can see that the indirect objects can be painful my $fh = open(...); print $fh $blah; but maybe we can spread magic thickly enough on filehandles so that concat to a filehandle means output... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: YA string concat proposal
On Tue, Apr 24, 2001 at 01:42:43PM -0700, Nathan Wiger wrote: Uri Guttman wrote: on the other hand, i use .= all the time and wouldn't like to lose it. schwern idea of ce doesn't work for me as only the op= stuff means assignment and ce would break that (e for = isn't visual enough). The fastidious ivory tower side of my brain has always disliked the fact that there is .= for append but no =. for prepend. So if I may have c= and =c in Perl 6 I will be happy :-) (and of course cc for the functional non-argument-modifying version) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Tying Overloading
Or we change the concatenation operator. $a = $b $c; # Do people really use Perl for bit fiddling? Oy! You keep your greedy fingers off my bitvectors. (Incidentally I hope that in Perl 6 there's a way to shift the bitvector aspect of $s: currently $s and $s to shift the numeric aspect of the $s. Currently there's no way to shift bitvectors.) $a = $b # $c; /* Urgh */ $a = $b ~ $c; # Mmm! I like that last one a lot, because it doesn't disturb anything. You'd have to alter ~'s precedence so that binary ~ is higher than named unary operators. (It's print($a~$b), not print $a (~b).) Which reminds me: guess what $s=~0 parses as now? Not as the equivalent of $s = 0xfff..fff -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Parsing perl 5 with perl 6 (was Re: Larry's Apocalypse 1)
I don't get it. The first and foremost duty of Perl 6 is to parse and execute Perl 6. If it doesn't, it's not Perl 6. I will call this the Prime Directive. I think as the first approximation the implementation of Perl 6 should get that "simple" task right. If it doesn't, all our talk and work has been for nothing and we have failed. People seem to think that telling Perl 5 apart from Perl 6 is trivial. In certain special cases, yes, such as the "module"/"class" versus "package" distinction described by Larry, but in the general case that is not not going to be easy, for example when the difference is more syntatical. Some Perl 5 things will by syntax errors in Perl 6, and vice versa. Truly detecting Perl5ness is hard: you will have to in essence replicate the Perl 5 parsing, and we all know the amount of hair in that code. We really want to include such a hairball in our new beautiful code? Thinking about the 5-6 migration and coexistence is good and useful, but since that doesn't advance the Prime Directive, thinking about it *too* much now or fighting over the niggly details is somewhat wasted effort. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Tue, Apr 10, 2001 at 09:28:29AM -0400, John Porter wrote: Dan Sugalski wrote: if (-M "http://www.perl.com/" -M "http://www.python.org/") {...} Nope. Doesn't work with other magic filenames, why should it with these? Because Perl6 will be better than Perl5. I wouldn't mind (in fact I would expect) to see the magic power level increase considerably. I dearly hope none of that elephantine bloat stands in the execution path of Classic Perl. Not that I favor the given example, necessarily... -- John Porter -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
one more language to assimilate
http://www.zdnet.com/intweek/stories/news/0,4164,2705101,00.html http://www.curl.com/html/technology/documentation.jsp (and you have to admit the name is amusingly close) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
It might even mean that we can have a URL literal type, I trust that you will think long and hard about that. Agreed. Saying "URL literal type" is rather bold since "URL" is an open-ended story. It is certainly nice to think of them as opaque filenames for "opening" them and doing IO on tehm but one major headache is the extensibility: the scheme part, especially. Check out http://www.w3.org/Addressing/schemes.html for the latest list. Each scheme carries with it own semantics for how the URL should be understood and which methods can be applied on it. So URLs are not literals, they have structure, and only thinking of them as filenames may be too simplistic. if there's any good reason to treat a URL as more than just a string And that is what's illuminating, imho. -- John Porter -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Fri, Apr 06, 2001 at 07:57:28PM +0100, Simon Cozens wrote: On Fri, Apr 06, 2001 at 07:55:26PM +0100, Graham Barr wrote: Ah OK. So I assume that do "you"; will do the file in a void context Theoretically, yes. (ie, probably not.) From bleadperl t/op/do.t: if (open(DO, "$$.16")) { print DO "print qq{ok 16\n} if defined wantarray not wantarray\n"; close DO; } my $a = do "$$.16"; if (open(DO, "$$.17")) { print DO "print qq{ok 17\n} if defined wantarray wantarray\n"; close DO; } my @a = do "$$.17"; if (open(DO, "$$.18")) { print DO "print qq{ok 18\n} if not defined wantarray\n"; close DO; } do "$$.18"; -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Fri, Apr 06, 2001 at 01:19:30PM -0600, Dan Brian wrote: It might even mean that we can have a URL literal type, I trust that you will think long and hard about that. Agreed. Saying "URL literal type" is rather bold since "URL" is an open-ended story. It is certainly nice to think of them as opaque filenames for "opening" them and doing IO on tehm but one major headache is the extensibility: the scheme part, especially. Check out http://www.w3.org/Addressing/schemes.html for the latest list. Each scheme carries with it own semantics for how the URL should be understood and which methods can be applied on it. So URLs are not literals, they have structure, and only thinking of them as filenames may be too simplistic. But the structure you speak of exists only on the server. A URL as accessor reference doesn't really need to know anything about the opening of that path other than the fact that it is a URL. This renders it pretty useless as a structure to be interpreted *as* a structure as far as the if (open(BLAH, "mailto:[EMAIL PROTECTED]")) { ... client is concerned. But I agree, if only to not have to configure proxy settings to get 'Configure' to work. :/ So these are actually half-digested-half-baked beans. The order of half-ities shouldn't be given any more thought ... damn, too late. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Fri, Apr 06, 2001 at 03:37:35PM -0400, Adam Turoff wrote: On Fri, Apr 06, 2001 at 03:31:56PM -0400, John Porter wrote: Jarkko Hietaniemi wrote: So URLs are not literals, they have structure, and only thinking of them as filenames may be too simplistic. Yeah. But Rebol manages to deal with them. I doubt it. telephone:? fax:? lpp:? callto:? uuid:? If Rebol can handle all of those URL schemes, why bother with Perl in the first place? I don't know if this is something we want to follow Rebol's lead on, but it's something to look at. Sounds like if there's a 'use url;' clause in use, then the standard three (mailto:, http:, ftp:) might be available, whereas other URL schemes would need different declarations (use url::dns;). I'm not saying that having URLs wouldn't be nice, it's just that thinking of them as entity names and just practicing simple I/O (print, getline) on them is overstretching the idea. The objects behind the URLs might be messy, errr, complex. Let's say you open ftp://foo.bar/. Fine. Now what? How do you do a DIR? How do you do a GET? A PUT? A CWD? A MKDIR? Then http:// How's GET different from POST? How do you change the headers? This is starting to sound like libnet and LWP? Good. It should. There's only so much magic you can sweep under the carpet before it starts flying off at dangerous directions. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Fri, Apr 06, 2001 at 08:42:18PM +, [EMAIL PROTECTED] wrote: Jarkko Hietaniemi [EMAIL PROTECTED] writes: But the structure you speak of exists only on the server. A URL as accessor reference doesn't really need to know anything about the opening of that path other than the fact that it is a URL. This renders it pretty useless as a structure to be interpreted *as* a structure as far as the if (open(BLAH, "mailto:[EMAIL PROTECTED]")) { ... You mean something like: if (open(BLAH,":URL","mailto:[EMAIL PROTECTED]")) { ... Now PerlIO/URL.pm has to know the semantics of /^mailto:/. If it does it can do DNS lookup for MX record for north.pole and presumably fail and return undef. Oops sorry that is perl5 ;-) Shoo! :-) Having all that mess extensibly hidden in modules is okay. -- Nick Ing-Simmons -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry's Apocalypse 1
On Wed, Apr 04, 2001 at 11:46:12PM -0700, Nathan Torkington wrote: Not a comment at all on it? Was I accidentally unsubscribed to perl6-language? *tap* *tap* is this thing on? Nat Me, I've been racking my brain to figure out whether Damian is Famine, War, Plague, or Death... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Perl culture, perl readabillity
Nicely put, Merijn. Stomping into (any) programming language camp and telling loudly that what you are doing is wrong is a bit like stomping into a Mongol camp and asking what's up with the funny fur hats. Or, in the of case Perl, accusing us of too much line noise and being too hard to read, is like complaining to the Chinese/mathematicians that can't you just using Latin letters / plain English instead of Greek and symbols so that the rest of us could understand you. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: What can we optimize (was Re: Schwartzian transforms)
On Thu, Mar 29, 2001 at 10:25:06AM -0500, James Mastros wrote: On Wed, Mar 28, 2001 at 03:41:42PM -0800, Hong Zhang wrote: Are we over-optimizing? The Perl is just an interpreter language. Who really needs this kind of optimization for Perl? Even C does not provide this feature. Umm, art thou sure? C can optimize better then we currently do many times, Somewhat tangentially: this reminds me of a message a week ago or so (can't find it anymore in my inbox) which proposed writing C (or C++) code for Perl 6 so that "modern CPU architectures are happy" (no pipeline stalls because of "if"-s, etc.) Hello? This is a very high-level language we are writing, not a DSP core. Optimizing by choosing good algorithms and data structures, yes, microoptimizing, maybe, only after the code works first, and even then we would be following the mirage since CPU architectures do evolve, and in general, for large codebases, the C compilers are much, much, better in optimizing than humans. Yes, a human can sit down and read the databooks and optimize a simple algorithm to hell and back. But megabytes of source code? Get real. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: What can we optimize (was Re: Schwartzian transforms)
On Thu, Mar 29, 2001 at 11:29:16AM -0500, Dan Sugalski wrote: At 05:19 PM 3/29/2001 +0100, Dave Mitchell wrote: Jarkko Hietaniemi [EMAIL PROTECTED] wrote: Somewhat tangentially: this reminds me of a message a week ago or so (can't find it anymore in my inbox) which proposed writing C (or C++) code for Perl 6 so that "modern CPU architectures are happy" (no pipeline stalls because of "if"-s, etc.) Hello? This is a very high-level language we are writing, not a DSP core. Optimizing by choosing good algorithms and data structures, yes, microoptimizing, maybe, only after the code works first, and even then we would be following the mirage since CPU architectures do evolve, and in general, for large codebases, the C compilers are much, much, better in optimizing than humans. Yes, a human can sit down and read the databooks and optimize a simple algorithm to hell and back. But megabytes of source code? Get real. That may have been me: (Sorry if I sounded too blunt, the other stuff in the PDD was fine.) http://archive.develooper.com/perl6-internals%40perl.org/msg02685.html (PDD for coding conventions) The main thrust of that was whether a PDD on coding conventions should have sections on: * Coding style * Naming conventions * Commenting conventions * Portability guidelines * Performance guidelines Based on your comments above (which I hearily agree with), I guess we can safely dispense with that last entry. Don't. Hand-optimizing the C code's pretty silly generally, but there are some reasonable rules of thumb that can gain enough of a performance boost [snip] Yes. Rules of thumb are good, sort of like common lore of how CPUs in general work. I would like to add the overall principle of optimizing for speed first (that is, at the expense of space, e.g. by using wide integer types) (worry about space later, if needed), and avoiding division/modulus. Perhaps the rule #0 would be: measure before you optimize. Concentrate on the hotspots, instead of wasting your time honing some obscure rarely executed code. An additional coding guideline could be: * Extensibility guidelines (This is not the same as 'portability.') One particular detail I've noticed cropping up would be to avoid using char* (or {char*,length}) if it is feasible to later use a SV* (perl5-speak) at the same spot. An example: UTF-8 hash keys in Perl5. The same goes for flag fields: only if you can be fairly certain that the number of flags never exceeds 32, should you use an int. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Schwartzian Transform
On Mon, Mar 26, 2001 at 05:17:38PM -0500, John Porter wrote: Simon Cozens wrote: With all due respect, that's not been my experience. Even beginners know how to do things like "length", by far the most common case for the ST. You must be kidding. Sorting a list of strings by length is more common that, say, sorting them numerically by some embedded number? I don't think so. Besides, simply sorting strings by length doesn't require ST. The ST applies when you want to sort by one or more embedded "fields". Huh? ST (or GR) applies to any situation where you your sort comparator function isn't directly expressible with (Perl) primitives, and worthwhile it is (like Yoda feel I) when the cost of converting the keys (so that the primitives can again be employed) begins to dominate the overall cost of sort(). -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Schwartzian Transform
On Mon, Mar 26, 2001 at 05:29:24PM -0500, John Porter wrote: Jarkko Hietaniemi wrote: ST (or GR) applies to any situation where you your sort comparator function isn't directly expressible with (Perl) primitives, and worthwhile it is (like Yoda feel I) when the cost of converting the keys (so that the primitives can again be employed) begins to dominate the overall cost of sort(). Of course. So how is the ST justified when you simply want to sort by length? I.e., why is this not sufficient: Those of the School of Maniacal Optimization may prefer calling length() only O(N) times, instead of O(N log N) times. Yeah, a weak argument, but then again, I didn't claim length() as such being the prime user of ST. I just jumped at your "fields" description, which sounded odd to me. There need not be "fields" by any stretch of the term. It's all about reduction to primitive-comparable and the relative cost of it. sort { length($a) = length($b) } # I see no ST here. And this was alleged to be the most common case for ST. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Schwartzian Transform
On Wed, Mar 21, 2001 at 10:24:05AM -0500, John Porter wrote: Uri Guttman wrote: records can be strings, or any perl [LH]o[LH]. y/L/A/; for a schwartz (drop the 'ian') or GR transform. Why? So it conforms with the "Guttman-Rosler" naming standard? Which *I* would call "Macdonald transform" anyway :-) (John Macdonald suggested the trick to me at least a year before the GR paper, and it's there in the Sorting chapter, though it is not called by any special name...) -- John Porter -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
quote for the day
What is this talk of software 'releases'? Klingons do not 'release' software; our software ESCAPES, leaving a bloody trail of designers and quality assurance people in its wake! -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: quote for the day
What is this talk of software 'releases'? Klingons do not 'release' software; our software ESCAPES, leaving a bloody trail of designers and quality assurance people in its wake! Sorry, forgot the annotation: -- seen as the .sig of Malcolm Purvis [EMAIL PROTECTED], used completely without asking permission -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: The binding of my (Re: Closures and default lexical-scope for subs)
FOR --- 1. It becomes more consistent with other Perl functions my is not a function. It is a declaration. Functions take arguments and return values. my does not. It is language construct like if. Unless, of course, you claim that if is a function, too. That ways lies LISP. I actually like LISP, but why reinvent it...? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Mon, Feb 12, 2001 at 12:36:53PM -0300, Branden wrote: John Porter wrote: Branden wrote: For example, with tgz it would be complex to deal with running without extracting, What? tar -z not good enough for you? The problem is that we cannot access individual files inside the archive without decompressing the whole archive, what is possible with .tar (not I do not see a huge problem in decompressing the whole archive if needed. .gz) and .zip. Then we can assign a perl filehandle to access a file from inside the archive and decompress it on-the-fly. - Branden -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
par can do something similar. It can slap a copy of pun (and thus perl) onto the archive. Its not simple, and its platform dependent, but its useful. I'm more and more seeing par as a way of embrace/extend/destroying perl2exe. And I think we could squeeze something into 5.8. Careful with that keyboard. The problem of packaging and compressing is easy. The problem of unpacking, or in other words, installing, or in other words, embedded hardwired paths is hard. Think library paths: both pure Perl libraries *and* shared libraries. In theory this is easy: the portable (and grody) solutions is to have a "long enough" filler path(s) that is(are) then at install time binary patched. In practice, though, for some reason no one seems to have done this so that this would be a widely used practice and well-known art. In your answer remember other UNIX platforms than Linux and other platforms than UNIX. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Mon, Feb 12, 2001 at 02:19:54PM -0500, [EMAIL PROTECTED] wrote: On Mon, Feb 12, 2001 at 01:03:31PM -0600, Jarkko Hietaniemi wrote: The problem of unpacking, or in other words, installing, or in other words, embedded hardwired paths is hard. Think library paths: both pure Perl libraries *and* shared libraries. In theory this is easy: the portable (and grody) solutions is to have a "long enough" filler path(s) that is(are) then at install time binary patched. In practice, though, for some reason no one seems to have done this so that this would be a widely used practice and well-known art. Looked at the ActiveState Unix installer lately? They distribute a *rant warning* Sigh. (Note to self: always remember to spell out everything in full because someone will feel obliged to informe you.) Yes, I know this. That's what I referred to by "widely used". ActiveState may be big, especially in the Windows arena but they are not "widely used". zip is widely used. .tgz is widely used. Windows is widely used. UNIX is widely used. ActiveState, not. *end of rant* Perl binary with a built-in @INC prefix something like "/tmp/XpErLXX" and then do some s/// madness over the binary. Anyhow, this is easily solved by having pun run the scripts inside the par as "perl -Ilib" or something similar. It's "easily done" but strangely the implementations seems to have left the main Perl distribution unscathed after all these years. Shared libraries are easy enough to solve, build perl staticly linked. Oh, great. You have to do that anyway to solve the "what version of glibc are you using" problem (and others). *minirant* The world is not not glibc. The world is not Linux. *end of minirant* Either I am being even more grumpier than usual or you people are making even less sense than usual :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Mon, Feb 12, 2001 at 02:41:01PM -0500, [EMAIL PROTECTED] wrote: Oh, I fully realize that *none* of this "self-extracting" nonsense is going to be cross-platform by any means. For each variation of Unix Whew! I was starting to think I'm surrounded by tunnel visioned penguins. you'll need a seperate par binary, but its no worse than C. But Unix really isn't a problem. Any Unix dist worth its weight in snot comes with Perl. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 06:17:34PM -0200, Branden wrote: I had the time to do a research in Internet about rpm/jar. The correct URLs are: * http://www.rpm.org * http://java.sun.com/products/jdk/1.1/docs/guide/jar/ I found great utilitaries in http://www.rpm.org/software.html, we could probably steal some of them for `par'. I found out that most of them are written in Perl or otherwise Perl-related. * rpm2html / rpmfind: The equivalent of CPAN.pm? * rpm-cvs: Building a RPM from a CVS source tree. * AutoRpm: Update a system with rpms from any source. * rpmlint: A lint for rpms packages. * Perl-RPM: Attempts Perl bindings for RPM. * build-package: Build rpms from source packages. There's also a tool called 'alien': http://freshmeat.net/projects/alien/ Alien converts between the rpm, deb, Stampede slp, and Slackware tgz file formats. If you want to use a package from another distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it. Whatever we do I would much prefer being package format agnostic instead of tying ourselves too tightly with some single format. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 06:46:26PM -0200, Branden wrote: Jarkko Hietaniemi wrote: Whatever we do I would much prefer being package format agnostic instead of tying ourselves too tightly with some single format. Any ideas on how to do that? Without breaking requirements? There isn't a software problem another abstraction layer can't fix... Design and implement a package format independent API that has calls like %files = $package-getfiles(), $package-getfile($file), $package-gettotalsize(), $package-dependencies(), $package-install(), $package-uninstall(), and at lower levels (non-casual-user) calls like guessformat($file). Yes, this would be harder than sticking with one format, but so much more flexible. An API and its implementation would be very beneficial also in installing other software than just Perl. problems (like `oh! I don't have bzip2 and the developper only supplied a bzip2 version of the archive', or `oh! I'll have to do zip, tgz, bzip2, whatever3 versions of the same thing only to satisfy users that use different formats'). And how is this different from 'oh! I don't have unzip'? I think we should go for `standard' rather than `flexible' on this one. As I said on this I disagree. I have no problem with in the first implementation round doing just zip: what I abhor is the idea of hardwiring the zip assumption deeply into our design. Of course we still can change the file format, if someone isn't happy about zip. That's the advantage of discussing it before making it: it's not here for we to regret about it... - Branden -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 04:05:54PM -0500, John Porter wrote: Jarkko Hietaniemi wrote: There isn't a software problem another abstraction layer can't fix... "...except the problem of too many layers of abstraction". tchrist (for those of you who didn't get the reference) Well, I certainly heard the reference before even hearing of Perl or Tom... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 04:09:28PM -0500, John Porter wrote: Jarkko Hietaniemi wrote: (for those of you who didn't get the reference) Well, I certainly heard the reference before even hearing of Perl or Tom... I only ever saw it with his name on it. I believe the first part of it (adding layers) is an age-old programming adage, the second part (not overdoing it) may well be Tom's addition. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 09:18:55PM +, Nicholas Clark wrote: On Fri, Feb 09, 2001 at 04:07:51PM -0500, John Porter wrote: Branden wrote: For example, with tgz it would be complex to deal with running without extracting, What? tar -z not good enough for you? I believe that that wognt work ugnless you have gnu tar. So very true. Good people, the world is not Linux is it was not VAX. (one may have "gzip" in which case one can "gzip -dc foo.tgz|tar ...") We must be flexible/robust/friendly. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Auto-install (was autoloaded...)
On Fri, Feb 09, 2001 at 09:22:13PM +, Nicholas Clark wrote: On Fri, Feb 09, 2001 at 02:53:43PM -0600, Jarkko Hietaniemi wrote: On Fri, Feb 09, 2001 at 06:46:26PM -0200, Branden wrote: problems (like `oh! I don't have bzip2 and the developper only supplied a bzip2 version of the archive', or `oh! I'll have to do zip, tgz, bzip2, whatever3 versions of the same thing only to satisfy users that use different formats'). And how is this different from 'oh! I don't have unzip'? Code to do unzip (yes, even including the whole of zlib just like gcc, xfree86 and several other things I can't remember offhand that irritate me as I have libz.so) is small enough to go in the perl core if needed. strawmanI assume the next logical thing to add would be MD5?/strawman -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: assign to magic name-of-function variable instead of return
On Tue, Feb 06, 2001 at 05:01:03AM +1100, Damian Conway wrote: Really? Are lexicals in the sub visible in the post handler? No. Only the original arguments and the return value. (Of course I realize *F does not illustrate this...) Exactly. ;-) Actually, I do agree that Perl 6 ought to provide a universal "destructor" mechanism on *any* block. For historical reasons, I suppose it should be Ccontinue, though I would much prefer a more generic name, such as Ccleanup. Cmop ? :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
I wasn't clear. I was thinking that somehow a module would register with the core what interfaces it support when it is installed. Anything else is madness (ok, my idea is madness too). Your idea's not madness--it is, in fact, what I'm looking for us to define. A gut feeling that I have is we can't simply go by interface 'names', be they just simple names of funtions/methods or their full 'signatures' (let us not even start on (1) how difficult with Perl's type system and functions it is to define signatures (2) the difficulty in defining an ontology/vocabulary), either would not really be enough. What I think is needed is some sort of opaque tag: the name of the 'contract' the API claims to fulfill. The name can be the name of the standard, the name of the company, the name of the individual. (Java does a very similar thing but they propose embedding the DNS name as part of the package name: I think they the right idea but the proposed implementation sucks.) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
On Fri, Feb 02, 2001 at 02:36:43PM -0500, James Mastros wrote: On Fri, Feb 02, 2001 at 01:17:35PM -0600, Jarkko Hietaniemi wrote: What I think is needed is some sort of opaque tag: the name of the 'contract' the API claims to fulfill. The name can be the name of the standard, the name of the company, the name of the individual. (Java does a very similar thing but they propose embedding the DNS name as part of the package name: I think they the right idea but the proposed implementation sucks.) Well, what you're looking for is a universaly unique identifier. I'm looking for a *hopefully* unique enough id that's also user friendly. A DNS name is assuming too much about the organizational structure and a mile long hex digit isn't very friendly, and neither of them is very descriptive. "XPG4 SysV IPC" would be. (I just made that one up.) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
On Fri, Feb 02, 2001 at 02:57:20PM -0500, James Mastros wrote: On Fri, Feb 02, 2001 at 01:47:29PM -0600, Jarkko Hietaniemi wrote: A DNS name is assuming too much about the organizational structure and a mile long hex digit isn't very friendly, and neither of them is very descriptive. "XPG4 SysV IPC" would be. (I just made that one up.) Oh, I quite agree with your first (as quoted) sentance. I just don't see how as "XPG4 SysV IPC" is any better then IPC::SysV::XPG4. And /neither/ of Alone as such it wouldn't be, and it even couldn't be 100% true since the XPG4 binding is for C, but let's make it "XPG4 SysV IPC [EMAIL PROTECTED]". them is good enough to be a contract name -- I'm certian that there's more then one possible way to bind XPG4's SysV IPC scheme into perl. (And I don't even know what XPG4 is.) A UNIX standard. I guess nowadays we should be doing SUS instead. Speaking of contract names, is Damien about? The Australien mad professor should be around. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
I rather like the idea that contract names are themselves namespace I rather dislike it: I think we are trying to stuff to much information on the package namespaces. names. A contract version's name is thus defined within that contract's namespace. E.g. "specifies Foo::Bar" -- I specify a contract. "implements Foo::Bar::quux" -- I implement the Foo::Bar contract, specifically the quux version thereof. In any case, version idents should be legal perl identifiers; I have no problem with that as long as we allow *all* characters in Perl identifiers. Yes, do I mean *all*. they can't really be numbers, since they are not inherently ordered. I could number *mine* jdp1, jdp1_1, etc., if I want... And for the the next J. D. P. person that comes along we say "tough luck"? No thanks, that's exactly the same mess we are now with the package names. -- John Porter You can't keep Perl6 Perl5. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
On Fri, Feb 02, 2001 at 03:54:33PM -0500, John Porter wrote: Jarkko Hietaniemi wrote: I rather like the idea that contract names are themselves namespace I rather dislike it: I think we are trying to stuff to much information on the package namespaces. Well, I didn't say *package* namespace; I'm just pointing out that contract names can probably use the same kind of hierarchical categorization that other names do. Ahh, okay. luck"? No thanks, that's exactly the same mess we are now with the package names. When you come up with a solution to this problem, please send an email to ICANN. I'm not claiming to have solution: I claim that the com.sun.java.Gorkulator isn't one. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Why shouldn't sleep(0.5) DWIM?
On Wed, Jan 31, 2001 at 05:35:03PM -0500, Michael G Schwern wrote: On Wed, Jan 31, 2001 at 05:23:43PM -0500, Dan Sugalski wrote: Pulling out or mangling time strikes me as intensely pointless, and I don't see it happening. The socket stuff is really the only core functionality that makes any sense to pull out, and that only from an architectural standpoint. Perhaps some of the more grossly UNIX specific things like getpwnam's extended family and the SysV IPC stuff? I still say that this is wasted effort. Yes, those are grossly UNIX specfic. But removing them doesn't buy you much. Rather design, say, how to gracefully switch between native integers and bigints. Or a fast and stackable tie() subsystem. Or explore various garbage collection alternatives. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Really auto autoloaded modules
On Thu, Feb 01, 2001 at 04:54:53PM +, Simon Cozens wrote: On Thu, Feb 01, 2001 at 11:52:37AM -0500, Dan Sugalski wrote: just a method for doing what we currently do with, say, glob or the heavy unicode things? None of the above. What I'm looking for is the pieces that turn the use of a function into an automagic use of the module containing that function. But that *is* what we do with glob and the heavy unicode things! Anyway, I see your point. I shall have a think about it tonight. Heavy Unicode things do things (pull in Unicode character classes like \p{Ogham}) in Perl, which is kinda neat and flexible but also kinda sucks (slow and bloaty), and the mechanism depends on filenames (character class name must equal filename), which is kinda easy to implement but also kinda clunky and non-portable (\p{UnifiedCanadianAboriginalSyllabics}). -- Writing software is more fun than working. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Why shouldn't sleep(0.5) DWIM?
On Tue, Jan 30, 2001 at 04:13:39AM -0500, Michael G Schwern wrote: Is there any really good reason why sleep() doesn't work for microseconds? I mean, if I can do this: sub sleep { my($time) = shift; if( /^[+-]?\d+$/ ) { sleep($time); } else { select(undef, undef, undef, $time); } } Why can't Perl? Smells like a C holdover to me. I guess it's part of the can of sub-second worms: if we do sleep(), people will ask why don't we do time() and alarm(), too. sleep() and alarm() we could get away with more easily, but changing time() to do subsecond granularity would be A Bad Thing for backward compatibility. Think of generated filenames, or various logs with timestamps. We can (hopefully) do a magical p52p6 translator, but fixing the existing data is a tad harder. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: JWZ on s/Java/Perl/
On Sun, Jan 28, 2001 at 11:07:10PM -0700, Nathan Torkington wrote: Jarkko Hietaniemi writes: True, but you can't do any of all that without knowing the platform accurately (nontrivial and requires core mod or XS). Once that's done, the rest is just a matter of extending File::Spec (trivial and pure Perl). Trivial? *cough* *snigger* If it was trivial, Configure wouldn't need to exist--we could just use hints files. Lots of hints files. One for each configuration, in fact. Hey Jarkko, I have an idea ... :-) Someone please make the evil man go away... Nat -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: JWZ on s/Java/Perl/
On Sun, Jan 28, 2001 at 08:56:33PM -0500, Michael G Schwern wrote: On Sun, Jan 28, 2001 at 10:07:55PM +0100, Bart Lateur wrote: Uhm, I'm sorry, but that's not good enough. You cannot distinguish between Windows 95/98/ME on one side, and NT/2k on the other, using $^O alone. After all, $^O is just a constant burnt into the executable when perl was compiled. You can run the same perl.exe on all platforms, and indeed, most people do. Yet win9* and NT are different enough in behaviour (e.g. flock) to warrant a test on platform. Er... which is: no go. Well, fork works on both now, but I see your point. There are ways of detecting the OS at run-time under Windows, mostly through MFC junk or peeking in the registry. It would probably be good to do it for the MacOS versions, too. The desire to know the name of the runtime platform is a misdirected desire. What you really want to know is whether function Foo will be there, what kind of signature it has, whether file Bar will be there, what kind of format it has, and so on, whether a feature Zog is present, or what is the value of parameter Blah. Just knowing the name of the platform doesn't buy you a whole lot. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: JWZ on s/Java/Perl/
On Mon, Jan 29, 2001 at 01:08:21AM -0500, Michael G Schwern wrote: On Sun, Jan 28, 2001 at 11:54:13PM -0600, Jarkko Hietaniemi wrote: The desire to know the name of the runtime platform is a misdirected desire. What you really want to know is whether function Foo will be there, what kind of signature it has, whether file Bar will be there, what kind of format it has, and so on, whether a feature Zog is present, or what is the value of parameter Blah. Just knowing the name of the platform doesn't buy you a whole lot. True, but you can't do any of all that without knowing the platform accurately (nontrivial and requires core mod or XS). Once that's done, the rest is just a matter of extending File::Spec (trivial and pure Perl). Trivial? *cough* *snigger* -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC on Coexistance and simulaneous use of multiple module version s?
Larry mumbled something like "implements" and "interface". So to say package Net::FTP::Foo implements Net::FTP; But I don't think, anybody wrote an RFC about the plan. I did. Or something like it. And I've got a couple of modules on CPAN (that I really must document better) that kind of work already: package ShoppingBasket; use ex::interface qw/add_entry total_price delete_entry .../ Interfaces are tricky. One must assume a common agreed-upon vocabulary or ontology. What does 'add_entry' mean, really and exactly? What arguments does it take? What arguments could it take? What does it return? Does it have non-local effects? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: JWZ on s/Java/Perl/
I like the final point: Stay tuned, I'm sure I'll have found something new to hate by tomorrow. (Well, that's how this document originally ended. But it's not true, because I'm back to hacking in C, since it's the still only way to ship portable programs.) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: [FWP] sorting text in human-order
On Fri, Jan 05, 2001 at 09:42:12PM -0500, Brian Finney wrote: generally speaking when you look a number and convert it into text you go through some simble steps say we start with this number 123,456,789 first we divide into sets of three (123,000,000)+(456,000)+(789) then we expand (123*1,000,000) + (456*1,000)+(789) and expand further (((1*100)+(20+3))*1,000,000) + (((4*100)+(50+6))*1,000)+((7*100)+(80+9)) then we convert to words (((one*hundred)+(twenty+three))*million)+(((four*hundred)+(fifty+six))*thousand)+((seven*hundred)+(eighty+nine)) now we replace math with spaces except the + between the tens and ones producing one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine Nonono. Everybody should know that it is satakaksikymmentäkolme miljoonaa neljäsataaviisikymmentäkuusi tuhatta seitsemänsataakahdeksankymmentäyhdeksän. Now, maybe I be so bold as to suggest that we get back to perl6-language, please? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: [Fwd: Re: [FWP] sorting text in human-order]
On Mon, Jan 01, 2001 at 02:04:25PM -0600, Jonathan Scott Duff wrote: On Fri, Dec 29, 2000 at 11:47:59PM -0600, Jarkko Hietaniemi wrote: The sorting algorithm? Before 5.005 (I think...my memory is going) vendors' quicksort, after that Tom Horsley's excellent ultratuned quicksort (since vendors' quicksorts were (a) buggy (c) slow), in 5.7 mergesort by John Lindermann was introduced. Could someone give me a pointer to the whys and wherefors of the change from quicksort to mergesort? Executive summary: (1) Quicksort has a weak point where it goes deep into the Quadratic Land: (nearly) already ordered data. No, that is not so far-fetched a case. Mergesort has no similar weakpoints: its performance is in fact consistently N log N. (2) Mergesort is stable. Quicksort is not. Some of the discussion: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-09/msg00484.html (and the following thread) and a real-life case: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-12/msg00241.html http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-12/msg00244.html thanks, -Scott -- Jonathan Scott Duff [EMAIL PROTECTED] -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: [Fwd: Re: [FWP] sorting text in human-order]
On Sat, Dec 30, 2000 at 05:31:29AM +, David L. Nicol wrote: Piers Cawley wrote: "David L. Nicol" [EMAIL PROTECTED] writes: After reading Cawley's method, I wondered if using it we could make radix-sorts the default sort method. Er... the point behind changing numbers to binary strings was emphatically not so that they could be sorted by a Radix method, but to ensure that numbers within text would sort correctly: qw(A1 A2 A3 A10) instead of qw(A1 A10 A2 A3)... The rsort documentation informs that radix-sorts will sort ascii text. My thought was that the perl6 default sort could do an implied ST on the data, using Cawley's Substitution, and then a radix-sort, instead of analyzing each pair of data to see if they are numeric or not using whatever the current heuristic is. I do not know exactly what the perl5 default sort heuristic is, aside that it tries to DWIM both numeric and string data. "sort heuristic"? "DWIM both numeric and string data"? There is no "heuristic". There is no "DWIM". Perl's sort() does by default string sort based on the byte values of the strings of its argument list. That's it. Period. Full stop. If you want something else, like a numeric comparison, or, say, a case-ignorant string comparison, or whatever, then you supply the comparison function yourself. The sorting algorithm? Before 5.005 (I think...my memory is going) vendors' quicksort, after that Tom Horsley's excellent ultratuned quicksort (since vendors' quicksorts were (a) buggy (c) slow), in 5.7 mergesort by John Lindermann was introduced. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: [Fwd: Re: [FWP] sorting text in human-order]
On Wed, Dec 27, 2000 at 06:36:56PM -0600, David L. Nicol wrote: Is there a perl6 sort committee yet? AFter reading Cawley's method here, I wonder if using it we could make radix-sorts the default sort method. Radix sorts are great if the data cooperates, radix sorts can really fly in such conditions -- but this is not always the case: radix sorts require that you have an unambiguous rule for mapping all the keys to a flat fixed-length 'namespace'. Take, for example your usual strings of practically unlimited length. You can't define a (non-lossy and non-colliding) rule to map them to, say, fixed-length integers. Therefore and thusly: we aim for pluggable sort algorithms. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: [Fwd: Re: [FWP] sorting text in human-order]
On Thu, Dec 28, 2000 at 03:43:21PM -0500, John Porter wrote: Dan Sugalski wrote: use sort qw(radix_sort); sort \radix_sort @data; Isn't that the slot where the comparison function goes? Maybe something more like this: use sort::radix_sort; sort @data; # magically uses radix_sort instead of default. If someone wants to play with such ideas there's Perl 5.7 which has a new mergesort as the incore sorting algorithm, while Perl 5.6 and before used quicksort. -- John Porter What would Gabrielle do? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Larry update
On Mon, Dec 18, 2000 at 11:33:36AM -0700, Nathan Torkington wrote: I just got off the phone with Larry. He's been laid up for three weeks with a trip to Japan followed by a virus from Japan. He's on So Perl 6 will be...Ruby? :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Perl 5's non-greedy matching can be TOO greedy!
Please give it a rest. I think everybody got it by now. Everybody understands how the current implementation works and what the semantics are, and you disagree with the current semantics. I think that's the end of story since changing current default semantics is simply not an option. We can't break all the existing programs that depend on the current stinginess semantics, period. Now move on. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Perl 5's non-greedy matching can be TOO greedy!
More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous Yup, that's a bit confusing. It's really "start matching as soon as possible, and stop matching as soon as possible". (The usual greedy one is, of course, "keep matching as long as possible".) The initial invariant part, "start as soon as possible", is the de facto and de jure (at least POSIX 1003.2, but probably also Single Unix) definition, and therefore rather non-negotiable. simplification of what "*?" means. It might better be described as "match until you find a match for the rest of the regex" ('d' in your -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
more food for thought
Limbo, the systems programming language of Inferno, nee Plan 9, nee UNIX. http://www.vitavuova.com/inferno/papers/limbo.html ( Found thorough the the recent /. link where a whole operating system (Inferno) is available as a browser (IE) plugin: http://www.vitanuova.com/inferno/pidoc/index.html ) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: more food for thought
On Fri, Dec 15, 2000 at 03:22:48PM -0600, Jarkko Hietaniemi wrote: Limbo, the systems programming language of Inferno, nee Plan 9, nee UNIX. http://www.vitavuova.com/inferno/papers/limbo.html ( Found thorough the the recent /. link where a whole operating system (Inferno) is available as a browser (IE) plugin: http://www.vitanuova.com/inferno/pidoc/index.html Holy mackerel. How about running a UNIX-like shell (rc) *inside* your Internet Exploiter? http://www.vitanuova.com/inferno/pi/shell/index.html I feel definitely weird saying "ps", "date", and "ls" inside my IE. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: more food for thought
On Fri, Dec 15, 2000 at 04:30:59PM -0500, Sam Tregar wrote: On Fri, 15 Dec 2000, Jarkko Hietaniemi wrote: Limbo, the systems programming language of Inferno, nee Plan 9, nee UNIX. http://www.vitavuova.com/inferno/papers/limbo.html What are your thoughts about Limbo? I did some Limbo programming a couple My thoughts about Limbo so far are "Printed the white paper, now must find the time to read it." -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
one major flaw in the RFC processn
Status: Frozen I'm sorry, I was gonna bite my lip, but I've gotta say: Freezing RFC's like this when the following is true: A lot of good, heated discussion was generated on the mailing lists. The majority seems against using XML-DTD documentation, but granted there are deficiencies in POD. Is absolutely, 100% against the entire idea of the RFC process. They're "Requests for Comments". The comments received were overwhelmingly "This is a Bad Idea". Exactly. One major gripe I had and still have with the RFC process is that many authors equated RFCs as their very own pet projects which shall not be criticized in any form, state, or manner. Pointed out flaws and problems were not recorded down in the RFCs. I admit that my idea of healthy RFC process may not be shared by everyone and that we certainly did not specify how RFCs should be maintained. It's possible to overboard in the other direction, too: some RFCs tried perhaps too hard to embrace every little idea or comment thrown at their direction, resulting in bulky monstrosities, where featuritis is not only creeping but leaping. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 357 (v2) Perl should use XML for documentation instead of POD
I disagree. The RFC process is for generating ideas, not making decisions, nor is any author obliged to include ideas he/she doesn't agree with; that's why others can (or could) submit RFCs that contradict it, if they want to. The author is no more obliged to include opposing opinions in Not obliged, no. But not recording opposing views is like sticking fingers in your ears and loudly chanting 'la la la la, my proposal is good, pure and uncontested, la la la, la la la...' their RFC than the proposer of a bill in the House is required to include contrary views. One doesn't necessarily merge two conflicting ideas to get -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Expunge use English from Perl?
On Mon, Oct 02, 2000 at 07:32:42AM -0400, Bryan C. Warnock wrote: On Wed, 27 Sep 2000, Nathan Wiger wrote: Yeah, I've never liked the _ syntax, I've always thought it was weird (to say the least). I think grouping file tests would be much cleaner. As long as you are okay with having to restat for 'or' clauses. (There are work arounds, and supposedly 'this or that' is less common for file tests.) A rather sweeping statement. ANDing makes more sense for the permissions checks, but ORing makes more sense for the type checks. For example, I can imagine -f $foo || -l $foo being a rather common idiom. -- Bryan C. Warnock ([EMAIL PROTECTED]) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Conversion of undef() to string user overridable for easy debugging
On Mon, Oct 02, 2000 at 09:17:31PM -0500, David L. Nicol wrote: Jarkko Hietaniemi wrote: This reminds me of a related but rather opposite desire I have had more than once: a quotish context that would be otherwise like q() but with some minimal extra typing I could mark a scalar or an array to be expanded as in qq(). For example doubling the $ and @? $$foo, @@bar? This comes in handy when you are generating big blocks of code on the fly but only tiny parts of it needs to be interpolated. Unfortunately the margin of my monitor is not enough to describe this wonderful idea in a form of a RFC. $qqdString =~ s/\[(\w+)\]/defined($vars{$1})?$vars{$1}:"[$1]"/ge; I'm sorry but that didn't quite make my heart leap with joy :-) -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b (RFC 199)
David L. Nicol wrote: "Randal L. Schwartz" wrote: I think we need a distinction between "looping" blocks and "non-looping" blocks. And further, it still makes sense to distinguish "blocks that return values" (like subroutines and map/grep blocks) from either of those. But I'll need further time to process your proposal to see the counterarguments now. In the odd parallel universe where most perl 6 flow control is handled by the throwing and catching of exceptions, the next/last/redo controls are macros for throwing next/last/redo exceptions. Loop control structures catch these objects and throw them again if they are labeled and the label does not match a label the loop control structure recognizes as its own. I find this urge to push exceptions everywhere quite sad. Most folks seem to think that a grep block is more like a loop block, and so want to use Clast; I have been more of the opinion that a grep block is more like a sub, and so should use Creturn. In the other camp, Cyield has been suggested; but the conflation of that with its thread-related semantics may not be a such good idea. Cpass. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b (RFC 199)
On Thu, Sep 14, 2000 at 11:46:31AM -0400, 'John Porter' wrote: Jarkko Hietaniemi wrote: In the other camp, Cyield has been suggested; but the conflation of that with its thread-related semantics may not be a such good idea. Cpass. Well, "pass" might be o.k.; but it usually means something going *into* a sub, not coming out... I'll pass that remark. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v1) Selective interpolation in single quotish context.
On Thu, Sep 14, 2000 at 06:04:41PM -0400, Mark-Jason Dominus wrote: seconded by Mark-Jason Dominus [EMAIL PROTECTED] Except that I don't think adding this feature to the existing q{...} is a good idea. If I had to vote on your proposal, I would instantaly vote against it. I think you should have invented a new operator or a pragma or something. Agreed. One could for example have a pragma to *really* tag variables lexically to be expanded within singlequotes. Or for that matter, *not* to be expanded within doublequotes. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v1) Selective interpolation in single quotish context.
On Thu, Sep 14, 2000 at 05:11:39PM -0500, Jarkko Hietaniemi wrote: On Thu, Sep 14, 2000 at 06:04:41PM -0400, Mark-Jason Dominus wrote: seconded by Mark-Jason Dominus [EMAIL PROTECTED] Except that I don't think adding this feature to the existing q{...} is a good idea. If I had to vote on your proposal, I would instantaly vote against it. I think you should have invented a new operator or a pragma or something. Agreed. One could for example have a pragma to *really* tag variables lexically to be expanded within singlequotes. Or for that matter, *not* to be expanded within doublequotes. Failing that, another possibility would be to have a new qSOMETHING() op, and its interpolation rules, as in my original rough idea. But I do think we have enough different quotish contexts already. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v1) Selective interpolation in single quotish context.
On Thu, Sep 14, 2000 at 06:17:07PM -0400, Mark-Jason Dominus wrote: One could for example have a pragma to *really* tag variables lexically to be expanded within singlequotes. Or a pragma that simply changes the semantics of q{...} so that it has the proposed feature for the rest of the scope of the current block. Yes, that actually makes more sense because with my pragma idea up there the variable would always be expanded, which may be bad if one wants to do things like: '$foo = $$foo' -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v2) Selective interpolation in single quotish context.
On Thu, Sep 14, 2000 at 10:01:23PM -0400, Jerrad Pierce wrote: What's wrong with extending current syntax such that: Please read the discussion so far. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v2) Selective interpolation in single quotish context.
Hang on... \I \E amounts to the same number of characters as using '. .' (that is, terminating this q-string, concat the thing, start a new q-string) So for scalars, there would be no savings at all. For arrays, yes, the proposed \I \E would still be useful. Maybe the \I should just scan for the following scalar/array var name and automatically turn itself off again. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 226 (v2) Selective interpolation in single quotish context.
On Fri, Sep 15, 2000 at 01:56:39PM +1100, Damian Conway wrote: Hang on... \I \E amounts to the same number of characters as using '. .' (that is, terminating this q-string, concat the thing, start a new q-string) You can't do that in a 'HERE' doc. True. For arrays, yes, the proposed \I \E would still be useful. Maybe the \I should just scan for the following scalar/array var name and automatically turn itself off again. No thanks. Suppose I want: '$x = $a; $y = func(\I$arg1, $arg2, $arg3\E); Hmmm...should \Ifunc($arg1)\E be replaced by the return value of func($arg1)? #etc. ' Unless it scans ahead and if it fails to find a \E, then it turns itself off after the first interpolation :-) :-) Also true. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: Conversion of undef() to string user overridable for easy debugging
On Wed, Sep 13, 2000 at 10:49:41PM +0200, Bart Lateur wrote: Imagine the following scenario: your script contains a doiuble-quotish 40 line here-doc, with a bunch of variables in it. Unforetunately, you forgot to set one, and you get the not so helpful complaint: use of unitialized value at line xxx where xxx is the line number for the line that contains the "" for the here doc. Now, what variable was it? Happy hunting! This reminds me of a related but rather opposite desire I have had more than once: a quotish context that would be otherwise like q() but with some minimal extra typing I could mark a scalar or an array to be expanded as in qq(). For example doubling the $ and @? $$foo, @@bar? This comes in handy when you are generating big blocks of code on the fly but only tiny parts of it needs to be interpolated. Unfortunately the margin of my monitor is not enough to describe this wonderful idea in a form of a RFC. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b (RFC 199)
On Mon, Sep 11, 2000 at 05:31:33PM -0400, 'John Porter' wrote: Garrett Goebel wrote: I'd be surprised if sub mygrep (@) { my ($coderef, @list, @stack) = @_; $coderef and push(@stack, $_) foreach (@list); return @stack; } @a = mygrep { return ($_ = 2) ? 1 : 0 } (1, 2, 3, 2, 1); print "\@a = @a\n"; Resulted in: @a = Instead of the current Perl 5: @a = 1 2 2 1 Yes! *Exactly* my point! Blocks should quack the same whether I pass them to the built-in grep or to my own sub; i.e. they're anonymous subs, not some magico-special "looping" blocks. Allow me to repeat: instead of trying to shoehorn (or piledrive) new semantics onto existing keywords/syntax, let's create something new. The blocks of grep/map/... are special. They are not quite looping blocks, they are not quite sub blocks, they are different. Well, to be frank they are just very plain, ordinary, blocks that return their last value, but if we want to introduce both flow control (short-circuiting) and as a derived requirement, a return value (was the last test a success or a failure), they definitely begin to become not your ordinary blocks. I do not think the existing arsenal of keywords/syntax is enough to cover all the behaviour we are after. The 'pass' keyword someone suggested has potential (when combined with allowing last -- and next -- to work on these mongrel blocks). -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: XML/HTML-specific ? and ? operators? (was Re: RFC 145 (alternate approach))
On Thu, Sep 07, 2000 at 03:42:01PM -0400, Eric Roode wrote: Richard Proctor wrote: I think what is needed is something along the line of : $re = qz{ '(' \$re ')' | \$re \$re | [^()]+ }; Where qz is some hypothetical new quoting syntax Well, we currently have qr{}, and ??{} does something like your \$re. Warning: radical ideas ahead. What would be useful, would be to leave REs the hell alone; they're great as-is, and are only getting hairier and hairier. What would be useful, would be to create a new non-regular pattern-matching/parsing "language" within Perl, that combines the best of Perl REs, lex, SNOBOL, Icon, state machines, and what have you. Agreed. "Yet another quoting construct", "yet another \construct", "yet another (? construct". Argh, please, no. Make all the above and all we've learned from Parse::RecDescent et alia to collide at light speed and see what new cool particles will spring forth. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b
On Thu, Sep 07, 2000 at 10:05:58PM +0200, Bart Lateur wrote: On Fri, 8 Sep 2000 05:59:02 +1100 (EST), Damian Conway wrote: But it makes "short-circuit as soon as Cgrep lets through a specific value" ugly: my $seen; $has_odd_elem = grep { $seen last; $_%2 ++$seen } @numbers; Not just ugly. Useless. How about using 'return', then? That could, ahem, return both true and false values. Yes, that does have semantics now...but can someone with a straight face confess to having used that, e.g. sub ... { ... grep { ... return; } ... } -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b
I would propose that the Cgrep operation should short-circuit if the block throws an exception, with the value of the expection determining whether the final invocation of the block should accept the element it was filtering: Otherwise nice but until now die() has been a serious thing, now it's being downgraded to "oh, well, never mind (the rest)" status... -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b
Exactly the sort of chicanery grep/last is meant to avoid. So the question becomes, how do we crowbar "last" in without altering the returned value in Cmap blocks. I'm for putting it after a comma. Which matches the syntax of John Porter's proposal about internally converting the block to a subroutine. Maybe it's simply time to give up trying to bend existing semantics and think of a new flow control keyword? -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: XML/HTML-specific ? and ? operators? (was Re: RFC 145 (alternate approach))
On Wed, Sep 06, 2000 at 03:47:57PM -0700, Randal L. Schwartz wrote: "Mark-Jason" == Mark-Jason Dominus [EMAIL PROTECTED] writes: Mark-Jason I have some ideas about how to do this, and I will try to Mark-Jason write up an RFC this week. "You want Icon, you know where to find it..." :) Hey, it's one of the few languages we haven't yet stolen a neat feature or few from... (I don't really count the few regex thingies as full-fledged stealing, more like an experimental sleight-of-hand.) But yes, a way that allows programmatic backtracking sort of "inside out" from a regex would be nice. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b
On Wed, Sep 06, 2000 at 09:43:03AM -0500, Garrett Goebel wrote: From: Jonas Liljegren [mailto:[EMAIL PROTECTED]] Does any other RFC give the equivalent to an 'in' operator? I have a couple of times noticed that beginners in programming want to write if( $a eq ($b or $c or $d)){...} and expects it to mean if( $a eq $b or $a eq $c or $a eq $d ){...}. I think it's a natural human reaction to not be repetative. An 'in' operator will help here. It could be something like this: $a in @b; # Has @b any element exactly the same as $a $a == in @b; # Is any element numericaly the same as $a $a eq in @b; $a in @b; # Is $a bigger than any element in @b? $a not in @b; # Yes. Make 'not' context dependent modifier for in. grep { ref($a) eq ref($b) } @b) # Same type? grep { $a == $_ } @b) grep { $a eq $_ } @b) grep { $a $_ } @b) (grep { $a != $_ } @b) == @b) grep { $_ == 1 } 1..1_000_000 grep doesn't short-circuit. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: $a in @b
On Wed, Sep 06, 2000 at 09:46:13AM -0600, Tom Christiansen wrote: grep { $_ == 1 } 1..1_000_000 grep doesn't short-circuit. I never did figure out why "last" {w,sh,c}ouldn't be made to do that very thing. Agreed, that would be very natural. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 194 (v1) Standardise Function Pre- and Post-Handling
On Thu, Sep 07, 2000 at 06:28:25AM +1100, Damian Conway wrote: I should have an RFC out on this by next week. Feel free to hijack and/or infiltrate my RFC. Damian -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 177 (v1) A Natural Syntax Extension For Chained References
On Wed, Aug 30, 2000 at 11:10:54AM -0400, John Porter wrote: Snatch two syntax constructs away from the jaws of illegal syntax and an unfortunate syntax, and make them useful weapons of the Perl arsenal. The constructs are: $ref-[[LIST]] $ref-{{LIST}} The proposed respective meanings: $ref-[$elem[0]]-[$elem[1]}-[...]-[$elem[-1]] $ref-{$elem[0]}-{$elem[1]}-{...}-{$elem[-1]} By saying $hashref-{[LIST]} instead of $hashref-{{LIST}}, the only thing you would change is the semantics of the expression, Huh? Unless I missed something I didn't propose using $hashref-{[]} anywhere... I used $ref-{{LIST}} and $ref-[[LIST]]. not the [il]legality. -{{ *is* illegal now. -- John Porter We're building the house of the future together. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 151 (v1) Merge C$!, C$^E, and C$@
: That numerical part could then form the basis of the extended exception : mechanism. No, the programmer shouldn't memorize the error numbers: : there should be predefined constants, like : : ERROR::filenotfound : : which are numeric, and which could then be used for the catch switch. : Well, maybe drop the "ERROR::" part for brevity -- but not for clarity. I think I agree with the folks that say errors should be caught by type, not by number. Just as a for instance, you ought to able to write a simple handler that catches any ERRNO-style error. Yup. Enumerating errors/warnings is awkward because it says you know beforehand all your possible errors/warnings. It is very static and non-extensible--having to recompile your Perl if you add/delete/change errors/warnings isn't exactly dynamic. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen
Re: RFC 140 (v1) One Should Not Get Away With Ignoring System Call Errors
On Thu, Aug 24, 2000 at 02:09:15PM -0400, Chaim Frenkel wrote: "JH" == Jarkko Hietaniemi [EMAIL PROTECTED] writes: JH "The first operation done on the return value of open() shall be defined() JH or you shall regret your pitiful existence."? (a flag on the scalar coming JH from open that makes any other op than defined() to die and defined() clears JH the flag) Ala, taint? Except the variable is tainted with death? Yes, sort of. "Touch me and I'll bring you down." Hmm, this would make two types of undef. Actually, if a callee could (Not really undef, boolean, see Tom's reply). But in either case not a problem since the user should have no explicit means of telling the kinds part nor certainly ways of changing the kind. But the drawback would be that the actual victim may not be the primal cause. sub foo { my $fh = open(); ... Lots more code ... return $fh; } $victim = foo; print $victim "I'm helpless"; Tough. -- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen