Re: scalar subscripting

2004-07-22 Thread Hans Ginzel
Hello, I wish to be consistent with shall, so `.' is literal dot in double strings. I prefer "$file.ext" or "${file}.ext". For method calls ``$()'' could be used: "$($foo.bar)". Perhaps, what does "${foo.bar}" mean? Best regards

Re: scalar subscripting

2004-07-17 Thread Jonadab the Unsightly One
Larry Wall <[EMAIL PROTECTED]> writes: > And if we do that, I guess that means that "$«file».ext" could be > made to work as a replacement, which seems conceptually clean if you > don't think about it too hard. Now that you put it that way, $( $file ).ext doesn't seem so bad, the visually-distrac

Re: scalar subscripting

2004-07-15 Thread James Mastros
Larry Wall wrote: I suppose another approach is simply to declare that dot is always a metacharacter in double quotes, and you have to use \. for a literal dot, just as in regexen. That approach would let us interpolate things like .foo without a variable on the left. That could cause a great dea

Re: scalar subscripting

2004-07-14 Thread Dan Hursh
Larry Wall wrote: On Wed, Jul 14, 2004 at 10:23:18AM -0700, Larry Wall wrote: : Another alternative is "$( $file ).ext". I'd tend to use that before : "${file}.ext" these days. Perhaps that's irrational--but it was hard : to get the special-case "${name}" form to work right in the Perl 5 : lexer,

Re: scalar subscripting

2004-07-14 Thread Larry Wall
On Wed, Jul 14, 2004 at 10:23:18AM -0700, Larry Wall wrote: : Another alternative is "$( $file ).ext". I'd tend to use that before : "${file}.ext" these days. Perhaps that's irrational--but it was hard : to get the special-case "${name}" form to work right in the Perl 5 : lexer, and that bugs me.

Re: scalar subscripting

2004-07-14 Thread Larry Wall
On Sun, Jul 11, 2004 at 11:06:30PM -0400, Jonadab the Unsightly One wrote: : Larry Wall <[EMAIL PROTECTED]> writes: : : > No, just currently wrong. :-) I changed my mind about it in A12, : > partly on the assumption that $object.attr would actually be more : > common than $file.ext, : : Speaking

Re: scalar subscripting

2004-07-14 Thread Austin Hastings
--- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote: > Of course, this leaves open the question of whether there are any > fairly common filename extensions that happen to be spelled the same > as a method on Perl6's string class, that might ought to have a > warning generated... Are there a

Re: scalar subscripting

2004-07-14 Thread Jonadab the Unsightly One
Larry Wall <[EMAIL PROTECTED]> writes: > No, just currently wrong. :-) I changed my mind about it in A12, > partly on the assumption that $object.attr would actually be more > common than $file.ext, Speaking of which, what's the cleanest way to interpolate filenames with a fixed extension now?

Re: scalar subscripting

2004-07-13 Thread Luke Palmer
> > > my $newfile = "$str.subst(rx|\.\w+$|, '')\.bin"; > >But what about the value of $str after interpolation? > In shall it stays it's original value! I would often need, > to use a little modified value of $str for a particular expression. > I like the way shell does it, to be able

Re: scalar subscripting

2004-07-13 Thread Hans Ginzel
On Fri, Jul 09, 2004 at 05:02:48PM +0100, Jonathan Worthington wrote: > > >Are there plans in Perl 6 for string modifiers? > > Not exactly. But method calls can be interpolated into strings, so most > > > As they are in bash eg.: > > > ${var%glob_or_regexp} > > > ${var%%glob_or_regexp} > > > >

Re: scalar subscripting

2004-07-12 Thread Austin Hastings
--- Juerd <[EMAIL PROTECTED]> wrote: > Piers Cawley skribis 2004-07-12 12:20 (+0100): > > method postcircumfix:[] is rw { ... } > > Compared to Ruby, this is very verbose. > > def [] (key) > ... > end > > # Okay, not entirely fair, as the Ruby version would also > # nee

Re: scalar subscripting

2004-07-12 Thread Juerd
Simon Cozens skribis 2004-07-12 12:58 (+0100): > [EMAIL PROTECTED] (Juerd) writes: > > Could methods like "[]" and "{}" *default* to "postcircumfix:"? > A more interesting question is "does it mean anything for them *not* to be > postcircumfix"? Not as a method, I think. > After all, the only oth

Re: scalar subscripting

2004-07-12 Thread Simon Cozens
[EMAIL PROTECTED] (Juerd) writes: > Could methods like "[]" and "{}" *default* to "postcircumfix:"? A more interesting question is "does it mean anything for them *not* to be postcircumfix"? After all, the only other use would be "$foo.[]($bar, $baz)", which is practically identical. Unless you w

Re: scalar subscripting

2004-07-12 Thread Juerd
Piers Cawley skribis 2004-07-12 12:20 (+0100): > method postcircumfix:[] is rw { ... } Compared to Ruby, this is very verbose. def [] (key) ... end # Okay, not entirely fair, as the Ruby version would also # need []= defined for the rw part. Could methods like "[]" and

Re: scalar subscripting

2004-07-12 Thread Piers Cawley
Luke Palmer <[EMAIL PROTECTED]> writes: > Gautam Gopalakrishnan writes: >> Hello, >> >> I've tried the archives and the 'Perl 6 essentials' book and I can't >> find anything >> about string subscripting. Since $a[0] cannot be mistaken for array subscripting >> anymore, could this now be used to p

Re: scalar subscripting

2004-07-09 Thread Larry Wall
On Fri, Jul 09, 2004 at 05:02:48PM +0100, Jonathan Worthington wrote: : Would that not be:- : : say "Basename is $(str.subst(rx|.*/|, ''))" : : I thought when you were interpolating method calls you had to put brackets : $(object.meth), so that you could still write things like:- : : $fh = o

Re: scalar subscripting

2004-07-09 Thread Jonathan Worthington
"Luke Palmer" <[EMAIL PROTECTED]> wrote: > Hans Ginzel writes: > > On Thu, Jul 08, 2004 at 09:12:16PM +1000, Gautam Gopalakrishnan wrote: > > > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > > > anymore, could this now be used to peep into scalars? Looks easier t

Re: scalar subscripting

2004-07-08 Thread Luke Palmer
Hans Ginzel writes: > On Thu, Jul 08, 2004 at 09:12:16PM +1000, Gautam Gopalakrishnan wrote: > > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > > anymore, could this now be used to peep into scalars? Looks easier than using > >Are there plans in Perl 6 for s

Re: scalar subscripting

2004-07-08 Thread Hans Ginzel
On Thu, Jul 08, 2004 at 09:12:16PM +1000, Gautam Gopalakrishnan wrote: > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > anymore, could this now be used to peep into scalars? Looks easier than using Are there plans in Perl 6 for string modifiers? As they are i

Re: scalar subscripting

2004-07-08 Thread Luke Palmer
Gautam Gopalakrishnan writes: > Hello, > > I've tried the archives and the 'Perl 6 essentials' book and I can't > find anything > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > anymore, could this now be used to peep into scalars? Looks easier than using > subst

Re: scalar subscripting

2004-07-08 Thread Juerd
Gautam Gopalakrishnan skribis 2004-07-08 21:12 (+1000): > about string subscripting. Since $a[0] cannot be mistaken for array subscripting > anymore, could this now be used to peep into scalars? Looks easier than using $a[0] is $a.[0]. That means that if there is a @$a, it still is array subscript

scalar subscripting

2004-07-08 Thread Gautam Gopalakrishnan
Hello, I've tried the archives and the 'Perl 6 essentials' book and I can't find anything about string subscripting. Since $a[0] cannot be mistaken for array subscripting anymore, could this now be used to peep into scalars? Looks easier than using substr or unpack. Hope I've not missed anything o