Re: Hyper operator corner case?

2005-04-15 Thread Thomas Sandlaß
John Williams wrote: Good point. Another one is: how does the meta_operator determine the identity value for user-defined operators? Does it have to? The definition of the identity value---BTW, I like the term neutral value better because identity also is a relation between two values---is that

$*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
I was doing some work on Parrot::Test today and was replacing this code with something more cross platform. # Run the command in a different directory my $command = 'some command'; $command= cd $dir $command if $dir; system($command); I replaced it with this.

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Juerd
David Wheeler skribis 2005-04-14 21:32 (-0700): I was going to say that that was inconsistent, but since you never need to repeat a letter in a character class, well, I guess it isn't. But the first person to write [a...] gets what's comin' to 'em. Given ASCII, [\x20...] would then be

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Braňo Tichý
- Original Message - From: Aaron Sherman [EMAIL PROTECTED] To: David Wheeler [EMAIL PROTECTED] Cc: Perl6 Language List perl6-language@perl.org Sent: Friday, April 15, 2005 2:00 PM Subject: Re: should we change [^a-z] to -[a..z] instead of -[a-z]? On Thu, 2005-04-14 at 21:32 -0700,

[] ugly and hard to type

2005-04-15 Thread Juerd
Am I the only one who thinks [a-z] is ugly and hard to type because of the nested brackets? The same goes for {...}. The latter can't easily be fixed, I think, but the former perhaps can. If there are more who think it needs to, that is. And {} is a bit easier to type because all four are shifted

Re: [] ugly and hard to type

2005-04-15 Thread Patrick R. Michaud
On Fri, Apr 15, 2005 at 02:58:44PM +0200, Juerd wrote: Am I the only one who thinks [a-z] is ugly and hard to type because of the nested brackets? The same goes for {...}. The latter can't easily be fixed, I think, but the former perhaps can. Part of the thinking behind this is that the [...]

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Matthew Walton
delurk even sillier question: if [a.z] matches a, . and z and [a...] matches all characters from a including (for some definition of 'all') how will be range \x21 .. \x2e written? [!..\.]? (i.e. . escaped?) /delurk I was assuming from Larry's mail that [a...] would parse as either:

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Steven Philip Schubiger
On 14 Apr, Larry Wall wrote: : In writing some character class translation, I realized that : : -[a-z] : : and its ilk are rather hard to read because of the two hyphens : that mean different things. We can't use ![a-z] because that's a : 0-width lookahead. Given that we're trying to get

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Rafael Garcia-Suarez
Aaron Sherman wrote in perl.perl6.language : A silly question: is there a canonical character set from which we extract these ranges? Are we hard-coding Unicode here, or is there some way for the user to specify the character set for ranges? Perl 5 forces [a-z] (or [i-j] for that matter) to

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Patrick R. Michaud
On Fri, Apr 15, 2005 at 01:01:58PM -, Rafael Garcia-Suarez wrote: Aaron Sherman wrote in perl.perl6.language : A silly question: is there a canonical character set from which we extract these ranges? Are we hard-coding Unicode here, or is there some way for the user to specify the

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 03:11:59AM -0700, Michael G Schwern wrote: : Error handling is simple, a failed chdir returns undef and sets errno. : : $CWD = $dir err die Can't chdir to $dir: $!; Offhand, I guess my main semantic problem with it is that if a chdir fails, you aren't in an

Truely temporary variables

2005-04-15 Thread Aaron Sherman
Among the various ways of declaring variables, will Perl 6 have a way to say, this variable is highly temporary, and may be re-declared within the same scope, or in a nested scope without concern? I often find myself doing: my $sql = q{...}; ...do some DB stuff... my $sql

Re: Macros [was: Whither use English?]

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 12:45:14PM +1200, Sam Vilain wrote: : Larry Wall wrote: : Well, only if you stick to a standard dialect. As soon as you start : defining your own macros, it gets a little trickier. : : Interesting, I hadn't considered that. : : Having a quick browse through some of the

Re: Truely temporary variables

2005-04-15 Thread Juerd
Aaron Sherman skribis 2005-04-15 11:45 (-0400): What I'd really like to say is: throwawaytmpvar $sql = q{...}; throwawaytmpvar $sql = q{...}; I like the idea and propose a, aliased an for this. It should probably be illegal to: throwawaytmpvar $sql = q{...}; my $sql

Re: Truely temporary variables

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 11:45:16AM -0400, Aaron Sherman wrote: : Among the various ways of declaring variables, will Perl 6 have a way to : say, this variable is highly temporary, and may be re-declared within : the same scope, or in a nested scope without concern? I often find : myself doing: :

