Extending classes in a lexical scope?

2009-01-12 Thread Ovid
Let's say two people want to add a 'shuffle' method to all arrays. Alice wants to have it look like this: method shuffle (*...@array is rw) { @array .= pick(*); } Bob wants it to look like this: method shuffle (*...@array is rw) { @array = @array[0 .. @array/2] Z @arr...@array

Re: what is going on here?

2009-01-12 Thread Richard Hainsworth
Larry Wall wrote: On Sat, Jan 10, 2009 at 11:26:50PM +0300, Richard Hainsworth wrote: More precisely, I dont understand the meaning of the ':' after '.sort' It is turning the method call into a list operator, essentially. It's not the so-called indirect object syntax, or it would be wr

Revised solution #2

2009-01-12 Thread Richard Hainsworth
Of course whenever I post to this list I make some sort of mistake, like including a test version that does not parse in perl6. Hopefully, I have eliminated all the mistakes. The following is a revised version due to Carl Masak. The problem and model perl5 solution by Jan Dubois (a member of th

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: Ovid > > This patch implements the .trim() method for strings. > > Now that I'm reading S29, I see there is no .trim() method there. I got that > because it was referenced in pugs in the cookbook (not in tests, though) and > I > was trying to get the exam

Re: [perl #62198] Rakudo: array and hash elements don't interpolate into strings

2009-01-12 Thread Carl Mäsak
Markus Laker (>): > Scalar variables interpolate, but array and hash elements don't: > > m...@edward:~$ perl6 -e 'my $a = 1; say "$a"' > 1 > m...@edward:~$ perl6 -e 'my @a = 1; say "@a[0]"' > @a[0] > m...@edward:~$ perl6 -e 'my @a = 1; say "@a[]"' > @a[] > m...@edward:~$ perl6 -e 'my %h = (one => 1

Re: Not a bug?

2009-01-12 Thread Carl Mäsak
Ovid (>): > $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}"' > ~ foo ~ Easy solution: only use double quotes when you want to interpolate. :) This is not really an option when running 'perl6 -e' under bash, though. // Carl

Re: [perl #57882] Trying to assign to a class attribute within a class declaration in rakudo makes Parrot segfault

2009-01-12 Thread Carl Mäsak
Patrick (>), Carl (>>): >> r30188: >> $ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults >> Lexical 'self' not found >> [...] >> Segmentation fault >> >> Not sure if the error message from Pugs is right either. Should it be >> looking for 'self' at this stage? What should the program really

Read access to class-scope variables from the class scope

2009-01-12 Thread Carl Mäsak
Writing something like this in Rakudo yesterday, I was slightly surprised to find it not working: class SomeClass { my $.warn_limit = 1000; my $.stern_warn_limit = $.warn_limit * 1.05; my $.expel_limit = $.warn_limit * 1.10; # ... } The specific error from Rakudo is "Lexical '

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: > Is it possible to modify the core Perl6Array class like that (without extra > keywords)? If so, is it possible for each programmer to make such a change > so that it's lexically scoped? AFAIK, it is not possible to modify a core class; however, I believe that it _is_ possible to d

Re: Not a bug?

2009-01-12 Thread Jon Lang
On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak wrote: > Ovid (>): >> $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}"' >> ~ foo ~ > > Easy solution: only use double quotes when you want to interpolate. :) > > This is not really an option when running 'perl6 -e' under bash, though. $ perl6 -e 'my

[perl #62226] ~ in regexes shouldn't cause thrown excpetions

2009-01-12 Thread via RT
# New Ticket Created by Moritz Lenz # Please include the string: [perl #62226] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62226 > Rakudo r35221: regex t1 { '(' ~ ')' 'ab' } 'x(ab' !~~ m//; say "done", The regex

[perl #62222] [BUG] r34778 - code takes forever

2009-01-12 Thread Mark A. Hershberger
# New Ticket Created by (Mark A. Hershberger) # Please include the string: [perl #6] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=6 > Again, playing around with Euler, wrote myself a simple little class to genera

[perl #62224] macro not working

2009-01-12 Thread via RT
# New Ticket Created by Richard Hainsworth # Please include the string: [perl #62224] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62224 > I have the following in a file test.pl macro doit ($word) { return quasi >> <<<

Re: [PATCH] Add .trim method

2009-01-12 Thread Carl Mäsak
Ovid (>): > =item trim > > our Str multi Str::trim ( Str $string ) > > Removes leading and trailing whitespace from a string. > > =cut > > I could optionally make the following work: > > $string.trim(:leading<0>); > $string.trim(:trailing<0>); > > Setting leading or trailing to false (the

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > > =item trim > > > > our Str multi Str::trim ( Str $string ) > > > > Removes leading and trailing whitespace from a string. > > > > =cut > > > > I could optionally make the following work: > > > > $string.trim(:leading<0>); > > $string.trim(:trailing<0>); >

Parrot Bug Summary

2009-01-12 Thread Parrot Bug Summary
Parrot Bug Summary http://rt.perl.org/rt3/NoAuth/parrot/Overview.html Generated at Mon Jan 12 14:00:01 2009 GMT --- * Numbers * New Issues * Overview of Open Issues * Ticket Status By Version * Requestors with m

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > > > I could optionally make the following work: > > > > > > $string.trim(:leading<0>); > > > $string.trim(:trailing<0>); Alternatively, those could be ltrim() and rtrim(). If you need to dynamically determine what you're going to trim, you'd couldn't just set va

Re: [PATCH] Add .trim method

2009-01-12 Thread jesse
On Mon, Jan 12, 2009 at 07:01:25AM -0800, Ovid wrote: > > > > I could optionally make the following work: > > > > > > > > $string.trim(:leading<0>); > > > > $string.trim(:trailing<0>); > > Alternatively, those could be ltrim() and rtrim(). 'left' and 'right' are probably not the right name

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Ovid [2009-01-12 16:05]: > Or all could be allowed and $string.trim(:leading<0>) could all > $string.rtrim internally. ++ Regards, -- Aristotle Pagaltzis //

Re: [PATCH] Add .trim method

2009-01-12 Thread Jonathan Worthington
Aristotle Pagaltzis wrote: * Ovid [2009-01-12 16:05]: Or all could be allowed and $string.trim(:leading<0>) could all $string.rtrim internally. ++ Note you can write it :!leading too. :-) Jonathan

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: jesse > > On Mon, Jan 12, 2009 at 07:01:25AM -0800, Ovid wrote: > > > > > I could optionally make the following work: > > > > > > > > > > $string.trim(:leading<0>); > > > > > $string.trim(:trailing<0>); > > > > Alternatively, those could be ltrim() and rtri

Re: [PATCH] Add .trim method

2009-01-12 Thread Gianni Ceccarelli
On 2009-01-12 Ovid wrote: > Um, er. Damn. Now I'm wondering how my "leading" and "trailing" > trimming works with Hebrew. How are the strings implemented > internally? RTL (and bidi) languages are written in strings so that the character order is the logical, reading, order. That is, the chara

Re: Not a bug?

2009-01-12 Thread Tim Bunce
On Sun, Jan 11, 2009 at 04:41:12PM -0800, Ovid wrote: > I really don't think this is a bug, but it did confuse the heck out of me at > first. This *is* expected behavior due to how {} is interpolated in strings, > yes? > > $ perl6 -e 'my $foo = "foo";say "<" ~ $foo ~ ">"' > > $ perl6 -e

Re: Not a bug?

2009-01-12 Thread TSa
HaloO, Tim Bunce wrote: On Sun, Jan 11, 2009 at 04:41:12PM -0800, Ovid wrote: I really don't think this is a bug, but it did confuse the heck out of me at first. This *is* expected behavior due to how {} is interpolated in strings, yes? $ perl6 -e 'my $foo = "foo";say "<" ~ $foo ~ ">"'

Re: [PATCH] Add .trim method

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote: : ...the trivial $string.trim and trim($string) case. Hmm, I'd think .trim should work like .chomp, and return the trimmed string without changing the original. You'd use $str.=trim to do it in place. Can't say I really like the negated optio

[perl #62200] [BUG] Role composition failure: erroneous method conflict

2009-01-12 Thread jn...@jnthn.net via RT
On Sun Jan 11 14:06:52 2009, moritz wrote: > On Sun Jan 11 12:02:21 2009, matt-w wrote: > > Put this code through Rakudo: > > > > use v6; > > > > role TestRole { > > method foo() { ... } > > } > > > > class TestClass does TestRole { > > method foo() { say "render"; } > > } > > > > my Te

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: Larry Wall > On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote: > : ...the trivial $string.trim and trim($string) case. > > Hmm, I'd think .trim should work like .chomp, and return the trimmed > string without changing the original. You'd use $str.=trim t

Re: [PATCH] Add .trim method

2009-01-12 Thread Jonathan Worthington
Ovid wrote: - Original Message In the pir, doesn't the "s = self" line copy self, thus ensuring that I'm changing "s" and not "self"? No, it's binding. Or do I need "s = clone self" (or however it's written). Yeah, but also note that substr would return a copy... Can't sa

Re: [PATCH] Add .trim method

2009-01-12 Thread Carl Mäsak
Jonathan (>), Ovid (>>), Larry (>>>): >>> Can't say I really like the negated options though. They smell funny. >> >> Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike. >> Suggestions welcome as I can't think of anything better. > > The .Net framework calls 'em TrimStart an

Re: [PATCH] Add .trim method

2009-01-12 Thread Geoffrey Broadwell
On Mon, 2009-01-12 at 07:01 -0800, Ovid wrote: > - Original Message > > > > > > I could optionally make the following work: > > > > > > > > $string.trim(:leading<0>); > > > > $string.trim(:trailing<0>); > > Alternatively, those could be ltrim() and rtrim(). If you need to > dynamica

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: Geoffrey Broadwell > When I saw your proposed syntax above, instead of reading "don't trim > leading/trailing whitespace", I read "change the definition of > 'whitespace' to 'codepoint 0' for leading/trailing". > > That of course raises the question of how on

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > >> Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike. > >> Suggestions welcome as I can't think of anything better. > > > > The .Net framework calls 'em TrimStart and TrimEnd (and has a Trim that does > > both). So maybe trim_start and trim_en

Re: [PATCH] Add .trim method

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 09:33:32AM -0800, Geoffrey Broadwell wrote: : That of course raises the question of how one *would* properly override : trim's concept of whitespace Well, given that .trim is essentially just .comb(/\S.*\S/), which in turn is really just m:g/(\S.*\S)/, I don't see much

Re: [PATCH] Add .trim method

2009-01-12 Thread Andy Colson
Larry Wall wrote: On Mon, Jan 12, 2009 at 05:04:50AM -0800, Ovid wrote: : ...the trivial $string.trim and trim($string) case. Hmm, I'd think .trim should work like .chomp, and return the trimmed string without changing the original. You'd use $str.=trim to do it in place. Can't say I really li

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Ovid [2009-01-12 18:40]: > 1. No params, trim all > 2. :start or :end, only trim that bit (not a negated option :) > 3. If both, goto 1 Also `:!start` to imply `:end` unless `:!end` (which in turn implies `:start` unless `:!end`)? I’d like not to have to type `.trim(:start)` when I could ju

Re: [PATCH] Add .trim method

2009-01-12 Thread Mark J. Reed
On Mon, Jan 12, 2009 at 2:50 PM, Aristotle Pagaltzis wrote: > I'd like not to have to type `.trim(:start)` when I could just do > `.ltrim` though. As long as we gloss .ltrim as "leading" trim rather than "left" trim. Then the other end could be .ttrim for "trailing"? We really ought to avoid usi

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > Also `:!start` to imply `:end` unless `:!end` (which in turn > implies `:start` unless `:!end`)? > > I’d like not to have to type `.trim(:start)` when I could just do > `.ltrim` though. So what would .ltrim do with this? " בָּרוּךְ שֵׁם כְּבוֹד מַלְכוּתוֹ לְע

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Aristotle Pagaltzis [2009-01-12 20:55]: > Also `:!start` to imply `:end` unless `:!end` (which in turn > implies `:start` unless `:!end`)? Ugh, forget this, I was having a blank moment. Actually that makes me wonder now whether it’s actually a good idea at all to make the function parametrisab

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Ovid [2009-01-12 21:20]: > Since that's RTL (Right To Left) text, should ltrim remove the > leading or trailing whitespace? > > I like Jonathan's trim_start and trim_end. Let me ask you first: does a string that runs Right-to-Left start at the left and end at the right or start at the right and

Re: [PATCH] Add .trim method

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 09:18:03PM +0100, Aristotle Pagaltzis wrote: : Plus if there are separate `.ltrim` and `.rtrim` functions it : would be better to implement `.trim` by calling them rather than : vice versa, so it wouldn’t even be less efficient two make two : calls rather than a parametrised

Re: [PATCH] Add .trim method

2009-01-12 Thread Austin Hastings
Aristotle Pagaltzis wrote: Actually that makes me wonder now whether it’s actually a good idea at all to make the function parametrisable at all. Even `.ltrim.rtrim` is shorter and easier than `.trim(:start,:end)`! How about .trim(:l, :r) with both as the default? And if the rtl crowd makes

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: Aristotle Pagaltzis > > I like Jonathan's trim_start and trim_end. > > Let me ask you first: does a string that runs Right-to-Left start > at the left and end at the right or start at the right and end at > the left? > > Now to answer your question, *I* know

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Larry Wall [2009-01-12 21:55]: > * Aristotle Pagaltzis [2009-01-12 21:20]: > > Plus if there are separate `.ltrim` and `.rtrim` functions it > > would be better to implement `.trim` by calling them rather > > than vice versa, so it wouldn’t even be less efficient two > > make two calls rather t

Re: Not a bug?

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 03:43:47AM -0800, Jon Lang wrote: : On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak wrote: : > Ovid (>): : >> $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}"' : >> ~ foo ~ : > : > Easy solution: only use double quotes when you want to interpolate. :) : > : > This is not rea

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Ovid [2009-01-12 22:05]: > I see your point And now I see yours. I was visualising the memory layout of a string, wherein a right-to-left string gets displayed from the right end of it’s in-memory representation so “left” and “right” are absolutes in that picture. But of course RTL reverses the

Re: Not a bug?

2009-01-12 Thread Jon Lang
On Mon, Jan 12, 2009 at 1:08 PM, Larry Wall wrote: > On Mon, Jan 12, 2009 at 03:43:47AM -0800, Jon Lang wrote: > : On Mon, Jan 12, 2009 at 2:15 AM, Carl Mäsak wrote: > : > Ovid (>): > : >> $ perl6 -e 'my $foo = "foo";say "{" ~ $foo ~ "}"' > : >> ~ foo ~ > : > > : > Easy solution: only use doub

Re: [PATCH] Add .trim method

2009-01-12 Thread Aristotle Pagaltzis
* Austin Hastings [2009-01-12 22:00]: > How about .trim(:l, :r) with both as the default? Liveable. > And if the rtl crowd makes a furor, we can add :a/:o or :ת/:א > or something. *grin* Maybe :h and :t (head/tail). > Useful for doing infrequent things. IMO, left and right > trimming are inf

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: Aristotle Pagaltzis > * Austin Hastings [2009-01-12 22:00]: > > How about .trim(:l, :r) with both as the default? > > Liveable. I've just committed the pugs tests for trim. However, it's just 'trim' with no left/right, leading/trailing, Catholic/Protestant

[perl #62244] [BUG] recent rakudo changes have broken NCI

2009-01-12 Thread via RT
# New Ticket Created by Donald Hunter # Please include the string: [perl #62244] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62244 > It appears that rakudo changes committed over the weekend have broken NCI. The last kno

Re: [PATCH] Add .trim method

2009-01-12 Thread Jonathan Scott Duff
On Mon, Jan 12, 2009 at 9:01 AM, Ovid wrote: > - Original Message > > > > > > I could optionally make the following work: > > > > > > > > $string.trim(:leading<0>); > > > > $string.trim(:trailing<0>); > > Alternatively, those could be ltrim() and rtrim(). If you need to > dynamically d

Re: [perl #62244] AutoReply: [BUG] recent rakudo changes have broken NCI

2009-01-12 Thread Donald Hunter
grind.pid12075 Description: Binary data

Re: [PATCH] Add .trim method

2009-01-12 Thread Dave Whipp
Ovid wrote: $string.trim(:leading<0>); $string.trim(:trailing<0>); Setting leading or trailing to false (they default to true) would result in either leading or trailing whitespace not being trimmed Alternatively, those could be ltrim() and rtrim(). If you need to dynamically de

[perl #62260] [BUG] END blocks don't see external variables

2009-01-12 Thread publiustemp-perl6compil...@yahoo.com (via RT)
# New Ticket Created by publiustemp-perl6compil...@yahoo.com # Please include the string: [perl #62260] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62260 > This is blocking me implementing a simple 'plan "no_plan"' for t

Re: Not a bug?

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 01:19:12PM -0800, Jon Lang wrote: : As well, isn't there a way to escape a character that would otherwise : be interpolated? If the intent were as you suppose, the original : could be rewritten as: : : $ perl6 -e 'my $foo = "foo";say "\{" ~ $foo ~ "}"' Sure, though in a

[PATCH] Revised .trim patch

2009-01-12 Thread Ovid
Seems Larry's agreed to the .trim method. There are bits that are not agreed upon, so this patch only implements what we've agreed upon. It relies on the new S29-str/trim.t test in pugs. I committed that earlier and updated t/spectest.data. In other words, the patch is a tad clearer and no

Re: Extending classes in a lexical scope?

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 03:38:04AM -0800, Jon Lang wrote: : Ovid wrote: : > Is it possible to modify the core Perl6Array class like that (without extra keywords)? If so, is it possible for each programmer to make such a change so that it's lexically scoped? : : AFAIK, it is not possible to modi

Re: [PATCH] Add .trim method

2009-01-12 Thread Andy Lester
On Jan 12, 2009, at 11:27 AM, Carl Mäsak wrote: How about .trim(:start) and .trim(:end)? And .trim(:both) for orthogonality. -- Andy Lester => a...@petdance.com => www.petdance.com => AIM:petdance

Re: Extending classes in a lexical scope?

2009-01-12 Thread Moritz Lenz
Larry Wall wrote: > : however, I believe > : that it _is_ possible to derive a new class whose "name" differs from > : an existing class only in terms of version information, such that it > : is substituted for the original class within the lexical scope where > : it was defined, barring explicit i

Re: Extending classes in a lexical scope?

2009-01-12 Thread Ovid
- Original Message > From: Moritz Lenz > > That is the preferred way to avoid action-at-a-distance in P6. > > so if I do that, will a 'my @a' use that new Array class? > > Actually I'd prefer it if there were some kind of mechanism to set a > default implementation type, so that I cou

Re: [PATCH] Add .trim method

2009-01-12 Thread Moritz Lenz
Carl Mäsak wrote: > Jonathan (>), Ovid (>>), Larry (>>>): Can't say I really like the negated options though. They smell funny. >>> >>> Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike. >>> Suggestions welcome as I can't think of anything better. >> >> The .Net framew

Trimming arrays

2009-01-12 Thread Ovid
What should this output? my @array = ' foo ', ' bar '; @array .= trim; say @array.perl; And what if I have an array of hashes of hashes of arrays? Currently you can call 'trim' on arrays, but it's a no-op. Similar issues with chomp and friends. Cheers, Ovid -- Buy the book

Re: Trimming arrays

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 03:05:21PM -0800, Ovid wrote: : What should this output? : : my @array = ' foo ', ' bar '; : @array .= trim; : : say @array.perl; : : And what if I have an array of hashes of hashes of arrays? : : Currently you can call 'trim' on arrays, but it's a no-op.

Re: Trimming arrays

2009-01-12 Thread Ovid
- Original Message > From: Larry Wall > : my @array = ' foo ', ' bar '; > : @array .= trim; > : > : say @array.perl; > : > : And what if I have an array of hashes of hashes of arrays? > : > : Currently you can call 'trim' on arrays, but it's a no-op. Similar issues >

Re: [PATCH] Add .trim method

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 06:36:55PM +0100, Moritz Lenz wrote: : Carl Mäsak wrote: : > Jonathan (>), Ovid (>>), Larry (>>>): : Can't say I really like the negated options though. They smell funny. : >>> : >>> Agreed, but ltrim and rtrim will disappoint Israelis and dyslexics alike. : >>> Sugge

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: > Actually, I'd prefer to go much further than this: > > use Core 'MyCore'; > > And have that override core classes lexically. > > That solves the "but I want it MY way" issue that many Perl and Ruby > programmers have, but they don't shoot anyone else in the foot. Since 'use' import

Re: [PATCH] Add .trim method

2009-01-12 Thread Mark J. Reed
On Mon, Jan 12, 2009 at 4:19 PM, Aristotle Pagaltzis wrote: > Maybe :h and :t (head/tail). I like the echo of the csh pathname modifiers there. Unless that confuses people into thinking that .trim has something to do with pathname canonicalization... -- Mark J. Reed

Re: Extending classes in a lexical scope?

2009-01-12 Thread Ovid
- Original Message > From: Jon Lang > > Actually, I'd prefer to go much further than this: > > > > use Core 'MyCore'; > > > > And have that override core classes lexically. > > > > That solves the "but I want it MY way" issue that many Perl and Ruby > programmers have, but they don't

Re: [PATCH] Add .trim method

2009-01-12 Thread jason switzer
On Mon, Jan 12, 2009 at 9:07 AM, jesse wrote: > > 'left' and 'right' are probably not the right names for functions which > trim leading and/or trailing space, since their meanings get somewhat > ambiguous if a language renders right-to-left instead of left-to-right > or vice-versa > I'm in favo

Trimming; left or start? (was: Re: [PATCH] Add .trim method)

2009-01-12 Thread Timothy S. Nelson
Can I make a suggestion? From my point of view, it'd be nice if the trim method supported: - left/right (leftmost/rightmost part of the string; language-independent) - start/end (start and end of string; could be leading/trailing instead) - both How would that work?

Re: [PATCH] Add .trim method

2009-01-12 Thread Ovid
- Original Message > From: jason switzer > If we wanted language dependent version, use :leading, :trailing, and :both. > That will require each implementation properly handle the language > variations. I think :start and :end are my favorites. Huffman++ (maybe :begin and :end for c

Re: Not a bug?

2009-01-12 Thread jason switzer
On Mon, Jan 12, 2009 at 3:54 PM, Larry Wall wrote: > On Mon, Jan 12, 2009 at 01:19:12PM -0800, Jon Lang wrote: > : As well, isn't there a way to escape a character that would otherwise > : be interpolated? If the intent were as you suppose, the original > : could be rewritten as: > : > : $ per

Re: Extending classes in a lexical scope?

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 02:43:37PM -0800, Ovid wrote: : Actually, I'd prefer to go much further than this: : : use Core 'MyCore'; : : And have that override core classes lexically. We're already speccing a way to substitute a different prelude from the command line, in order to desugar -n and

Re: Extending classes in a lexical scope?

2009-01-12 Thread Jon Lang
Ovid wrote: > - Original Message > >> From: Jon Lang > >> > Actually, I'd prefer to go much further than this: >> > >> > use Core 'MyCore'; >> > >> > And have that override core classes lexically. >> > >> > That solves the "but I want it MY way" issue that many Perl and Ruby >> programme

Re: [PATCH] Add .trim method

2009-01-12 Thread jason switzer
On Mon, Jan 12, 2009 at 6:26 PM, Ovid wrote: > - Original Message > > > From: jason switzer > > > If we wanted language dependent version, use :leading, :trailing, and > :both. > > That will require each implementation properly handle the language > > variations. > > I think :start and :

Re: Extending classes in a lexical scope?

2009-01-12 Thread Larry Wall
On Mon, Jan 12, 2009 at 04:38:07PM -0800, Jon Lang wrote: : No, you don't understand me. The Foo/Bar example I was giving was : independent of your example. Rephrasing in your terms, consider the : possibility of a class that's derived from Array, for whatever reason; : call it "Ring". Now you d