Re: renaming grep to where
Smylers == Smylers [EMAIL PROTECTED] writes: Smylers No: no aliases. Perl does not have a tradition of these, except for/foreach. :) But I agree with the rest of your position. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Nested statement modifiers.
Paul == Paul Seamons [EMAIL PROTECTED] writes: Paul I don't know what the reasoning was back then and it may be the same today. From my early conversations with Larry, I recall that the reason is that RSTS/E BASIC-PLUS had nested trailing modifiers, and both Larry and I saw many abuses of these over the years. Therefore, he decided not to repeat that abomination, limiting it to precisely one level deep. I'm happy for that. Yeah, every once in a while, I've wanted the second layer, but I'm willing to rewrite the statement as a true normal if/while instead of a backwards if/while, and it *does* help the overall readability. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
S02 - s/environmental variables/environment variables/g please
Please, let us agree to use the traditional name of environment variables in the docs, and not re-introduce its bastardized cousin, which hurts my ears. Thanks. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: handling undef better
Uri == Uri Guttman [EMAIL PROTECTED] writes: Uri sorting in p6 is not at all like in p5. instead of coding up an explicit Uri comparison code block and duplicating all the key access code (for $a Uri and $b), you will specify how to extract/generate each key for a given Uri record. this new syntax was posted by damian (who else) and it is very Uri similar to the api in my p5 module sort::maker (we did discuss this Uri api). i don't know if any A/E/S doc covers it but it is definitely in Uri the archives. I hope the old (perl5) way is still available as well. There are times when parts of the comparison should be done lazily. Consider two objects that have a value for a primary sorting order, but only for those which the value is the same, we fall back to a secondary sort key that is expensive to compute (like maybe calling a database). For these scenarios, specifying the sort comparison will be simpler and cheaper than specifying the sort key. So, we need both, but if we get only one, the Perl5 way is superior. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: handling undef better
Uri == Uri Guttman [EMAIL PROTECTED] writes: Uri i will let damian handle this one (if he sees it). but an idea would be Uri to allow some form ofkey extraction via a closure with lazy evaluation Uri of the secondary (and slower) key. I still don't see that. I understand about the lazy key evaluation. However, the sort block in Perl5 contains more than just two key computations: it also contains the logic to decide *how* to compare the keys, and *when* more information is needed (a secondary key step, for example). Not sure how you're going to replace that with just information about how to compute a key. I think you've had your head inside GRT for too long. :) So, for the simple case (string sort against some function of each item), I can see the need for a good shortcut. However, the general case (let me tell you how to sort two items), you'll still need a very perl5-ish interface. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
execution platform object? gestalt?
With the recent realization of the beginnings of a PIL-Javascript emitter, it appears that my Perl6 program can run in a bizarre mix of execution environments. Forgive me if I missed this while trying to skim through the unearthly number of perl6 messages so far, but... It'd be nice if there was one central object that represented the execution platform, with various methods based on the capabilities. For example, this object, call it $*OS, could be queried to see if we can get a native Javascript class (true only when running on a JSplatform): if $*OS.can(get_javascript_class) { # I'm running on a js platform my $main_window = $*OS.get_javascript_class(Window).main; ... } The point would be to have one object that would understand the platform dependent parts, and have a consistent naming for the methods that are used by that object as the execution platform varies. This is similar to the OS-9's gestalt tables, which got smarter as the operating system had more features, but was a consistent way to ask do we have a color monitor here?. Is something like this already planned? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: reduce metaoperator on an empty list
Mark == Mark A Biggar [EMAIL PROTECTED] writes: Mark The usual definition of reduce in most languages that support it, is Mark that reduce over the empty list produces the Identity value for the Mark operation. In Smalltalk, the equivalent of reduce is inject:into:, so a sum reduce looks like: sum := aList inject: 0 into: [:previous :this | previous + this] Now the advantage here is that if aList is empty, we get back the inject value. Thus, the behavior is always well-defined. The Perl reduce operator treats the first element of the list as the inject value above. However, if the first element is missing, the most Perlish thing I can think of is having it return undef, because it's like you've specified an undef inject value. I'd also argue that we could provide .inject_into, to make Smalltalkers happy to always spell out the initial value and codeblock, instead of relying on the first element of the list for the initial value. For example, if I wanted the identity hash (where all values are 1, but keys are original list elements), I could do: my %hash = @somelist.inject({}, { $^a{$^b} = 1; $^a }); That'd be Way Cool. Once you get your head around inject, you never want to go back to reduce. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Definitive and Complete Perl 6 Operator List
Larry == Larry Wall [EMAIL PROTECTED] writes: Larry The shifts are all X rather than X to avoid confusion with Texas Quotes. I've been staring too much at POD lately. I saw both of those as very broken pod-start marks. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Lexing requires execution (was Re: Will _anything_ be able to truly parse and understand perl?)
Luke == Luke Palmer [EMAIL PROTECTED] writes: Luke But you don't really need to parse to syntax highlight, either. You Luke just need to tokenize. Unfortunately, to tokenize, you also have to know the state of the parse. As long as / is both divide and begin regex, you're toasted. Please see my long post at on parsing perl in perlmonks at http://www.perlmonks.org/index.pl?node_id=44722 for examples of *why* you need to notice whether you have a divide or a regex match. Perl is fundamentally resistant to lexing. As in the beginning of this thread, one of the RFCs suggested the possibility of making Perl lexable, but apparently the designers said no, we think the / duality is worth keeping. And that seals the fate for Perl6 just like all Perl before it. To properly lex a Perl program (Perl6 included), you *must* execute BEGIN blocks. That's the end of that tune. Anything else is just an approximation. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Lexing requires execution (was Re: Will _anything_ be able to truly parse and understand perl?)
Matthew == Matthew Walton [EMAIL PROTECTED] writes: Matthew So you're saying that in Perl 6 it will be entirely impossible to Matthew determine if / appears as the division operator or as the beginning of Matthew a regex from a purely syntactic examination of the source code? Yes. Matthew I'm finding that very, very hard to believe. Regexps aren't valid Matthew where /-the-operator is, after all. And that's precisely why Perl can work as it does. If an operator is expected, / is divide. If a term is expected, / is the beginning of a regex. This has been true since Perl1 (maybe 0). There are a few other characters that also work similarly, but / is the most frequent and most troublesome. And it got worse for Perl5, because of user-defined prototypes, which as far as I can tell, are still present in Perl6. Matthew Please correct me if I'm wrong, but I've got the impression that Perl Matthew 6 is tokenisable without requiring BEGIN blocks to be run - provided Matthew no grammars which the tokeniser doesn't already know about are used, Matthew of course, that one will never be avoidable. Your impression is wrong. In the presence of user-defined prototypes, you *must* execute the code that might alter a prototype in order to determine whether / is a divide (and therefore standalone token) or the beginning of a regex (and therefore must locate the end of the regex to properly be a token). Please see the referenced perlmonks article. All the handwaving in the world won't fix this. As long as we have dual-natured characters like /, and user-defined prototypes, Perl cannot be lexed without also parsing, and therefore without also running BEGIN blocks. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Lexing requires execution (was Re: Will _anything_ be able to truly parse and understand perl?)
Matthew == Matthew Walton [EMAIL PROTECTED] writes: Matthew Perl 6 has formal parameters for subs, methods etc. I don't see any Matthew mention of Perl 5-style prototypes in S6, and I honestly can't see how Matthew they could possibly fit with formal parameters. Hopefully Larry or Matthew someone can clarify whether they still exist or not. As long as you can have a user-defined null-prototyped subroutine (one that doesn't need parens following), you have the problem. See the sin/time examples in the monk article, and then consider user-defined functions that have no args (like time) and those that do (like sin). Matthew The Perlmonks article throws up a lot of very nasty cases. Not knowing Matthew the entire current language definition by heart, I can't say this with Matthew absolutely certainty, but I retain the belief that Perl 6 is at least Matthew *easier* to deal with than Perl 5. I believe you have a false belief. I don't know anything in the new prototypes-which-became-full-formal-arguments that made it any *easier* to recognize the ending of a subroutine argument list without knowing its precise definition. In Perl6: sub no_args () { ... } sub list_args ([EMAIL PROTECTED]) { ... } no_args / # this is a divide list_args / # this is the start of a regex See, it's still there. :) Matthew It is also possible that telling the difference between /-as-divide Matthew and /-as-regex becomes much easier if lookahead is employed in the Matthew tokeniser. No, not possible at all. The entire rest of the program may be valid either way. You *must* know by the time you're done with /, or /-and-more. The rest of the code cannot be a hint. Again, see my article. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Compatibility with perl 5
Larry == Larry Wall [EMAIL PROTECTED] writes: Larry It would be a (roughly) zero growth option to simply Larry switch to :x syntax for command-line switches instead of -x syntax. Larry Any program that uses colon switches instead of minus switches would Larry then automatically be assumed to be in Perl 6. Boy, when Larry says I get the colon, he really had plans for it. :-) Perl8 will look like: :: : : :: :: ::: :; (note the semicolon line terminator, to be replaced by a colon in Perl9). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: backticks
Juerd == Juerd [EMAIL PROTECTED] writes: Juerd readpipe/qx/`` isn't used much. In all my @INC, only a handful of uses Juerd can be found. Most are in Debian's modules. That's because they aren't particularly interesting in modules, but in 10 line scripts, they show up quite frequently. This undermines the rest of your request. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Control flow variables
Smylers == Smylers [EMAIL PROTECTED] writes: Smylers I also was under the strong impression that Larry had decreed Smylers that we wouldn't have chained statement modifiers ... but I Smylers thought it was because Larry had decided they would be a bad Smylers thing to have rather than because they aren't feasible. They weren't chained in Perl5, very deliberately. Larry added modifiers partially to get do { } while $cond to work, and partially because he had used them in RSTS/E BASIC (which I've also used, and recognized immediately). But when people started nesting them, the code became incredibly unreadable quickly, so no-nesting for Perl was a deliberate choice, not an implementation detail. Unless Larry has come up with an overwhelming reason to permit them after years of not having them, I doubt we'd see that (IMHO mistake) in Perl6. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Control flow variables
Randal == Randal L Schwartz [EMAIL PROTECTED] writes: Randal I actually consider that an annoying statement. I have to back up Randal three times to figure out what it means. And before someone whips out the Schwartzian Transform to undermine my statement... please note that in Perl6, you'll be able to write that left to right, which I consider a wonderful plus. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Funding the design team
David == David Storrs [EMAIL PROTECTED] writes: David Such a fund would be the ideal but, until it is set up, there is a David very easy way to fund the design team: David Folks, give us your address (or a PO box, or something), where we can David send checks. The checks won't be tax deductible, but are we really David doing this for the tax deduction? I really don't see a need to donate to other than YAS. If you earmark your donation, I'm sure YAS will ensure that the money goes to your requested destination as much as is practically (and legally) possible. Stonehenge has been a major contributor to YAS. I don't see why we should start changing plans in midstream. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Arrays vs. Lists
Michael == Michael Lazzaro [EMAIL PROTECTED] writes: Michael Do people really do that? I must say, given that it looks *so Michael obviously* like it instead means [$a,$b,$c], I wonder if attempting to Michael take a reference to a list should be a compile-time error. Michael Note that this is still OK: Michael \($a) # same as \$a Michael because as previously discussed, it's the commas making the list, not Michael the parens. But \($a,$b,$c) seems like a bug waiting to happen. I Michael don't use it. Can someone give an example of an actual, proper, use? It was to make pass by reference easier, before prototypes if I recall: myfunc \($a, @b, %c); which means the same as if we had said: sub myfunc (\$ \@ \%); myfunc($a, @b, %c); Except that the prototyped version mandates the specific types. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: REs as generators
Rich == Rich Morin [EMAIL PROTECTED] writes: Rich On occasion, I have found it useful to cobble up a little language Rich that allows me to generate a list of items, using a wild-card or some Rich other syntax, as: Richfoo[0-9][0-9] yields foo00, foo01, ... Rich I'm wondering whether Perl should have a similar capability, using REs. Well, here's a cheap way: my @list = glob ('foo{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}'); :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Dynamic scoping (take 2)
Simon == Simon Cozens [EMAIL PROTECTED] writes: Simon What were the good reasons for not allowing localized lexicals in Perl 5? Nobody could explain it in 50 words or less. What the hell is 'local my $foo = 35'? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Perl 6, The Good Parts Version
pdcawley == pdcawley [EMAIL PROTECTED] writes: pdcawley Would I be right in thinking that it should be possible to implement a pdcawley prolog like language almost entirely within a regular expression? pdcawley Anyone want to step up to the plate? I've already done a Scheme proof pdcawley of concept after all... This is already a thread on perlmonks.org... see user ovid. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Unary dot
David == David Whipp [EMAIL PROTECTED] writes: David If every object has a Cclass method (Cref?), then you could David always call class-methods as class.m2(). Wouldn't that be .class.m2(), or did I miss something in the flurry? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Unary dot
Piers == Piers Cawley [EMAIL PROTECTED] writes: Piers So, is there any chance that we'll be able to do: Piers class ical { Piers use object_name '$self'; Piers method ical { Piers given $self.ology { Piers ... { $self.ish } Piers } Piers } Piers } You could use the Smalltalk way by defining method myself in UNIVERSAL, which simply returns self. So .myself would always be yourself, which you could store if needed. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC: new logical operator
Sam == Sam Vilain [EMAIL PROTECTED] writes: Sam No, but is syntactically equivalent to and in English. It just Sam implies that the second condition is not generally what you'd expect if Sam the first was true. Maybe in the interest of huffman encoding, we could make it even_though. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: What can be hyperoperated?
Damian == Damian [EMAIL PROTECTED] writes: Damian @result = {block}^.(@data); But hyperdot sort hyperdot doesn't roll off the tongue as easy as map sort map! :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: What can be hyperoperated?
Larry == Larry Wall [EMAIL PROTECTED] writes: Larry @result = for @a; @b - $a, $b { $a op $b } Larry (presuming we make Cfor actually act like Cmap). Why not just make map do that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Some Apocalypse 4 exception handling questions.
Larry == Larry Wall [EMAIL PROTECTED] writes: Larry I think our terminology is getting sloppy here. What do you mean by Larry inherit from that method? If the derived method overrides the base Larry method, it will manage its own resources, and doesn't need the base Larry method's LAST. If the derived method calls the base method, the LAST Larry of the base method will naturally come along for the ride. If there is Larry no derived method, the base method also calls its own LAST as a matter Larry of course. I don't see any problem here. That's why I'm still puzzled about what it means to inherit PRE/POST as well. A block of code doesn't have a superclass. What exactly are you inheriting from? If you call super from a method, surely the super will have its own PRE/POST, and then there's no need to inherit it. If you don't call super, how do you know the PRE/POST of a similar subroutine in a superclass that you're completely overriding should even apply? So, does it make any sense at all to talk about inheriting PRE/POST as a separate act, other than the natural block start/end from calling super at the right time? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Apoc4 - A little wish
Angel == Angel Faus [EMAIL PROTECTED] writes: Angel Hi all, Angel I have just one syntatic wish for Apoc4 (which in all other points I Angel find utterly fantastic). Angel Could we have: Angel foreach $item in @arr {...} Angel Instead of Angel foreach @arr - $item {...} Larry considered that, and declined. Not sure of the reasons. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Stupid Newbie Question
John == John Rudd [EMAIL PROTECTED] writes: John 1) Methods are always public John 2) Variables are always private (and in this case that means that other John instances may not view the instance variables of an object; I don't John recall whether the class can see the ivars of its instances but I'm John pretty sure it can't). No, an instance owns its ivars, so nobody touches it. However, the class for an instance can define a new method which of course acts within the instance. And there's always the system primitives used by the debugger (and for other reflection), with names like instVarAt: and instVarAt:put:. Anybody can send them! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Perl 6 - Cheerleaders?
John == John Siracusa [EMAIL PROTECTED] writes: John (Can I pre-order the Perl 6 Camel or what? ;) Of course. You'll almost certainly visit the nodes before the subnodes in the documentation. :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: NaN semantics
Damian == Damian Conway [EMAIL PROTECTED] writes: Damian Sigh. I *do* see your point of view (Laziness), but I still have immense Damian difficulty with the notion that: Damian $x == NaN Damian doesn't return true if $x contains NaN. Just think of it as a quantum number that hasn't collapsed. :) No two NaNs are alike! Read it as one of many non-numbers, chosen at random. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Are .key and .value right for Pairs?
Damian == Damian Conway [EMAIL PROTECTED] writes: Too much typing: Damian module PAIR; Damian method car { return .key } Damian method cdr { return .value } Damian method AUTOVIVIFY (default, $name) { Damian if ($name =~ m/^c([ad])([ad]*)r$/) { Replace: Damian my $next = c$2r; Damian given ($1) { Damian when 'a': { return sub { .car.$next() } } Damian when 'd': { return sub { .cdr.$next() } } Damian } with: my $this = c$1r; my $next = c$2r; return sub { { .$this().$next() } }; Damian } Damian } Right? Plus or minus a set of parens or something, eh? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: General Feelings on Apoc 3
Damian == Damian Conway [EMAIL PROTECTED] writes: Damian Personally, I think: Damian foreach my $x (1..99) { Damian foreach my $y (1..99) { Damian foreach my $z (1..99) { Damian print $x, $y, $z\n if $x**2 == $y**2 + $z**2; Damian }}} Damian is much cleaner. Or even for my $x (1..98) { for my $y (1..(99-$x)) { for my $z (1..(100-$x-$y)) { print $x, $y, $z\n if $x ** 2 = $y ** 2 + $z ** 2; } } } Damian But it certainly does demonstrate TMTOWTDI. ;-) TMT2WTDI :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Larry's Apocalypse 1
"Nathan" == Nathan Wiger [EMAIL PROTECTED] writes: Nathan This is interesting, and in my gut I like it. Many people I've worked Nathan with end up writing: Nathan@foo[0] Nathan Which works. "Works", for some odd meaning of the word "works". Ever try this: @foo[0] = STDIN; and then wonder where all the *rest* of your input went? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Schwartzian Transform
"Brent" == Brent Dax [EMAIL PROTECTED] writes: Brent @s = schwartzian( Please, if we're going to add an operator, let's not call it schwartzian! I have enough trouble already telling people how to spell my name. :) Maybe I should have a kid named "Ian", so I can see on a roster some day: Schwartz,Ian :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Schwartzian Transform
"John" == John Porter [EMAIL PROTECTED] writes: John No special name, huh? Maybe that's the way it ought to be. That's the way I feel occasionally about the Schwartzian Transform, actually. Having to explain that it was named *for* me but not *by* me (in fact, actually to spite me, if I recall). Although it is fun when we get to the "Schwartizian Transform Illustrated" page in my slideset... I get to say "don't wait for the swimsuit issue... it's not a very pretty sight". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Closures and default lexical-scope for subs
"Peter" == Peter Scott [EMAIL PROTECTED] writes: Peter Quite. But on a tangent, I see no good reason why this shouldn't be Peter given the same interpretation as "my ($a, $b, $c)" on the grounds that Peter functions taking list arguments that omit their parentheses swallow up Peter the following list. *some* functions. localtime doesn't. my is a unary function, prototyped vaguely as (\$) or (\@) or (\%). -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Perl 5's non-greedy matching can be TOO greedy!
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven What surprised me was how vigorously people would defend the Deven status quo, and insist on the correctness of the current Deven behavior without thinking it through. No, I thought it through quite completely. As have others. Deven Given how invested people are in the exact current behavior, I Deven now believe it was a poor choice of words to describe it as a Deven "flaw", simply because it presumed an implied consensus on the Deven higher-level semantics that obviously wasn't there. Quite the opposite. You seem to be one of the very few who expects it to act other than as documented. Deven It seems to have been interpreted as a value judgement on my Deven part, which it wasn't. It merely occurred to me that Perl 6 Deven might provide an opportunity to eliminate a minor quirk in the Deven regular expression system. I didn't mean to imply that the Deven current behavior is BAD, simply that it's not quite right (at Deven least in my mind) -- since there's serious disagreement about Deven this, I'd like to make a shift in terminology and start Deven referring to this behavior as a "semantic anomaly" rather than Deven a "flaw" or a "bug", and hope that will be a more neutral term. It's not an anomoly at all. It comes out completely accurate with some very simple rules for how regex works. Admit it... it bit you, and you are just refusing to believe that you don't have a complete and accurate model for how regex work. Please, admit this, and we can MOVE ON. Deven Hopefully, we can have a rational discussion about whether this Deven semantic anomaly is real or imagined, what impact "fixing" it Deven would have on the implementation (if it's deemed real), and Deven whether it's worth "fixing". You can't fix what isn't broken. Deven If the final decision is not to change the current behavior, Deven for whichever reason, I'd like to see this documented in an RFC Deven that says "here's what was requested and why it isn't going to Deven be done". I'll volunteer to help with that (even if I remain Deven in the minority), whether by summarizing or cutting and pasting Deven arguments made in this discussion... Changing the regex to do what you wish would make regex in Perl entirely unlike the regex in every other language. Not gonna happen. Deven The pattern in question is "b.*?d". Obviously, this matches Deven "b", followed by something else, followed by "d". What Deven "something else" should be is the issue at hand. That portion Deven of the regexp is just ".*?" -- the "." matches any character Deven (except newlines, depending on the mode), the "*" modifies the Deven "." to match "zero or more" of "any character", and the "?" Deven modifies the ".*" to match "zero or more" of "any character", Deven but "matching the minimum number of times possible". No. This is where you are off. .* and .*? match the same types of things. Just that when given the choice, .*? leans towards the shorter version, and .* leans toward the longer. All the ? does is change the *bias* in the face of *choices*. But the overriding rules of a regex match are "left most first". So the first b will match at the first possible b. And then we run out as many "." matches as we can. No wait, it's ?, so we run out as few "." matches as we can, until we can match a "d". Bingo, we got a match! That's the rules. They're very easy to grasp. The leftmost match is found with the required semantics. You don't keep going on looking for a shorter match. Deven Hence, Deven the ".*?" can be summarized as "match anything, but keep the Deven match as short as possible". No, that's an incorrect description. No wonder you are confused. Deven Am I really the only one who views it this way? Must I stand Deven alone? Yes. Go stand in the corner. :) Deven If we lived in that ideal world, what behavior would be Deven expected and preferred? The current one. If you muck with "leftmost match wins", not only will you break most existing programs, you will SLOW EVERYTHING DOWN, because we have to keep going on even after we already have a match! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Perl 5's non-greedy matching can be TOO greedy!
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added complexity at the Deven implementation level. (The cost decision of whether that added complexity Deven is worthwhile is a separate consideration.) No, it would break a much higher overriding rule of "left most match wins". That's at the top of the chart. You're *adding* an exception to that. Tell me how you can do that without breaking much existing code. Deven And I'd really appreciate it if everyone would refrain from Deven suggesting that I don't understand the behavior. I understand Deven it fine; I just don't agree with it. In the language of the Deven Supreme Court, "I respectfully dissent." Just because I don't Deven perfectly agree with the semantics that were chosen doesn't Deven mean I don't understand them. You don't understand the motivation, apparently. That's what I'm referencing. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Undermining the Perl Language
"David" == David Grove [EMAIL PROTECTED] writes: David I was primarily addressing the issue of the P5P allowing the David language to be controlled by corporate presence through a David purchased pumking, and not taking responsibility for the David language sufficient to protect it against corruption (technical David and political), and choosing rather to follow the man rather David than look where they're going. I've no idea why Sarathy was David deposed, but I have a pretty big suspicion. The problem is, I David love Sarathy too. He's a hero, now with a tarnished reputation, David not necessarily solely because but definitely partially David because, of a poor choice in employers. But I can't support the David decisions that Sarathy made and why he made them. In order to David address problems like "the premature release of Perl 5.6 when David it wasn't nearly ready just to satisfy a Microsoft deadline", David either a/the porters group needs to understand that they need David to concentrate on the road and not on the leader, or we need a David group that is capable or willing to do so. Please take your paranoia elsewhere. I think if you actually sat down and had lunch with each of the parties involved, and those further out but well-informed, you'd find a consistent view of reality that doesn't match ANY of your delusions. No conspiracy could be that well-oiled. Someone would have leaked it by now. And consider the contrary for a moment... if this *is* a conspiracy desgined to lock you out, what point would complaining about it do? {grin} To be a contribution to the community, you must have some higher degree of trust than you are demonstrating. If you can't manage that on your own, seek assistance elsewhere. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: is \1 vs $1 a necessary distinction?
"Jonathan" == Jonathan Scott Duff [EMAIL PROTECTED] writes: Jonathan On Wed, Sep 27, 2000 at 08:15:53AM -0700, Dave Storrs wrote: Both \1 and $1 refer to what is matched by the first set of parens in a regex. AFAIK, the only difference between these two notation is that \1 is used within the regex itself and $1 is used outside of the regex. Is there any reason not to standardize these down to one notation (i.e., eliminate one or the other)? Jonathan \1 can be used on the LHS of a s/// whereas $1 there probably won't do Jonathan what you expect. Also, \1, \2, \3 only takes you as far as \9 ;-) Wrong. If you have more than 10 parens visible so far, \10 works just fine. Jonathan If $1 could be made to work properly on the LHS of s///, I'd vote for Jonathan that being The Way. It can't ever. It means $1 from the previous match. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 267 (v1) Eliminate dump() function
"Michael" == Michael G Schwern [EMAIL PROTECTED] writes: Michael On Thu, Sep 21, 2000 at 03:55:21AM -, Perl6 RFC Librarian wrote: Eliminate dump() function Michael I didn't even know it existed. I do, every time I forget to hit the shift key around certain invocations of Data::Dumper and then wonder why my program is core dumping. Doh! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 212 (v1) Make length(@array) work
"Bart" == Bart Lateur [EMAIL PROTECTED] writes: Bart So length is already picky on what it accepts. You need to turn it into Bart print length(scalar(@a, 'this is a string')); Bart to get perl to accept it. And then what it's accepting is the scalar-comma operator, giving you the length of "this is a string". Not 2. Not the length of "2". :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 76 (v2) Builtin: reduce
"Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 If the reduction subroutine has a prototype, that prototype Perl6 determines how many items are reduced at a time. If the reduction subroutine Perl6 is a block or has no prototype, two items are reduced each time. ... is inconsistent with ... Perl6 If the original list has no elements, Creduce immediately throws an Perl6 exception. If the original list has a single element, that element is Perl6 immediately returned (without ever calling the reduction subroutine). Can we resolve this? That second paragraph doesn't take into account what happens when I give 3 elements to a 7-element-at-a-time reduction formula. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 212 (v1) Make length(@array) work
"Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 Make length(@array) work Perl6 I propose to make length() return the number of elements in the array Perl6 it is passed, if its first argument begins with @. This proposal makes length() an un-prototypable (and therefore unoverridable). Do you have a proposal for how to handle that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 212 (v1) Make length(@array) work
"Casey" == Casey R Tweten [EMAIL PROTECTED] writes: Casey I agree with this line of thinking, however, I suppose I don't Casey agree with implementing length in this way since we already Casey have Cscalar. Casey In that light, if Clength is to replace scalar for, we'll Casey say, LISTs, then lets remove Cscalar since it will be Casey effectivley defunct. Uh, no. It provides a scalar context. For only a few kinds of things that return lists in lists context, do they return the LENGTH of that list in a scalar context. Most other things have much more interesting return values in a scalar context, and a few have nothing but undef. I just had this discussion on Usenet... please go Deja comp.lang.perl.misc. In fact, you can't get "scalar" in front of a list. It doesn't exist. It can't *ever* exist. This also means that length X is not the same as length scalar X but rather, specialcased VERY SPECIFICALLY for length @FOO This is what I don't like about this proposal. It raises more eyebrows than it fixes. I like the suggestion that it be a warning, and leave it at that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: more yield tricks ((was Re: Cmap in RFC 31
"Damian" == Damian Conway [EMAIL PROTECTED] writes: foreach @bigarray { yield (push @array1, $_); yield (push @array2, $_); yield (push @array3, $_); push @array4, $_; }; Damian Except that Cyield is like Creturn and breaks out of the current Damian *subroutine*, not the current block. Damian Damian Well, OK then foreach @bigarray { sub { yield (push @array1, $_); yield (push @array2, $_); yield (push @array3, $_); push @array4, $_; }-(); }; :-) Which of course won't work, unless there's a lot more magic going on. (Which coderef gets the yield state attached to it, and would this properly be recognized as a reason to clone the coderef?) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: $a in @b (RFC 199)
"Garrett" == Garrett Goebel [EMAIL PROTECTED] writes: Garrett I agree... why can't a block be a block? Or put another way, instead of Garrett trying to shoehorn in something new, why don't we take away something old Garrett and treat all the blocks the same under Perl 6? You mean this would no longer work? while () { if ($some_condition) { fred fred fred; next; } barney barney barney; } Yup. Sure looks like a block to me. If "next" aborts only the "if" block, but still executes barney barney, then it's now useless for about 70% of my usage of "next". Nope, 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. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: $a in @b
"Ariel" == Ariel Scolnicov [EMAIL PROTECTED] writes: yield EXPR - stop what I am doing now and give something else a a chance to do its things. And while you are doing that please take this EXPR from me. Ariel When you put it this way, isn't Cyield spelled Creturn in Perl5? Ariel (Except, of course, that Creturn inside a Cgrep does a whole lot Ariel more nowadays). Yes, I'd be in favor of making return() in a valued block (as opposed to a looping block) abort the block early and return the value. I don't think I'd want to change last() to do that, since last() already has an optional parameter (the loop label). That makes the valued block of a do {} or a grep or map be able to abort with a particular value. Although it would break any use of return in those blocks to abort the enclosing subroutine, and there wouldn't be any clean translation available. Ugh. Maybe we do need a new keyword. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: $a in @b
"Chaim" == Chaim Frenkel [EMAIL PROTECTED] writes: "TC" == Tom Christiansen [EMAIL PROTECTED] writes: grep { $_ == 1 } 1..1_000_000 grep doesn't short-circuit. TC I never did figure out why "last" {w,sh,c}ouldn't be made to do TC that very thing. Chaim Hey, I suggested that a while ago, but Randal shot it down. Chaim Something about the block not being a loop, I think. I think it was more along the lines that Damian (I think) enumerated of "what value does a block being evaluated for a value but exited with 'last' return?". As in, how do you indicate with 'last' that you want a false return, or a true return? This never comes up with a do {} block, or a subroutine block, because while those are being evaluated for a value, they don't respect last/next/redo. Your request to have the grep block understand 'last' was the first block in Perl history that would have simultaneously needed to exit early *with* a value. And we hadn't come around that block yet. :) We really need a clean way to distinguish those four cases: "yes" and keep going "no" and keep going "yes" and abort after this one "no" and abort after this one What would you have "last" do? And how would you distinguish "the other one"? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 187 (v1) Objects : Mandatory and enhanced second argument to Cbless
"Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 This RFC proposes that the second argument to Cbless be made Perl6 mandatory, and that its semantics be enhanced slightly to cover a Perl6 common, ugly, and frequently buggy usage. Yes! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 190 (v1) Objects : NEXT pseudoclass for method redispatch
"Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 This RFC proposes a new pseudoclass named CNEXT. Perl6 This pseudoclass would provide a way of correctly redispatching a method Perl6 or an autoloaded method. Yes! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 175 (v1) Add Clist keyword to force list context (like Cscalar)
"Tom" == Tom Christiansen [EMAIL PROTECTED] writes: Tom Wherever you think you need one of these, try to think again. Either Tom it's already in list context, in which case it's silly to put in Tom the list thing, or else there's always a better way to accomplish Tom whatever you're trying to do--which, as I have shown, can vary Tom greatly. Tom This proposal should be dropped. Yeah, what Tom said. Any time I've need a "single element" of some "list value", I've had to think about which single element to pull out. Since there's no general rule for converting a scalar to a list (there's only twenty or so specific rules :), there's no consistent way to take this coerced "list in a scalar context" and wrangle it back to a scalar! "list" keyword. Just say no. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: Ideas that need RFCs?
"Joe" == Joe McMahon [EMAIL PROTECTED] writes: Joe This is done by using SNOBOL's dynamic function evaluation and Joe conditional assignment during a pattern match. To do this kind of Joe thing in Perl, we'd need to be able to match a substring, and Joe then call an arbitrary function in the middle of a pattern match, Joe and to back out the call if the match failed. Already done in 5.6. :) "perldoc perlre". -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: ... as a term
"Larry" == Larry Wall [EMAIL PROTECTED] writes: Larry Randal L. Schwartz writes: Larry : if ($a == $b) { ... } # should this be string or number comparison? Larry Actually, it's a syntax error, because of the ... there. :-) Larry But that reminds me of something I wanted a few months ago. Larry I'd entertain a proposal that ... be made a valid term that happens Larry to do nothing, so that you can run your examples through perl -c for Larry syntax checks. Or better, make it an official "stub" for rapid Larry prototyping, with some way of getting a warning whenever you execute Larry such a stub. I've always wished it was the famous "do what I mean" operator: if ($a eq "input") { ... # let perl figure out what to do here } else { print "I need more input!\n"; } That'd make "rapid application development" truly possible. perl -e '...' # all programs here Maybe we can code it up with "Quantum::Superpositions::any"? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 132 (v1) subroutines should be able to return an lvalue
"Johan" == Johan Vromans [EMAIL PROTECTED] writes: Johan Why not? I couldn't find in the Camel that the right side must be Johan evaluated first (at least not where the assignment operator = is Johan discussed according to the index). Shouldn't: sub magicguy { lreturn @a; } magicguy() = reverse @a; work the same as: @a = reverse @a; So we must evaluate the right code before we start modifying the left. Oh wait, I'm hosed here. Duh. We can still run the code on the left to return the lvalue! In any event, your comment that it should always be scalar is cool, but would prevent the code I'm giving right here from running. So is that something we've agreed, that lvalue subs are *always* scalars? That'd mean we can move on to the various implementation details. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 105 (v1) Downgrade or remove In string @ must be \@ error
"Jonathan" == Jonathan Scott Duff [EMAIL PROTECTED] writes: Jonathan Isn't that the way perl4 did it? I don't know what agony lwall and Jonathan friends went through that made them change this behaviour though. It Jonathan would be good for someone who does to speak up about it. It permits "action at a distance". A program that originally didn't have @stonehenge in print "email me at [EMAIL PROTECTED]" may someday later introduce a @stonehenge, and now this statement means something completely different. What would be NICE is to treat @stonehenge here as *always* a variable (similar to the way scalars are treated), which was actually implemented in one of the perl5 alphas, but changed to the current behavior when it made too many programs print "merlyn.com" for the above! So, I'd support a modification to the RFC that does what Larry intended here: array interpolation should work exactly like scalar interpolation -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 92 (v1) Extensible Meta-Object Protocol -- Metho
"Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 Perl should be modified so that if C$ISA::Search (or equivalent) Do you mean "$YOUR_PACKAGE::ISA::Search" which is in the package "YOUR_PACKAGE::ISA"? This would be the first time (to my knowledge) that something would be in an unrelated package. Remember... there is no necessary correlation between $A and $A::B as of yet. Your proposal would breach that. Presuming the rest of the idea is deemed sound enough to implement (:-), I'd strongly suggest the variable name be something like $ISA_SEARCH or something like that, to keep it in the same package. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 95 (v1) Object Classes
I'm still saving the proposal for further digestion, but wanted to get this out quickly: "Perl6" == Perl6 RFC Librarian [EMAIL PROTECTED] writes: Perl6 The existing Cnew keyword can be used to create new object instances Perl6 of a given class. There is no existing "new" keyword in Perl. There's a convention that the C++ people use when coming into Perl to call the simplest constructor "new", but any name can be used for a constructor in Perl. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 84 (v1) Replace = (stringifying comma) with =
"Glenn" == Glenn Linderman [EMAIL PROTECTED] writes: Glenn No, but the documentation for strict is some of what I reread Glenn before making a fool of myself arguing with Damian, and it says Glenn nothing about barewords, as far as I could read. Even this part? ... strict subs This disables the poetry optimization, generating a compile-time error if you try to use a bareword identifier that's not a subroutine, unless it appears in curly braces or on the left hand side of the "=" symbol. use strict 'subs'; $SIG{PIPE} = Plumber; # blows up $SIG{PIPE} = "Plumber"; # just fine: bareword in curlies always ok $SIG{PIPE} = \Plumber; # preferred form Looks pretty direct to me. Maybe that was further than you could read? :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: the currying operator
"Graham" == Graham Barr [EMAIL PROTECTED] writes: Graham No that won't work either. That matches the string {_} But that's arguably a DWIMmy thing, since {} is in the category of * + and ?, which always need to be *after* something, and there's no *something* here. I don't know how much stuff this would break, but I know I always backwhack my {'s regardless of where they are located in the regex, not counting on the DWIM to do it right. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC 76 (v1) Builtin: reduce
"Chaim" == Chaim Frenkel [EMAIL PROTECTED] writes: DC For example, to short-circuit if the reduction ever becomes undef: DC $sum = { defined $_[0] or last; $_[0]+$_[1] } 0, @numbers; Chaim Actually, it would be easier to do in reduce, the undefs should Chaim simply be ignored. If I understand you correctly, I want to disagree with you. What if the "reduce" was to count the number of undefs? $count = reduce { $a + not defined $b } 0, @some_list; Do not discard undef from the source list. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: The Conway list
"skud" == skud [EMAIL PROTECTED] writes: skud My $DEITY, someone sedate this man before he drowns us all in skud Perl RFCs! K. From the subject line, I thought it was another mailing list for me to send in a subscription request! -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl 6 requirements
"Graham" == Graham Barr [EMAIL PROTECTED] writes: Graham You say "operator" and you are right. I think the issue is a sub Graham can return either. Really? How does a sub return "an array"? (Unless you're about to mutter something about "lvalue subs" :) a sub can return only an rvalue. An "array" as an rvalue is always a list. Unless we disagree on the meaning of array and list. In that case, let's get back to terminology. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: RFC: Highlander Variables
"John" == John Porter [EMAIL PROTECTED] writes: John Imho, this is A Bad Practice. Making it impossible would therefore John be Good, existing-script-breakage not withstanding. So you'll break $ARGV and @ARGV? Is that really OK? And will you extend this to ensuring that scalars, arrays, hashes, subroutines, filehandles, formats, directory handles, and labels all have distinct names? 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. (Maybe we can just add something to that ever-increasing "-w" to do this. Make it a warning for beginners.) I'll argue the opposite... "related things" can have similar names. I do it all the time. I think it makes sense. It also makes glob-ish things similar, although I understand this is a separate issue up for grabs. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl 6 requirements
"Graham" == Graham Barr [EMAIL PROTECTED] writes: Graham There is a difference Graham sub abc { return (7,8,9) } That's returning either a list or a comma operator result, depending on context. Graham sub def { my @a = (9,8,7); return @a; } That's not returning the array. That's returning a copy of the contents of @a in a list context, and the number of elements of @a in a scalar context, using the "@a" operator. You still haven't "returned the array". Graham I am not refering to context, but what the user types. If an author Graham does not document the two subs above correctly as returning a list and an array Graham then a user may get surprised. Yes, but the first part is getting the naming right. You don't "return an array". :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl 6 requirements
"Steve" == Steve Fink [EMAIL PROTECTED] writes: Steve We could add a 'then' keyword. We have one. It's called "comma in a scalar context". :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl 6 requirements
"Chaim" == Chaim Frenkel [EMAIL PROTECTED] writes: Chaim I don't find this meaningful: Chaim sub foo() { return (1,7) } Chaim $x = foo();# $x == 7; I do. It's perfectly consistent. $x = SUBROUTINE CALL ... SUBROUTINE CALL = (1,7) You just factor out the subroutine call there. It's the same as $x = (1,7) # $x is 7 I've never gotten why you don't get that. :) It's a very simple rule: the return context is the context of the invocation, and is determined at runtime as well as being detectable at runtime (see wantarray()) if you want to do something special. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: perl 6 requirements
"Chaim" == Chaim Frenkel [EMAIL PROTECTED] writes: "CF" == Chaim Frenkel [EMAIL PROTECTED] writes: CF (Kirrily, this one is for the record.) CF I'd also like to add, redo, next, last escaping a subroutine. Chaim Make that _NOT_ escaping a subroutine. Chaim map { ...; last; ...} @foo Chaim should simply terminate the map, not go to the next containing loop. So using map as it SHOULD be used (heh), what would you have @a contain after: @a = map { last if $_ 5; $_ } 1..10; Would it be 1..5, 1..6, 1..10, whatever it had before, or ()? I could make arguments for each of them. :) I think making that *not* a looping block makes more sense, so we don't get into this nonsense. The "last" cleanly breaks out of the innermost loopblock, which by definition doesn't have a return value, so there's no chance we'll freak out an assignment. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!