Re: Truely temporary variables

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 06:04:32PM +0200, Juerd wrote: : No, Ucfirst it can't be, I think. And ALLCAPS is ugly. @ is taken (and : ugly). Suggestions? Maybe we could define an ok operator that suppresses only the *first* warning produced by its argument(s). Then if you get multiple warnings, you

Re: Truely temporary variables

2005-04-15 Thread Patrick R. Michaud
On Fri, Apr 15, 2005 at 09:17:13AM -0700, Larry Wall wrote: On Fri, Apr 15, 2005 at 06:04:32PM +0200, Juerd wrote: : No, Ucfirst it can't be, I think. And ALLCAPS is ugly. @ is taken (and : ugly). Suggestions? Maybe we could define an ok operator that suppresses only the *first* warning

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Rod Adams
David Wheeler wrote: But the first person to write [a...] gets what's comin' to 'em. Is that nothing (since '.' lt 'a'), or everything after 'a'? -- Rod Adams

Re: Truely temporary variables

2005-04-15 Thread Rod Adams
Larry Wall wrote: On Fri, Apr 15, 2005 at 06:04:32PM +0200, Juerd wrote: : No, Ucfirst it can't be, I think. And ALLCAPS is ugly. @ is taken (and : ugly). Suggestions? Maybe we could define an ok operator that suppresses only the *first* warning produced by its argument(s). Then if you get

Re: Truely temporary variables

2005-04-15 Thread Juerd
Rod Adams skribis 2005-04-15 11:53 (-0500): Wouldn't some form of trait make more sense: my $sql = '...' is ok; Depends. A unary ok operator would let you pinpoint very easily, *without* using parens: ok $fh.print($foo); # no warnings about print (closed fh?) #

Re: Truely temporary variables

2005-04-15 Thread Luke Palmer
Aaron Sherman writes: Among the various ways of declaring variables, will Perl 6 have a way to say, this variable is highly temporary, and may be re-declared within the same scope, or in a nested scope without concern? I often find myself doing: my $sql = q{...}; ...do some DB

Statement modifier scope

2005-04-15 Thread Paul Seamons
The following chunks behave the same in Perl 5.6 as in Perl 5.8. Notice the output of branching statement modifiers vs. looping statement modifiers. perl -e '$f=1; {local $f=2; print $f} print - $f\n' # prints 2 - 1 perl -e '$f=1; {local $f=2 if 1; print $f} print - $f\n # prints 2 - 1

Re: Statement modifier scope

