Re: String interpolation

2004-07-21 Thread Juerd
Larry Wall skribis 2004-07-21 12:25 (-0700): > I'm inclining more towards the "only interpolate things that end with > brackets or parens" rule. That would allow $foo.bar() to interpolate, > but not $foo.bar. Anything that is decided by something's end makes things hard to read, hard to learn and

Re: String interpolation

2004-07-21 Thread David Manura
Two points, if I may jump in here: (1) If the interpolation rule is to be simple as suggested, why not impose this rule: "A character (except for a backslash) is interpreted literally if it is not preceeded by a backslash." For example, "The value is \$foo.bar()." --> "The value is 3." "T

Re: String interpolation

2004-07-21 Thread Luke Palmer
Uri Guttman writes: > LW> : so method calls would need the $() or @() wrappers as do all expressions > LW> : beyond simple scalar value lookup. that means $foo, @foo[0], $foo[0], > LW> : %foo{'bar'} and $foo{'bar'} all interpolate and only their variants > LW> : (longer index/key expression

Re: String interpolation

2004-07-21 Thread Brent 'Dax' Royal-Gordon
Uri Guttman wrote: how would you put in the literal string $foo.bar()? escaping the . or the ( ? The dollar sign. (Or, if you wanted to interpolate $foo while leaving the .bar() intact, I would imagine that either \. or \( would suffice.) -- Brent "Dax" Royal-Gordon <[EMAIL PROTECTED]> Perl and

Re: String interpolation

2004-07-21 Thread Uri Guttman
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> On Tue, Jul 20, 2004 at 08:42:48PM -0400, Uri Guttman wrote: LW> Many expressions are naturally scalar even in list context. Most LW> operators force scalar context unless you hyper them. In particular, LW> the new unary operators

Re: String interpolation

2004-07-21 Thread Larry Wall
On Wed, Jul 21, 2004 at 11:06:55PM +0200, Juerd wrote: : Larry Wall skribis 2004-07-21 10:24 (-0700): : > Interpolates : > NoYes : > ----- : > @foo @foo[1] : > %bar %bar{"a"} : > $foo.bar $foo.bar() : : Oh, please don't do that. : : Whatever inte

Re: String interpolation

2004-07-21 Thread Larry Wall
On Thu, Jul 22, 2004 at 12:31:08AM +0400, Alexey Trofimenko wrote: : I used $d='b' ,and not $d="b" above, just because it should be $d=\"b\" : yes, I know, perl5 parser makes several passes on quotes, and when it sees : open quote, it finds closing quote first, then parses all inside. : AFAIK, pe

Re: String interpolation

2004-07-21 Thread Juerd
Larry Wall skribis 2004-07-21 10:24 (-0700): > Interpolates > NoYes > ----- > @foo @foo[1] > %bar %bar{"a"} > $foo.bar $foo.bar() Oh, please don't do that. Whatever interpolation thing is invented, make it SIMPLE. Allowing @foo[1]

Re: String interpolation

2004-07-21 Thread Alexey Trofimenko
On Wed, 21 Jul 2004 10:21:58 -0700 (PDT), Austin Hastings <[EMAIL PROTECTED]> wrote: --- Larry Wall <[EMAIL PROTECTED]> wrote: If {...} supplies list context by default, most intepolations are either the same length or shorter: $($foo) {$foo} @(@foo) [EMAIL PROTECTED] $(@foo)

Re: String interpolation

2004-07-21 Thread Jonathan Scott Duff
On Wed, Jul 21, 2004 at 12:39:57PM -0600, Luke Palmer wrote: > Jonathan Scott Duff writes: > > On Wed, Jul 21, 2004 at 07:35:08PM +0200, Aldo Calpini wrote: > > > Larry Wall wrote: > > > > > > >Hmm. That makes me wonder what the slice notation for "everything" is. > > > > > > > > > > > maybe @fo

Re: String interpolation

2004-07-21 Thread Larry Wall
On Tue, Jul 20, 2004 at 08:42:48PM -0400, Uri Guttman wrote: : and how do you force scalar context without a scalar() or $() wrapper : around the expression in {}? hard to say whether scalar or list context : is more popular and so would get the huffman prize. i liked @() and $() : for both context

Re: String interpolation

2004-07-21 Thread Brent 'Dax' Royal-Gordon
Luke Palmer wrote: I suppose another good thing is that it makes unneccesary the balanced brace rule in qq{} that was there in Perl 5: all braces need to be backwhacked now. However, all braces need to be backwhacked now. Ugh. I was dreading code-generating heredocs, but with the inclusion of \qq[

Re: String interpolation

2004-07-21 Thread Larry Wall
On Wed, Jul 21, 2004 at 12:36:51PM -0600, Luke Palmer wrote: : Brent 'Dax' Royal-Gordon writes: : > The equivalent regex syntax isn't interpolating, even to the extent that : > a bare $foo or @bar is, so this would be sort of a "false cognate"--IMHO : > another reason not to have interpolating {}.

Re: String interpolation

2004-07-21 Thread Luke Palmer
Jonathan Scott Duff writes: > On Wed, Jul 21, 2004 at 07:35:08PM +0200, Aldo Calpini wrote: > > Larry Wall wrote: > > > > >Hmm. That makes me wonder what the slice notation for "everything" is. > > > > > > > > maybe @foo[..] (a short form for @foo[0..Inf]) ? > > Surely you mean [EMAIL PROTECTE

Re: String interpolation

2004-07-21 Thread Luke Palmer
Brent 'Dax' Royal-Gordon writes: > Luke Palmer wrote: > >I admit there's a certain interest to Larry's new idea. I've been > >looking for more distinction between $, @, and % in Perl 6, since they > >start to become mostly irrelavent. In the new proposal: > > > >my @a = (1,2,3,4,5); > >my

Re: String interpolation

2004-07-21 Thread Larry Wall
On Wed, Jul 21, 2004 at 07:35:08PM +0200, Aldo Calpini wrote: : Larry Wall wrote: : : >Hmm. That makes me wonder what the slice notation for "everything" is. : > : > : maybe @foo[..] (a short form for @foo[0..Inf]) ? %foo{..} should also be : allowed, of course (which : unfortunately is not a s

Re: String interpolation

2004-07-21 Thread Jonathan Scott Duff
On Wed, Jul 21, 2004 at 07:35:08PM +0200, Aldo Calpini wrote: > Larry Wall wrote: > > >Hmm. That makes me wonder what the slice notation for "everything" is. > > > > > maybe @foo[..] (a short form for @foo[0..Inf]) ? Surely you mean [EMAIL PROTECTED] instead of 0..Inf > %foo{..} should also b

Re: String interpolation

2004-07-21 Thread Larry Wall
On Tue, Jul 20, 2004 at 11:00:39PM -0700, chromatic wrote: : On Tue, 2004-07-20 at 19:35, Luke Palmer wrote: : : > The New Way (tm) to do that would probably be sticking a role onto the : > array object with which you're dealing: : > : > my @foo does separator('//') = (1,2,3,4,5); : > say

Re: String interpolation

2004-07-21 Thread Aldo Calpini
Larry Wall wrote: Hmm. That makes me wonder what the slice notation for "everything" is. maybe @foo[..] (a short form for @foo[0..Inf]) ? %foo{..} should also be allowed, of course (which unfortunately is not a short form for 0..Inf). or perhaps, with a slight analogy with filesystems, @foo[*

Re: String interpolation

2004-07-21 Thread Larry Wall
On Wed, Jul 21, 2004 at 01:13:29PM -0400, Mark J. Reed wrote: : On 2004-07-21 at 09:42:44, Larry Wall wrote: : > Plus it ignores the fact that we've already introduced single character : > scalar context operators that make it trivial to coerce from list : > context to scalar. If {...} supplies li

Re: String interpolation

2004-07-21 Thread Larry Wall
On Tue, Jul 20, 2004 at 08:35:10PM -0600, Luke Palmer wrote: : This doesn't quite feel right to me. I was really a big fan of the good : ol' Perl 6 days where you could interpolate as in Perl 5, and method : calls required parentheses. I understand why Larry wanted to take out : the parentheses,

Re: String interpolation

2004-07-21 Thread Austin Hastings
--- Larry Wall <[EMAIL PROTECTED]> wrote: > If {...} supplies list context by default, most > intepolations are either the same length or shorter: > > $($foo) {$foo} > @(@foo) [EMAIL PROTECTED] > $(@foo) [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL

Re: String interpolation

2004-07-21 Thread Mark J. Reed
On 2004-07-21 at 09:42:44, Larry Wall wrote: > Plus it ignores the fact that we've already introduced single character > scalar context operators that make it trivial to coerce from list > context to scalar. If {...} supplies list context by default, most > intepolations are either the same length

Re: String interpolation

2004-07-21 Thread Larry Wall
On Wed, Jul 21, 2004 at 06:25:46AM +0400, Alexey Trofimenko wrote: : some questions: : : 1) is "@a[1][2]{'a'}«b»" interpolateable? Yes. : and what about "@a[1]('arg')[3]"? I can argue that both ways, but overall it seems like it won't cause much of a problem, and keeps () in the same mental cat

Re: String interpolation

2004-07-21 Thread Larry Wall
On Tue, Jul 20, 2004 at 09:20:56PM -0400, Damian Conway wrote: : So what about: : : $foo[$i] : $foo{$k} : : ??? Those would work. : And would slices interpolate? Yes. Slices are entirely determined by what's in the subscript. : I can't say I'm keen on making {...} special in stri

Re: String interpolation

2004-07-21 Thread Dave Whipp
"Chromatic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Shh, no one's let slip the idea of curried roles yet! I'm not even > certain A12 mentioned parametric roles, let alone first-class roles. And with parametric roles, perhaps we also get C roles? Dave.

Re: String interpolation

2004-07-21 Thread Dave Whipp
"Brent 'Dax' Royal-Gordon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Amen. Please don't steal unnecessary metacharacters in qq() > strings--although I still think we should keep it, @ causes a lot of > problems. I seem to recall an issue, last week, of whether adverbs can be a

Re: This week's summary

2004-07-21 Thread Piers Cawley
Austin Hastings <[EMAIL PROTECTED]> writes: > --- The Perl 6 Summarizer <[EMAIL PROTECTED]> wrote: >> Okay, so the interview was on Tuesday 13th of July. >> It went well; I'm going to be a maths teacher. [...] > As we all know, time flies like an arrow, but fruit flies like a > banana. If you

Re: String interpolation

2004-07-21 Thread Brent 'Dax' Royal-Gordon
Luke Palmer wrote: I admit there's a certain interest to Larry's new idea. I've been looking for more distinction between $, @, and % in Perl 6, since they start to become mostly irrelavent. In the new proposal: my @a = (1,2,3,4,5); my $a = @a; say "@a"; # @a say "$a"; # 1