Re: Perl, the new generation
On Fri 11 May 2001 16:31, Michael G Schwern <[EMAIL PROTECTED]> wrote: > On Fri, May 11, 2001 at 01:55:42AM +0100, Graham Barr wrote: > > On Thu, May 10, 2001 at 07:40:04PM -0500, Jarkko Hietaniemi wrote: > > > By far most of my use of typeglobs is making aliases, and then mostly > > > for code: > > > > > > *color = \&colour; > > > > I would say that probably the most common use now for typeglobs is > > from the IO:: modules. Which are created with gensym so they are > > anonymous. > > Personally, I use typeglobs mostly to autogenerate repetitive methods > without an autoloader: > > *method = $closure; > > but this should definately have a direct analogy in Perl 6 so I'm not > worried. I use it to check if formats exist, since there is no other way to do so (except maybe an eval that dies :(): if (defined *{$::{$fmt}}{FORMAT}) { local $~ = $fmt; write; } but for perl6 it doesn't matter, cause formats will die anyway (even without an eval :) -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 629 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11. Smoking perl CORE: [EMAIL PROTECTED] http:[EMAIL PROTECTED]/ [EMAIL PROTECTED] send smoke reports to: [EMAIL PROTECTED], QA: http://qa.perl.org
Re: Please make "last" work in "grep"
On Wed, 2 May 2001 08:05:29 -0700 (PDT), Larry Wall <[EMAIL PROTECTED]> wrote: > Michael G Schwern writes: > : (grep {...} @stuff)[0] will work, but its inelegant. > > It's inelegant only because the slice doesn't know how to tell the > iterator it only needs one value. If it did know, you'd call it > elegant. :-) IIRC, that optimization is not even considered for reasons of many people wanting the side effects of grep/map finishing over all elements (which could of course be from a tied array or database connection) -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Postfix "!"
On Mon, 23 Apr 2001 14:57:50 +0200, Davíð Helgason <[EMAIL PROTECTED]> wrote: > "H.Merijn Brand" wrote: > > > > On Mon, 23 Apr 2001 13:22:54 +0100, Simon Cozens <[EMAIL PROTECTED]> wrote: > > > If postfix "!" was up for grabs - which it probably isn't - what would > > > you do with it? > > > > > > One interesting suggestion was to have it as a shorthand for assertion: > > > > > > sub foo { > > > (@_ > 0)!; > > > ... > > > } > > > > > > (Or even have ! be a valid statement terminator, so "(@_>0)!" would work.) > > > > > > Or you could have it doing something to variables: $a = $b! + $c; > > > (But what?) > > > > > > Fun, eh? > > > > DWIM would be "faculty" > > yeah, but kinda useless unless when teaching (with) perl. > > What about assert (and having just written that, I notice that is > exactly what Cozens suggested So it must be a good idea)? > > > I like it. > > When do we get to use unicode operators? (inverse question and > exclamation marks!!!) I'd personally like to see the plusminus, both as operator and as leading parameter mark ;-P if ($a ± $b) { ±c = 1; } meaning if $a is near to $b (almost the same being defined by $±) -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Tying & Overloading
On Mon, 23 Apr 2001 13:02:50 +0100, Simon Cozens <[EMAIL PROTECTED]> wrote: > On Mon, Apr 23, 2001 at 01:49:36PM +0200, Dav?? Helgason wrote: > > This wouldn't mean that anyone is thinking of getting us object > > dot-syntax, now would it? > > > > > After giving it a thought, it seems that it can _mostly_ be > > disambiguated from the concatenation operator. Whatever mostly means. > > Or we change the concatenation operator. > > $a = $b & $c; # Do people really use Perl for bit fiddling? ABSOLUTELY! Ever done vec? It's even well documented what stringwise & should do. (Though I have to admit it's not DWIM) > $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).) -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Postfix "!"
On Mon, 23 Apr 2001 13:22:54 +0100, Simon Cozens <[EMAIL PROTECTED]> wrote: > If postfix "!" was up for grabs - which it probably isn't - what would > you do with it? > > One interesting suggestion was to have it as a shorthand for assertion: > > sub foo { > (@_ > 0)!; > ... > } > > (Or even have ! be a valid statement terminator, so "(@_>0)!" would work.) > > Or you could have it doing something to variables: $a = $b! + $c; > (But what?) > > Fun, eh? DWIM would be "faculty" -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Tying & Overloading
On Mon, 23 Apr 2001 13:19:24 +0100, Graham Barr <[EMAIL PROTECTED]> wrote: > > $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).) > > I am not sure I do like the use of ~ here. It does not screan concatenate > to me (but then again neither did . when I started perl) > > I am thinking that maybe it should be a 2 character operator with at > least one of then being + as + is common in many other languages > for doing concatenation. like ++ ? we have ** already for exponents -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Larry's Apocalypse 1
On Mon, 16 Apr 2001 10:29:41 PDT, Jeff Okamoto <[EMAIL PROTECTED]> wrote: > > The > > timescales of corporations like Sun are not the same as those commonly > > encountered in the open software arena. > > Ditto for HP. Which is more extreme (HP9000/L1000, HP-UX 11.00 + March 2001 patches): % /usr/contrib/bin/perl -v This is perl, version 4.0 $RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $ Patch level: 36 Copyright (c) 1989, 1990, 1991, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 4.0 source kit. % > Jeff -- H.Merijn BrandAmsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Perl culture, perl readabillity
On Thu, 29 Mar 2001 06:53:49 +0200, Otto Wyss <[EMAIL PROTECTED]> wrote: > > - Make readability your main objective. Readability is possibly the > > weakest part of Perl. > > > > - Keep your eyes on modularity. Modularity is by far the best concept > > where complexity could be hidden. > > > > - Don't forget usability. This is after all the point why people use > > Perl in the first place. > > > It seems you are not interested in critics, so lets end this thread. Au contraire. The Perl community is *very* much interested in critiques. Seen the amount of response to you starting mail, this is overwhelming. One thing you probably `missed' in this discussion, is the way /you/ look at the language. Writing to the perl community, you're writing to people that got used to the syntax and now see the logic and usability of the 'line noise' you call unreadable. Every language has got it's pros and cons. Perl's first usage for most of us is probably it's glue function and versability. When you program/script in perl for a few weeks/month/years, you'll get used to it, and you're going to like it and probably even appreciate it. I started using perl in my company after reading an article in Unix-Info (a dutch magazine) that stated that perl would do well as an awk, grep and sed replacement, and that rose my curiosity. All those utils on unix have their own syntax, and you don't tell me that sed, awk and grep based scripts are readable/maintainable, esp. if there's a lot of programmers involved in setting up the lot. Perl being a fine replacement for it, has now 'conquered' this company. We almost never ever use shell scripts anymore, and there's not many left that know how to write awk and sed scripts. One syntax will do. In the beginning we wrote Perl scripts that called external SQL scripts, which now are converted to DBI/DBD. Perl's glue function saves time. A reason to postpone using DBD was that our database was not (yet) implemented by someone, so I had to write it myself. Now the world has access to yet another Database interface for perl through CPAN, yat another *BIG* advantage of the perl community: they /share/ the knowledge. If you want code that is readable by *all* your (even unexperienced) programmers and want to keep it maintainable, feel free to use python, but if you want to grow the program into more flexible use, extend it later to use yet another database, interface or character encoding, I think you should hop over the initial line noise and just *USE* perl. If you do, I'd like to hear your experience half a year from now. Have the appropriate amount of fun (in whatever language)! -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2 AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Perl culture, perl readabillity
On Fri, 23 Mar 2001 23:34:41 +0100, Otto Wyss <[EMAIL PROTECTED]> wrote: > A study in Science (291 P.2165) found out that english speaking children > has twice as much reading problems as italian speaking children of the > same age. And about similar difference towards german and french. This > could come from the fact that english has for 40 phonetics over 1100 > kinds of writing while italian has for 25 phonetics only 33 kinds of > writing (sorry I hope I've translated it into correct terms). Also 9 > years old english children produce more reading error than 7 years old > austrian children. It's also more *fun* to express your thoughts/feelings in English or Perl than in speech impediments like french, italian or python I *do* like things like my $sth = $dbh->prepare ("insert into $table values (@{[('?')x@f]})"; ;-) BTW. I realy like Schwietserdeutch, also more fun than German. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2 AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: perl6-language needs admin help too :)
On Thu, 15 Feb 2001 15:23:52 +, Simon Cozens <[EMAIL PROTECTED]> wrote: > On Thu, Feb 15, 2001 at 09:57:13AM -0500, Kirrily Skud Robert wrote: > > Would anyone like to volunteer to do weekly summaries > > Well, don't forget that I *do* have people helping me out with the weekly > summaries. I don't know how people want to play this. Do you want: > > * One weekly summary of everything (You're getting this, like it or not. :) > * One weekly summary of each list > * One weekly summary of each list feeding into a weekly summary of > everything > * Something else? perl6-summaries (please ;-) -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2 AIX 4.3, WinNT 4.0 SP-6a, and Win2000pro often with Tk800.022 &/| DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 288 (v2) First-Class CGI Support
On 27 Sep 2000 07:36:42 -, Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > This and other RFCs are available on the web at > http://dev.perl.org/rfc/ > > =head1 TITLE > > First-Class CGI Support Freezing within two days doesn't leave much space for comments and or objections does it? I'm not against making things easier in general, but I don't want perl to be Just Another Web Service. I've started an RFC on that when perl6 just started, but I saw discussions take a good direction, so I didn't post it. I think this one belongs in perl6-stdlib, certainly not in the perl6-core! I've lost my RFC draft, but it's title was: No JAWS -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.7.1 & 516 on HP-UX 10.20 & 11.00, AIX 4.2 & 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 263 (v1) Add null() keyword and fundamental data type
On 20 Sep 2000 04:12:09 -, Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > =head1 TITLE > > Add null() keyword and fundamental data type > > =head1 MIGRATION > > None. New functionality. Not true. Apart from the discussion if undef is the same as null, in which I take no stance, Migration *is* an issue, cause if the null state is available, DBI/DBD users *will* expect that NULL values from the database are yielded as null values in perl and not as undef, the way it is implemented now. Same when inserting data. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.7.1 & 516 on HP-UX 10.20 & 11.00, AIX 4.2 & 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: Pre-withdrawal notice for RFC184
On 19 Sep 2000 09:23:00 +0300, Ariel Scolnicov <[EMAIL PROTECTED]> wrote: > > I'm planning to withdraw RFC184 ("Perl should support an interactive > mode"), due to lack of interest. There was little discussion of it, > and the consensus seemed to be that C is "good enough" for > most purposes, and C for all others. While I do not agree, it > does mean there is no call for this RFC. > > Unless I hear otherwise from people interested in the RFC, I shall be > withdrawing it Friday. Though I realy like the idea, and probably would use it if it were available, my need for it was not compelling enough to participate in the discussion. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.7.1 & 516 on HP-UX 10.20 & 11.00, AIX 4.2 & 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 252 (v1) Interpolation of subroutines
On Mon, 18 Sep 2000 01:22:31 -0600, Tom Christiansen <[EMAIL PROTECTED]> wrote: > Surely the next request will be to make anything that works outside > of quotes work inside of them, completely erasing the useful visual > distinction. Why should operators, after all, be any different > from functions? > > print "I have Fooey->fright($n) frobbles.\n"; > print "I have &snaggle($n) frobbles.\n"; > print "I have abs($n) frobbles.\n"; > print "I have $x+$y frobbles.\n"; You've just entered the twilight zone. These are very good examples of 'where do we stop?' DWIM-like I'd expect (as a newbe) that the first two example would work and the last two won't. As a long(er)-time user I immediatly say they won't (all of them). In the outskirts of nowhere on the ringroad to somewhere on the verge of indecision i allways take the roundabout way -- marillion -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.7.1 & 516 on HP-UX 10.20 & 11.00, AIX 4.2 & 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 230 (v1) Replace C built-in with pragmatically-inducedC function
On Fri, 15 Sep 2000 20:13:34 -0700, Nathan Wiger <[EMAIL PROTECTED]> wrote: > > I loathe the indirect object syntax. > > Well that makes one of us! ;-) > > > Easy. Put them in a subroutine: > > > > sub format1 { format $template1, @data }; > > sub format2 { print STDERR format $template1, @data }; > > # etc. > > Gag! Cough! Ack! :-} > > Not trying to be mean, but this doesn't make things easy. As I mentioned > in my previous email, being able to say: > >write STDOUT; If write is to accept arguments, the format specifier should be the first. If you are writing a report to the current filehandle - the way perl5 implements it - the thing that is changing most is the format (reports build out of several different blocks) not the file handle. If you wanna change the filehandle, use the 'print filehandle format ...' syntax. > is a *benefit*. It seems your proposal is 90% of the way there if it > just followed suit with the other commonly-used printing functions: > >print $STDERR @stuff; >printf $STDERR $fmt, @stuff; >format $STDERR $fmt, @stuff; print $STDERR format $fmt, @stuff would be my choice. > Looks pretty consistent to me, and makes things easy too. Though I could live with both. > Either that, or drop the printing in a void context altogether, and just > tell people they have to say > >print format $fmt, @stuff; Early brain-dump. This should be it. > Which I'm ok with too. But partially supporting printing, only to the > default filehandle, I don't think is a good idea. You're gonna end up > with lots of nasty code that way, which this RFC would otherwise > prevent. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl-5.005.03, 5.6.0, 5.7.1 & 516 on HP-UX 10.20 & 11.00, AIX 4.2 & 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 216 (v1) POD should tolerate white space.
On Wed, 13 Sep 2000 10:58:51 -0400, John Porter <[EMAIL PROTECTED]> wrote: > H.Merijn Brand wrote: > > Are we being clever again? > > Rephrase: "No empty lines". > > I know you understood, but ... (no, I won't say it) > > Frankly, I thought it was absurd when I first wrote it... > but then I looked at again, and now I'm not so sure I dislike it! > > =head1 CHANGES > =over 4 > =item * Detailed implementation description > =item * Add a new pragma 'varlock' for controlling the concurrency control. > =back 4 > =head1 DESCRIPTION > > Looks transparent to me! Cool. Now someone has to write podlators that do not depend on $/ = ""; But it looks nice for a short piece of proza, but will it still be workable when: =head1 CHANGES =over 4 =item * Detailed ... This is some text describing this point into such detail that it extends more than one line. this text would be dealt with as pre-formatted in older podlators. What would it be now? =item * Next piece of info etc. You get the drift. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 216 (v1) POD should tolerate white space.
On Wed, 13 Sep 2000 10:19:38 -0400, John Porter <[EMAIL PROTECTED]> wrote: > H.Merijn Brand wrote: > > On 13 Sep 2000 07:18:15 -, Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > > > This and other RFCs are available on the web at > > > http://dev.perl.org/rfc/ > > > > > > =head1 TITLE > > > > > > POD should tolerate white space. > > > > I don't want any newlines needed at all, though I think I stand somewhat alone > > here. > > No newlines at all? That means you could write > > =head1 CHANGES =over 4 =item * Detailed implementation description =item * Add a new >pragma 'varlock' for controlling the concurrency control. =back 4 =head1 DESCRIPTION > > for you example. Are we being clever again? Rephrase: "No empty lines". I know you understood, but ... (no, I won't say it) -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 216 (v1) POD should tolerate white space.
On 13 Sep 2000 07:18:15 -, Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > This and other RFCs are available on the web at > http://dev.perl.org/rfc/ > > =head1 TITLE > > POD should tolerate white space. I don't want any newlines needed at all, though I think I stand somewhat alone here. I don't like the emty space on my screen when I have to do things like (cut from see RFC 130): | |=head1 CHANGES | |=over 4 | |=item * | |Detailed implementation description | |=item * | |Add a new pragma 'varlock' for controlling the concurrency control. | |=back 4 | |=head1 DESCRIPTION | Where's the info? There's to much empty lines in there! One has to search for the info. It better be written as (be able to): |=head1 CHANGES | |=over 4 |=item * |Detailed implementation description | |=item * |Add a new pragma 'varlock' for controlling the concurrency control. | |=back 4 | |=head1 DESCRIPTION Or for the real compression freaks, no empty lines at all. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: sort syntax
On Thu, 07 Sep 2000 13:44:10 +0200, "H.Merijn Brand" <[EMAIL PROTECTED]> wrote: > Having no time to write and/or maintain RFC's, I'll toss this up in the air > and see what happens. [ snip ] > my $Ycmp = sub { $a cmp $b }; > @a = sort $Ycmp @x; > > but this is an unsupported syntax for sort. No it is :-) (I was lost in focus after fork, D'uh) > Is it feasable/useful to extend sort's syntax in supporting sub ref's? Consider previous mail never sent -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: switch s/statement/operator/
On Tue, 29 Aug 2000 16:41:41 -0600, Tom Christiansen <[EMAIL PROTECTED]> wrote: > I've actually even used this at run-time, such as: > > $value = { > azure => 0xF0, > chartreuse => 0x7FFF00, > lavender=> 0xE6E6FA, > magenta => 0xFF00FF, > turquoise => 0x40E0D0, > }->{ lc $user_color_preference } || 0x00; I've once reported a similar code snippet to be wrongly parsed if the first key was numerical. This was fixed by Larry, but broke something in map {}. It was something like: sub err_str ($) # give explanation of error code { return { 1 => "Error 1", 2 => "Eroor in error", : 9 => "Possible error", }->{$_[0]} || "unknown error $_[0]"; } # err_str Here you do not much care about efficiency, an error is not soething you wanna have a lot. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
sort syntax
Having no time to write and/or maintain RFC's, I'll toss this up in the air and see what happens. Abigail has posted sorting benchmarks for 5.6.0 to 5.7.0 on clp.misc, and I've extended that being curious to performance loss for anonymous blocks and named subroutines sub Xcmp { $a cmp $b } @a = sort @x; # Internal sorting @a = sort { $a cmp $b } @x; # sorting through block @a = sort Xcmp @x; # Sorting with named sub I've posted the results (stunning) to p5p and the Amsterdam.pm mailing lists for perl5.005.03, perl5.6.0 and perl5.7.0. Just out of curiopusity someone on amsterdam.pm asked: > > Which shows a *HUGE* difference between 5.005.03 and 5.6.0 for the diff > > between named subs (in 5.6.0 almost as fast as internal, sometimes even faster) > > and anonymous blocks (in 5.005.03 almost as slow as named subs). > > > > Whoosh, has 5.6.0 been some improvement in optimizing anonymous blocks! > > See, this is exactly the kind of thing I'm better off not knowing. Do > you think I'll be able to stop myself from using anonymous blocks given > how much faster they are? Nee, naturlijk. > > However I would argue that anonymous blocks are often a bad thing for > code maintenance. I don't have Algorithm::Numerical::Shuffle handy - > do you think I could convince you to run this benchmark again using > subroutine references? > > That is: > > my $Ycmp = { $a cmp $b }; > > I'm just curious. She meant of course: my $Ycmp = sub { $a cmp $b }; @a = sort $Ycmp @x; but this is an unsupported syntax for sort. Is it feasable/useful to extend sort's syntax in supporting sub ref's? -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC 111 (v3) Here Docs Terminators (Was Whitespace and Here Docs)
On 4 Sep 2000 21:32:00 -, Perl6 RFC Librarian <[EMAIL PROTECTED]> wrote: > This and other RFCs are available on the web at > http://dev.perl.org/rfc/ > > =head1TITLE > > Here Docs Terminators (Was Whitespace and Here Docs) [...] > =head1 IMPLENTATION Intentional? It's either 'IMPLANTATION', which is something that has to be done with Damian's brain into the perl6-core, so every operator is DWIM, or 'IMPLEMENTATION', something you seem to be describing here. Just nitpicking. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC: Highlander Variables
On Wed, 2 Aug 2000 13:03:51 -0400, John Porter <[EMAIL PROTECTED]> wrote: > Randal L. Schwartz wrote: > : > > I don't see a teaching advantage in saying "the three variable > > namespaces are all one, but all the other namespaces are distinct". > > When the rule gets longer, it gets harder to teach. And if it's > > harder to teach, it's probably harder to learn. > > Here's a simple rule: all symbols must be unique*, regardless of > "type". It's a rule that most other languages have. But perl's not any other language. Perl's fun. most other languages are not. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC: Highlander Variables
On Wed, 2 Aug 2000 12:29:41 -0400, John Porter <[EMAIL PROTECTED]> wrote: > H.Merijn Brand wrote: > > > > If I could, I would VETO! > > If I could, I would mandate this change. This is definitely in my > Top 10 List of Perl 5 Suckinesses. So here we differ. That's what discussions are for. > > This would break about 90% of my scripts. > > Some large percentage of your scripts is going to break anyway. Hope not. I have grown a habit of pretty clean programming, using -w and use strict all the way. > > I use the same name for different > > type of variables to group them: > > Imho, this is A Bad Practice. Making it impossible would therefore > be Good, existing-script-breakage not withstanding. I think you cannot say "A bad practice". It's a way of thinking. I'm glad Tom's with me on this, except that he refers to global variables that might be deemed anyway. We're not thinking like in C where every variable `should' be prefixed with it's type, like p_var for a pointer to a variable or t_var for defining the type for var. In perl I just LOVE the way $, @, % and & unambiguously defines the type of the var. I just miss a prefix for formats (which will be dropped anyway) and IO. I'd hate to see my code being converted to (as suggested): $foo__array = qw(monday tuesday wednesday thursday friday saturday sunday); $foo = 4; print $foo__array[$foo], "\n"; YUK! -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Re: RFC: Highlander Variables
On Wed, 2 Aug 2000 16:32:40 +0100 (BST), Andy Wardley <[EMAIL PROTECTED]> wrote: > > =head1 TITLE > > Highlander Variables > > =head1 VERSION > > Maintainer: Andy Wardley <[EMAIL PROTECTED]> > Date: 01 Aug 2000 > Version: 1.0 > Mailing List: perl6-language > Number: TBA > > =head1 ABSTRACT > > Perl5 supports three distinct variable types for any given variable > name corresponding to a scalar (C<$var>), array (C<@var>) and hash > (C<%var>). This RFC proposes that only one type of variable should be > defined for any given name. Where an array or hash is defined > (C<@var> or C<%var>), the equivalent scalar value (C<$var>) would be > an implicit reference to that array or hash array. This would permit > the rationalisation and simplification of the syntax required to > access individual elements or slices of arrays and hash arrays, while > remaining backwardly compatible with Perl5 syntax. The only > semantic difference would be that scripts could no longer rely on > C<$var>, C<%var> and C<@var> referencing different variables. If I could, I would VETO! This would break about 90% of my scripts. I use the same name for different type of variables to group them: @foo = qw(monday tuesday wednesday thursday friday saturday sunday); $foo = 4; print $foo[$foo], "\n"; Just a silly example. -- H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/) using perl5.005.03, 5.6.0 & 516 on HP-UX 10.20, HP-UX 11.00, AIX 4.2, AIX 4.3, DEC OSF/1 4.0 and WinNT 4.0 SP-6a, often with Tk800.022 and/or DBD-Unify ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/