2005-04-15 Thread Juerd
Paul Seamons skribis 2005-04-15 11:50 (-0600): my %h = a 1 b 2 c 3; { temp %h{$_} ++ for %h.keys; Just make that two lines. Is that so bad? temp %h; %h.values »++; %h.say; # values are incremented still } %h.say; # values are back to original values Juerd --

Re: Truely temporary variables

2005-04-15 Thread Brent 'Dax' Royal-Gordon
Aaron Sherman [EMAIL PROTECTED] wrote: What I'd really like to say is: throwawaytmpvar $sql = q{...}; throwawaytmpvar $sql = q{...}; Anything wrong with: my $sql = q{...}; temp $sql = q{...}; temp $sql = q{...}; (Assuming Ctemp is made to work on lexicals, of

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
On Friday 15 April 2005 11:57 am, Juerd wrote: Paul Seamons skribis 2005-04-15 11:50 (-0600): my %h = a 1 b 2 c 3; { temp %h{$_} ++ for %h.keys; Just make that two lines. Is that so bad? temp %h; %h.values »++; For the given example, your code fits perfectly. A more common

Re: Truely temporary variables

2005-04-15 Thread Juerd
Brent 'Dax' Royal-Gordon skribis 2005-04-15 11:15 (-0700): Anything wrong with: Yes, moving things around breaks it, as does removing the first. There is no real dependency on the first $sql and it'd be great if declaration wouldn't add one. temp $sql = q{...}; my $sql = q{...}; temp

Re: Truely temporary variables

2005-04-15 Thread chromatic
On Fri, 2005-04-15 at 11:21 -0500, Patrick R. Michaud wrote: On Fri, Apr 15, 2005 at 09:17:13AM -0700, Larry Wall wrote: Maybe we could define an ok operator that suppresses only the *first* warning produced by its argument(s). Then if you get multiple warnings, you at least get some

Re: Statement modifier scope

2005-04-15 Thread Juerd
Paul Seamons skribis 2005-04-15 12:16 (-0600): For the given example, your code fits perfectly. A more common case I have had to deal with is more like this: my %h = a 1 b 2 c 3 my %other = a one b two; { temp %h{$_} = %other{$_} for %other.keys; Either temp %h; %h{$_} =

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
temp %h; %h{ %other.keys } = %other.values; or even temp %h{ %other.keys } = %other.values; should work well already? Almost - but not quite. In Perl5 perl -MData::Dumper -e '%h=qw(a 1 b 2); {local %h; $h{a}=one; print Dumper \%h} print Dumper \%h; $VAR1 = { 'a' =

Re: Truely temporary variables

2005-04-15 Thread Aaron Sherman
On Fri, 2005-04-15 at 13:10, Luke Palmer wrote: Aaron Sherman writes: Among the various ways of declaring variables, will Perl 6 have a way to say, this variable is highly temporary, and may be re-declared within the same scope, or in a nested scope without concern? I often find myself

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
On Friday 15 April 2005 12:28 pm, Juerd wrote: temp %h{ %other.keys } = %other.values; Oops missed that - I like that for solving this particular problem. It does even work in Perl5: perl -MData::Dumper -e '%h=qw(a 1 b 2); {local @h{qw(a b)}=(one,two); print Dumper \%h} print Dumper \%h'

Re: should we change [^a-z] to -[a..z] instead of -[a-z]?

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 11:28:31AM -0500, Rod Adams wrote: : David Wheeler wrote: : : But the first person to write [a...] gets what's comin' to 'em. : : Is that nothing (since '.' lt 'a'), or everything after 'a'? Might as well make it everything after 'a' for consistency. One could also view

Re: Statement modifier scope

2005-04-15 Thread Juerd
Paul Seamons skribis 2005-04-15 12:41 (-0600): In Perl5 perl -MData::Dumper -e '%h=qw(a 1 b 2); {local %h; $h{a}=one; print Dumper \%h} print Dumper \%h; $VAR1 = { 'a' = 'one' }; $VAR1 = { 'a' = '1', 'b' = '2' }; I'm imaging the behavior

Re: Statement modifier scope

2005-04-15 Thread Larry Wall
I would like to get rid of all those implicit scopes. The only exception would be that any topicalizing modifier allocates a private lexical $_ scoped to just that statement. But dynamic scoping may happen only at explicit block boundaries. I can see the argument for the other side, where any

Re: Statement modifier scope

2005-04-15 Thread Paul Seamons
I'm imagining it will be different, as I expect temp to not hide the old thing. I'm not sure it will. That is another good question. I just searched through the S and A's and couldn't find if temp will blank it out. I am thinking it will act like local. Each of the declarations my, our and

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
Thus spake Larry Wall: Offhand, I guess my main semantic problem with it is that if a chdir fails, you aren't in an undefined location, which the new value of $CWD would seem to indicate. You're just where you were. Then the user either has to remember that, or there still has to be some

Re: Statement modifier scope

2005-04-15 Thread Juerd
Paul Seamons skribis 2005-04-15 13:42 (-0600): Each of the declarations my, our and local currently set the value to undefined (unless set = to something). That's not true. use strict; $::foo = 5; our $foo; print $foo; # 5 Juerd --

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Juerd
Michael G Schwern skribis 2005-04-15 13:12 (-0700): To be clear: Only the store operation will return undef on failure. Additional fetches on $CWD will continue to return the cwd. Still breaks $ref = \($CWD = $foo); I'm not sure this breakage matters, but if it breaks one thing, it's

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 01:12:46PM -0700, Michael G Schwern wrote: : Thus spake Larry Wall: : Offhand, I guess my main semantic problem with it is that if a chdir : fails, you aren't in an undefined location, which the new value of $CWD : would seem to indicate. You're just where you were.

Heredocs: How equal are bunches of spaces to tabs?

2005-04-15 Thread Juerd
Pasted from pugs/examples/cookbook/01-00introduction.p6: # XXX - question: How equal are bunches of spaces to tabs? # -- I'd say that's a question for perl6lang Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread chromatic
On Fri, 2005-04-15 at 23:52 +0200, Juerd wrote: Well, after failure it can be cwd() but false without breaking any real code, because normally, you'd never if (cwd) { ... }, simply because there's ALWAYS a cwd. Not always -- try removing a directory that's the pwd of another process. -- c

Re: nbsp in \s, ?ws and

2005-04-15 Thread Aaron Sherman
On Fri, 2005-04-15 at 17:44, Juerd wrote: Is there a ?ws-like thingy that is always \s+? Not sure what that means exactly. Do \s and ?ws match non-breaking whitespace, U+00A0? As I understood, Perl 6 was going to use the Unicode standard(s) to determine the whitespacishness of each codepoint.

Re: nbsp in \s, ?ws and

2005-04-15 Thread Juerd
Aaron Sherman skribis 2005-04-15 18:20 (-0400): Is there a ?ws-like thingy that is always \s+? Not sure what that means exactly. ?ws is \s* or \s+, depending on its surroundings. Thankfully, NBSP (U+00A0) is not Unicode whitespace. Thanks for sharing this information! Juerd --

Re: nbsp in \s, ?ws and

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 11:44:03PM +0200, Juerd wrote: : Is there a ?ws-like thingy that is always \s+? Not currently, since \s+ is there. ?ws used to be that, but currently is defined as the magical whitespace matcher used by :words. : Do \s and ?ws match non-breaking whitespace, U+00A0? Yes.

Re: nbsp in \s, ?ws and

2005-04-15 Thread Juerd
Larry Wall skribis 2005-04-15 15:38 (-0700): : Do \s and ?ws match non-breaking whitespace, U+00A0? Yes. That makes \s+ and \s*, and thus ?ws very useless for anything but trimming whitespace. For splitting (including word wrapping), it'd do exactly the wrong thing. : \s is said (in S05) to

Re: Heredocs: How equal are bunches of spaces to tabs?

2005-04-15 Thread Larry Wall
On Sat, Apr 16, 2005 at 12:11:24AM +0200, Juerd wrote: : Pasted from pugs/examples/cookbook/01-00introduction.p6: : : # XXX - question: How equal are bunches of spaces to tabs? : # -- I'd say that's a question for perl6lang This seems to be singularly short on context, but if it has to do

Re: nbsp in \s, ?ws and

2005-04-15 Thread Larry Wall
On Sat, Apr 16, 2005 at 12:46:47AM +0200, Juerd wrote: : Larry Wall skribis 2005-04-15 15:38 (-0700): : : Do \s and ?ws match non-breaking whitespace, U+00A0? : Yes. : : That makes \s+ and \s*, and thus ?ws very useless for anything but : trimming whitespace. For splitting (including word

Re: nbsp in \s, ?ws and

2005-04-15 Thread Mark Reed
I thought we had just established that nbsp is not in Unicode¹s definition of whitespace. So why should \s match it? On 2005-04-15 18:56, Larry Wall [EMAIL PROTECTED] wrote: On Sat, Apr 16, 2005 at 12:46:47AM +0200, Juerd wrote: : Larry Wall skribis 2005-04-15 15:38 (-0700): : : Do \s and

Comparing rationals/floats

2005-04-15 Thread gcomnz
More questions stemming from cookbook work... Decimal Comparisons: The most common recipe around for comparisons is to use sprintf to cut the decimals to size and then compare strings. Seems ugly. The non-stringification way to do it is usually along the lines of: if (abs($value1 - $value2)

Re: Comparing rationals/floats

2005-04-15 Thread Doug McNutt
At 16:18 -0700 4/15/05, gcomnz wrote: More questions stemming from cookbook work... Decimal Comparisons: The most common recipe around for comparisons is to use sprintf to cut the decimals to size and then compare strings. Seems ugly. The non-stringification way to do it is usually along the

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Michael G Schwern
On Fri, Apr 15, 2005 at 11:52:38PM +0200, Juerd wrote: becomes an unverifiable operation. You have to use chdir() if you want to error check and $CWD is reduced to a scripting feature. Well, after failure it can be cwd() but false without breaking any real code, because normally, you'd

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Larry Wall
On Fri, Apr 15, 2005 at 03:22:48PM -0700, Michael G Schwern wrote: : On Fri, Apr 15, 2005 at 11:52:38PM +0200, Juerd wrote: : becomes an unverifiable operation. You have to use chdir() if you want to : error check and $CWD is reduced to a scripting feature. : : Well, after failure it can

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Chip Salzenberg
According to Michael G Schwern: And this is exactly what File::chdir does. $CWD is a tied scalar. I don't think current directory maps well on a variable. That won't stop people from using it, of course. :-( There are several methods to determine the current directory. Each one has its

Re: $*CWD instead of chdir() and cwd()

2005-04-15 Thread Chip Salzenberg
According to chromatic: On Fri, 2005-04-15 at 23:52 +0200, Juerd wrote: Well, after failure it can be cwd() but false without breaking any real code, because normally, you'd never if (cwd) { ... }, simply because there's ALWAYS a cwd. Not always -- try removing a directory that's the pwd

Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-15 Thread Michael G Schwern
On Fri, Apr 15, 2005 at 08:31:57PM -0400, Chip Salzenberg wrote: According to Michael G Schwern: And this is exactly what File::chdir does. $CWD is a tied scalar. I don't think current directory maps well on a variable. That won't stop people from using it, of course. :-( There are