[perl6/specs] b4b49f: Improve wording about substr-rw aliasing

2015-06-09 Thread GitHub
-setting-library/Str.pod Log Message: --- Improve wording about substr-rw aliasing Thanks to itz++ for pointing out the sentence's meaning.

Re: Aliasing methods in CPAN roles

2009-10-20 Thread Raphael Descamps
Am Montag, den 19.10.2009, 16:43 -0700 schrieb Jon Lang: > Raphael Descamps wrote: > > I personally don't understand why we don't have a exclude and alias > > operator in Perl 6 but I have not read all the synopses and don't have > > an overview. > > I don't think that it's explicitly spelled out

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Jon Lang
Raphael Descamps wrote: > In the original traits paper the aliasing is not "deep": to respect the > flattening property, the semantic of the role must not change, so > aliasing a recursive method will call the original method. It's a known > theoretical weakness of the

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Jon Lang
Raphael Descamps wrote: > I personally don't understand why we don't have a exclude and alias > operator in Perl 6 but I have not read all the synopses and don't have > an overview. I don't think that it's explicitly spelled out anywhere; but the reason is fairly straightforward: exclude and alias

Re: Aliasing methods in CPAN roles

2009-10-19 Thread David Green
On 2009-Oct-18, at 3:44 pm, Jon Lang wrote: David Green wrote: I would expect that role Logging { method log(Numeric $x:) {...} } means the invocant is really of type Numeric & Logging, without Logging having to do Numeric. On the other hand, I can see that strictly that might not make se

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Raphael Descamps
ve to be solved > explicitly. The traits paper propose 3 different operators to solve > such conflicts: overriding, excluding or aliasing. > > I definitively think that perl 6 roles should also have an excluding > operator because I think that *every* composition conflicts arrising &

Re: Aliasing methods in CPAN roles

2009-10-18 Thread Jon Lang
David Green wrote: > Jon Lang wrote: >> >> This implies that both Logging and Math do Numeric, since the invocant >> ought to be of a type that the class does. > > I would expect that >    role Logging { method log(Numeric $x:) {...} } > means the invocant is really of type Numeric & Logging, witho

Re: Aliasing methods in CPAN roles

2009-10-18 Thread David Green
On 2009-Oct-17, at 1:55 am, Jon Lang wrote: This implies that both Logging and Math do Numeric, since the invocant ought to be of a type that the class does. I would expect that role Logging { method log(Numeric $x:) {...} } means the invocant is really of type Numeric & Logging, without

Re: Aliasing methods in CPAN roles

2009-10-17 Thread Jon Lang
David Green wrote: > Aha, so the bark:(Dog:) syntax identifies the method by its signature as > well, thus distinguishing it from the .bark:(Tree:) method.  This works fine > when the sigs can distinguish the invocants, which is very common.  However, > I could have ambiguous methods even including

Re: Aliasing methods in CPAN roles

2009-10-16 Thread David Green
On 2009-Oct-16, at 12:54 am, Richard Hainsworth wrote: Is there syntactic sugar for aliasing the conflicting method? Eg. something like does XML :db-write; There needs to be something more than sugar: making a new class or role with different methods will break substitutability. However

Aliasing methods in CPAN roles

2009-10-15 Thread Richard Hainsworth
does XML; method xml-db-write ( @_ ) { self.db-write( @_ ) }; }; This seems a bit clunky just to rename a method to prevent a conflict. Is there syntactic sugar for aliasing the conflicting method? Eg. something like does XML :db-write; Moreover, suppose that the two modules have roles with the same na

Re: ^method ? (Is $_ still aliasing $?SELF?)

2005-05-18 Thread TSa (Thomas Sandlaß)
methods don't topicalize their invocant. method bar ($_:) { .foo(); } Ahh, does this mean that the auto-aliasing is ditched? I personally regard $_ as a bit too volatile and if it is a rw binding it's outright dangerous to not have access to $?SELF after some topicalizing statem

Re: Aliasing swapped values

2005-04-10 Thread Juerd
Ovid skribis 2005-04-10 10:47 (-0700): > Apologies if this has been covered. What should this do? > ($x,$y) := ($y,$x); It would let $x be a second name for the variable that is also called $y, and $y for $x. The old names $x and $y are overwritten, so essentially the names for the two variable

Aliasing swapped values

2005-04-10 Thread Ovid
Hi all, Apologies if this has been covered. What should this do? ($x,$y) := ($y,$x); In Perl5: $x=2; $y=3; print "x: $x y: $y\n"; (*::x, *::y) = (*::y, *::x); $y=4; print "x: $x y: $y\n"; $x=5; print "x: $x y: $y\n"; This program shows typeglob

Re: Aliasing an array slice

2003-07-20 Thread David Storrs
On Fri, Jul 18, 2003 at 06:05:52PM -0400, Benjamin Goldberg wrote: > What would happen if I used 1,2,3 instead of 1..3? Would it do the same > thing? I would think so. > I wanna know what happens if I do: > >@a[0,2,4] = qw/ a b c d e /; Yup, you're right, I didn't consider non-cont

Re: Aliasing an array slice

2003-07-18 Thread Luke Palmer
Benjamin Golberg writes: > Luke Palmer wrote: > > > > > David Storrs wrote: > > > > > > > > Thinking about it, I'd rather see lvalue slices become a nicer version > > > > of C. > > > > > > > > my @start = (0..5); > > > > my @a = @start; > > > > > > > > @a[1..3] = qw/ a b c d e /; >

Re: Aliasing an array slice

2003-07-18 Thread Benjamin Goldberg
Dave Whipp wrote: > "Luke Palmer" wrote: > > Benjamin Goldberg wrote: > > > David Storrs wrote: > > > > @a[1..3] = qw/ a b c d e /; > > > > print @a; # 0 a b c d e 4 5 > > > > > > What would happen if I used 1,2,3 instead of 1..3? > > > Would it do the same thing? > > > > Of course. >

Re: Aliasing an array slice

2003-07-18 Thread Dave Whipp
"Luke Palmer" <[EMAIL PROTECTED]> wrote: > Benjamin Goldberg wrote: > > David Storrs wrote: > > > @a[1..3] = qw/ a b c d e /; > > > print @a; # 0 a b c d e 4 5 > > > > What would happen if I used 1,2,3 instead of 1..3? Would it do the same > > thing? > > Of course. I tend to agree, I

Re: Aliasing an array slice

2003-07-18 Thread Benjamin Goldberg
Luke Palmer wrote: > > > David Storrs wrote: > > > > > > Thinking about it, I'd rather see lvalue slices become a nicer version > > > of C. > > > > > > my @start = (0..5); > > > my @a = @start; > > > > > > @a[1..3] = qw/ a b c d e /; > > > print @a; # 0 a b c d e 4 5 > > >

Re: Aliasing an array slice

2003-07-18 Thread Luke Palmer
> David Storrs wrote: > > > > Thinking about it, I'd rather see lvalue slices become a nicer version > > of C. > > > > my @start = (0..5); > > my @a = @start; > > > > @a[1..3] = qw/ a b c d e /; > > print @a; # 0 a b c d e 4 5 > > What would happen if I used 1,2,3 instead

Re: Aliasing an array slice

2003-07-18 Thread Benjamin Goldberg
David Storrs wrote: > > Thinking about it, I'd rather see lvalue slices become a nicer version > of C. > > my @start = (0..5); > my @a = @start; > > @a[1..3] = qw/ a b c d e /; > print @a; # 0 a b c d e 4 5 What would happen if I used 1,2,3 instead of 1..3? Would it do

Re: Aliasing an array slice

2003-07-09 Thread Austin Hastings
--- David Storrs <[EMAIL PROTECTED]> wrote: > On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote: > > > > --- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote: > > > Am I now thinking clearly? > > > > > I don't think so. > > > > If you've created two separate arrays that happen

Re: Aliasing an array slice

2003-07-09 Thread David Storrs
On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote: > > --- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote: > > Am I now thinking clearly? > > > I don't think so. > > If you've created two separate arrays that happen to start with related > values, then the changes to the first

Re: Aliasing an array slice

2003-07-08 Thread Austin Hastings
--- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote: > "Jonadab the Unsightly One" <[EMAIL PROTECTED]> writes: > > > Does this imply, though, that it's pointing to specific elements, > > Wow, I wasn't paying attention to what I was thinking there. > Obviously it points to specific elements,

Re: Aliasing an array slice

2003-07-08 Thread Jonadab the Unsightly One
"Jonadab the Unsightly One" <[EMAIL PROTECTED]> writes: > Does this imply, though, that it's pointing to specific elements, Wow, I wasn't paying attention to what I was thinking there. Obviously it points to specific elements, because the subscripts used to create a slice don't have to be sequen

Re: Aliasing an array slice

2003-07-08 Thread Jonadab the Unsightly One
David Storrs <[EMAIL PROTECTED]> writes: > my $r_slice = [EMAIL PROTECTED]; > @$r_slice = qw/ a b c d e /; > print @a; # 0 a b c d e 4 5 This seems right to me. It would take approximately no time to get used to this semantic, IMO. > # Note that it does NOT modify in r

Re: Aliasing an array slice

2003-07-07 Thread David Storrs
Thinking about it, I'd rather see lvalue slices become a nicer version of C. my @start = (0..5); my @a = @start; @a[1..3] = qw/ a b c d e /; print @a; # 0 a b c d e 4 5 # Similarly: @a = @start; my $r_slice = [EMAIL PROTECTED]; @$r_slice = qw/ a b c

Re: Aliasing an array slice

2003-07-06 Thread Dan Brook
On 5 Jul 2003, Luke Palmer wrote: > > return [EMAIL PROTECTED] $begin .. $end ]; > > I fear that this might take a reference to each element in the slice, > rather than a reference to the slice Yes, that would indeed return a list of refs in perl5. Can it also be assumed that the magic hy

Re: Aliasing an array slice

2003-07-05 Thread Luke Palmer
> > On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote: > > > > > Actually, you can't reference a slice! Where the heck does the > > > reference point? I would probably do: > > > > Of course not. I presume it points to something non-existent just like > > a substring reference would in

Re: Aliasing an array slice

2003-07-05 Thread Luke Palmer
> On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote: > > > Actually, you can't reference a slice! Where the heck does the > > reference point? I would probably do: > > Of course not. I presume it points to something non-existent just like > a substring reference would in perl5 :-) >

Re: Aliasing an array slice

2003-07-05 Thread Nicholas Clark
On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote: > Actually, you can't reference a slice! Where the heck does the > reference point? I would probably do: Of course not. I presume it points to something non-existent just like a substring reference would in perl5 :-) $ perl -le '$a =

Re: Aliasing an array slice

2003-07-05 Thread Luke Palmer
> On Fri, 4 Jul 2003, Damian Conway wrote: > > > > Will it be possible (or sane even) to bind a variable to an array slice > > It *should* be, since it's possible (if ungainly) to do it in Perl 5: > > Ouch, blatant abuse of perl5's aliasing with @_ and glob

Re: Aliasing an array slice

2003-07-04 Thread dbrook
On Fri, 4 Jul 2003, Damian Conway wrote: > > Will it be possible (or sane even) to bind a variable to an array slice > It *should* be, since it's possible (if ungainly) to do it in Perl 5: Ouch, blatant abuse of perl5's aliasing with @_ and globs ;) Can I also assume tha

Re: Aliasing an array slice

2003-07-04 Thread Damian Conway
Dan Brook wrote: Will it be possible (or sane even) to bind a variable to an array slice It *should* be, since it's possible (if ungainly) to do it in Perl 5: use Data::Dumper 'Dumper'; @bar = (1,2,3); *foo = (sub [EMAIL PROTECTED])->(@bar[1,0,3]); print Dumper [EMAIL PROTECTED];

Re: Aliasing an array slice

2003-07-04 Thread Luke Palmer
> Will it be possible (or sane even) to bind a variable to an array slice > e.g > > ## correct syntax? > my @array = << a list of values >>; > > my @array_slice := @array[ 1 .. @array.end ]; Yeah, that'll work. It has to, lest: my [EMAIL PROTECTED] := (1, 1, map { $^a + $^b } zip(@fi

Aliasing an array slice

2003-07-04 Thread Dan Brook
Will it be possible (or sane even) to bind a variable to an array slice e.g ## correct syntax? my @array = << a list of values >>; my @array_slice := @array[ 1 .. @array.end ]; Or would this merely bind @array_slice to the list returned by the slice, or would it DTRT (in my eyes at least)

Re: A4 aliasing syntax (and a note on statement modification)

2003-02-09 Thread Erik Steven Harrison
; >for $a, $b <- @foo { ... } # "for $a and $b from @foo..." All else aside, I think that a <- will not fly. It's too easily read as greater-than-unary-minus -Erik > >(heck, that even looks like shifting -- "shifty aliasing". The A4 syntax >look

Re: A4 aliasing syntax (and a note on statement modification)

2003-02-09 Thread Michael Lazzaro
On Saturday, February 8, 2003, at 02:53 AM, Luke Palmer wrote: If you're talking about your own C example, actually, this would match it better: grep $x <- @list { $x eq 3 } But if you're talking about A4's: grep @list -> $x { $x eq 3 } Which is very close to (one of) the currently v

Re: A4 aliasing syntax (and a note on statement modification)

2003-02-08 Thread Luke Palmer
ll or good): > > for $a, $b <- @foo { ... } # "for $a and $b from @foo..." > > (heck, that even looks like shifting -- "shifty aliasing". The A4 syntax > looks like popping until you realize it is really shoving the left N > thingees into the contain

A4 aliasing syntax (and a note on statement modification)

2003-02-08 Thread gpurdy
t even looks like shifting -- "shifty aliasing". The A4 syntax looks like popping until you realize it is really shoving the left N thingees into the containers on the right -- Syntactical Action at a Distance). Then, A4 gives this example of C: grep -> $x { $x eq 3 } @

Re: Argument aliasing for subs

2002-09-09 Thread Erik Steven Harrison
-- On Sun, 08 Sep 2002 22:24:11 Damian Conway wrote: > >Think of it as punctuation. As a necessary alternative to the poor >overworked colon. > Or the poor overworked dot? > > >> it all looks the same to me. And I like different things to look different. > >A fair point. My counterargume

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Steve Canfield wrote: > I was under the impression that compile time properties, like runtime > properties, can be arbitrarily invented and/or assigned. Yes, but not purely lower-case ones. They're reserved for Perl 6 itself. (i.e. only Larry can invent/assign them ;-) > If that is > correct,

Re: Argument aliasing for subs

2002-09-09 Thread Steve Canfield
>From: Uri Guttman <[EMAIL PROTECTED]> >that is not a variable property so it should be >a compile time error. I was under the impression that compile time properties, like runtime properties, can be arbitrarily invented and/or assigned. If that is correct, why would "my $var is true", meaningle

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Erik Steven Harrison wrote: > But still, what counts as a runtime property, other than true or > false, as in the delightful '0 but true'? What other kind of runtime > labels can I slap on a value? Here's ten to start with... for <> but tainted(0) {...} # note that external data

Re: Argument aliasing for subs

2002-09-09 Thread Damian Conway
Erik Steven Harrison wrote: > Just found this hidden in my inbox. > I didn't think anyone was paying attention ;-). Oh, we *always* pay attention. We just don't always respond. ;-) >>What I most like about the C syntax is (like methods in >>OO Perl), it associates a meaningful *name* with e

Re: Argument aliasing for subs

2002-09-08 Thread Uri Guttman
> "SC" == Steve Canfield <[EMAIL PROTECTED]> writes: SC> Would it be accurate to say that "is" sets properties of variables, SC> whereas "but" sets properties of values? If so, what would this output: SC> my $var is true; that is not a variable property so it should be a compile tim

Re: Argument aliasing for subs

2002-09-08 Thread Steve Canfield
>From: Trey Harris <[EMAIL PROTECTED]> >To: Steve Canfield <[EMAIL PROTECTED]> > > I would expect it to output "false". > >Why? I believe that, whatever you set $var to, you have marked the >variable as constantly true in booleans. Because in my experience variables are not true or false. They

Re: Argument aliasing for subs

2002-09-08 Thread Trey Harris
In a message dated Sun, 8 Sep 2002, Steve Canfield writes: > Would it be accurate to say that "is" sets properties of variables, whereas > "but" sets properties of values? If so, what would this output: > > my $var is true; > $var=0; > if ($var) {print "true"} > else {print "false"} > > I

Re: Argument aliasing for subs

2002-09-08 Thread Steve Canfield
Would it be accurate to say that "is" sets properties of variables, whereas "but" sets properties of values? If so, what would this output: my $var is true; $var=0; if ($var) {print "true"} else {print "false"} I would expect it to output "false". __

Re: Argument aliasing for subs

2002-09-08 Thread Damian Conway
Peter Behroozi wrote: >> sub hidden (str $name, int $force is aka($override)) {...} > > > Hang on a moment! In your original answer to this question, you used > the "is named('alias')" syntax, but now you are suggesting using the > sigil in the syntax. Yes, but for a *different* property.

Re: Argument aliasing for subs

2002-09-07 Thread Me
> Damian Conway wrote: > >>And is the is/but distinction still around? > > > >Oh, yes. > > Could someone please reference where this decision was > made. I do not find any information describing the distinction. The following May 2001 post was related. Poke around the thread it was in, especial

Re: Argument aliasing for subs

2002-09-07 Thread Steve Canfield
Damian Conway wrote: >>And is the is/but distinction still around? > >Oh, yes. Could someone please reference where this decision was made. I do not find any information describing the distinction. Steve _ Join the world’s larges

Re: Argument aliasing for subs

2002-09-07 Thread Erik Steven Harrison
-- On Thu, 05 Sep 2002 09:26:08 Damian Conway wrote: >Erik Steven Harrison wrote: > > >> Is it just me or is the 'is' property syntax a little >> too intuitive? Seems like everywhere I turn, the >> proposed syntax to solve a problem is to apply a >> property. > >That's because most of th

Re: Argument aliasing for subs

2002-09-07 Thread Erik Steven Harrison
reposted because my mailer is evil -- On Thu, 05 Sep 2002 09:31:45 Damian Conway wrote: >Erik Steven Harrison wrote: > >> I know that the property syntax is pseudo established, >> but I'm beggining to become a bit jaded about all the >> built in properties were building. What about good ol'

Re: Argument aliasing for subs

2002-09-07 Thread Erik Steven Harrison
-- On Thu, 05 Sep 2002 09:31:45 Damian Conway wrote: >Erik Steven Harrison wrote: > >> I know that the property syntax is pseudo established, >> but I'm beggining to become a bit jaded about all the >> built in properties were building. What about good ol' >> aliases? >> >> sub hidden (s

RE: Argument aliasing for subs

2002-09-07 Thread Brent Dax
Erik Steven Harrison: # But still, what counts as a runtime property, other than true or # false, as in the delightful '0 but true'? What other kind of runtime # labels can I slap on a value? These occur to me: $foo=0 but string("zero"); $bar='foobar' but num(1); $baz=1

Re: Argument aliasing for subs

2002-09-05 Thread Peter Behroozi
On Thu, 2002-09-05 at 04:31, Damian Conway wrote: >sub hidden (str $name, int $force is aka($override)) {...} Hang on a moment! In your original answer to this question, you used the "is named('alias')" syntax, but now you are suggesting using the sigil in the syntax. So, should it really b

Re: Argument aliasing for subs

2002-09-05 Thread Damian Conway
Erik Steven Harrison wrote: > I know that the property syntax is pseudo established, > but I'm beggining to become a bit jaded about all the > built in properties were building. What about good ol' > aliases? > > sub hidden (str $name, int $force := $override) {...} I'm not keen on it becaus

Re: Argument aliasing for subs

2002-09-05 Thread Damian Conway
Erik Steven Harrison wrote: > Is it just me or is the 'is' property syntax a little > too intuitive? Seems like everywhere I turn, the > proposed syntax to solve a problem is to apply a > property. That's because most of the problems we're discussing are solved by changing the semantics of

Re: Argument aliasing for subs

2002-09-04 Thread Erik Steven Harrison
> sub hidden (str $name, int $force is aka($override)) >{ ... } I know that the property syntax is pseudo established, but I'm beggining to become a bit jaded about all the built in properties were building. What about good ol' aliases? sub hidden (str $name, int $force := $override) {

Re: Argument aliasing for subs

2002-09-04 Thread Erik Steven Harrison
Somewhere, in another thread . . . Dr. Claw wrote . . . >> sub hidden (str $name, int $force is aka($override)) >>{ ... } > >Yeah, that's what I meant. Is it just me or is the 'is' property syntax a little too intuitive? Seems like everywhere I turn, the proposed syntax to solve a problem

Re: Argument aliasing for subs

2002-09-04 Thread Damian Conway
[EMAIL PROTECTED] wrote: >> sub hidden (str $name, int $force, int $override is aka($force)) >> { ... } > > > Would the following be simpler...? > > sub hidden (str $name, int $force is aka($override)) >{ ... } Yeah, that's what I meant. Sorry. I've travelled 14,000 miles and given 93

Re: Argument aliasing for subs

2002-09-04 Thread Peter Behroozi
From: Damian Conway [EMAIL PROTECTED] > If it were allowed, it would probably be done > via properties instead: > > sub hidden (str $name, int $force, int $override is aka($force)) >{ ... } How does this method affect the non-parameter-based calling scheme? It looks like it is possible to

Re: Argument aliasing for subs

2002-09-04 Thread [EMAIL PROTECTED]
From: Damian Conway [EMAIL PROTECTED] > If it were allowed, it would probably be done > via properties instead: > > sub hidden (str $name, int $force, int $override is aka($force)) >{ ... } Would the following be simpler...? sub hidden (str $name, int $force is aka($override)) { ... }

Re: Argument aliasing for subs

2002-09-04 Thread Damian Conway
Peter Behroozi wrote: > Has anyone considered a syntax for allowing subroutines to have many > different names for the same argument? If it were allowed, it would probably be done via properties instead: sub hidden (str $name, int $force, int $override is aka($force)) { ... } Damian

RE: Argument aliasing for subs

2002-09-04 Thread [EMAIL PROTECTED]
From: Peter Behroozi [EMAIL PROTECTED] > Has anyone considered a syntax for allowing > subroutines to have many different names for > the same argument? For example, in CGI.pm, many > methods support the "-override" parameter but > can also accept the alias of "-force": Yes. See the thread start

Argument aliasing for subs

2002-09-03 Thread Peter Behroozi
Hello All, Has anyone considered a syntax for allowing subroutines to have many different names for the same argument? For example, in CGI.pm, many methods support the "-override" parameter but can also accept the alias of "-force": $cgi->hidden(-name => "a", -override => 1); #same as $cgi->hi

Re: $_ aliasing

2002-04-03 Thread Damian Conway
Uri asked: > but what if there are multiple bound variables like this example: > > for %phonebook.kv -> $name, $number { > print "$name: $number\n" > } > > is $_ aliased to either/both/neither of the two topics? are those now > not topics but just aliased variabl

$_ aliasing

2002-04-03 Thread Uri Guttman
from exegesis 4: In Perl 6, the current topic -- whatever its name and however you make it the topic -- is always aliased to $_. and one of the examples is: for @list -> $next {# iterate @list, aliasing each element to # $next (

RE: aliasing a value [...]

2001-07-25 Thread Sterin, Ilya
\%foo = \%bar is fine with me, it's the "is alias" I was a little worried about. Ilya -Original Message- From: David L. Nicol To: Sterin, Ilya Cc: 'Davíð Helgason '; '[EMAIL PROTECTED] '; 'John Porter ' Sent: 07/24/2001 5:45 PM Subject: Re:

RE: aliasing a value in a while each loop

2001-07-23 Thread Sterin, Ilya
Sent: 7/20/01 2:25 PM Subject: Sv: aliasing a value in a while each loop John Porter wrote: > Perhaps a simple > > alias( %foo, %bar ); > > for those times when you really just need a simple WTDI! Would alias %foo = %bar; not be ok, 'alias' acting and bindin

Sv: aliasing a value in a while each loop

2001-07-23 Thread Davíð Helgason
John Porter wrote: > Perhaps a simple > > alias( %foo, %bar ); > > for those times when you really just need a simple WTDI! Would alias %foo = %bar; not be ok, 'alias' acting and binding like 'my' of course. Or my %foo is alias = %bar; No? /davíð

Re: aliasing a value in a while each loop

2001-07-20 Thread Eric Roode
David L. Nicol wrote: > >Are there really situations where > > $$reference = An Expression; > >is clearer than > > $reference = \(An Expression); > >? Eric is confused. I don't know about in Perl 6-to-be, but in Perl 5 those two mean totally different things: $foo = \$bar;

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-20 Thread 'John Porter '
David L. Nicol wrote: > No, that does not work: Right; I misunderstood what was wanted. -- John Porter

Re: aliasing a value in a while each loop

2001-07-20 Thread John Porter
David L. Nicol wrote: > Assignment to a nonexistent reference becomes an > alias instead of a copy. Uh, I dunno. Like Python/Ruby, but without the consistency. I think special constructs -- defined as NOT doing assignment -- should be allowed to set up aliases. This includes, e.g. for(). P

RE: aliasing a value in a while each loop

2001-07-20 Thread Sterin, Ilya
/20/2001 1:38 PM Subject: aliasing a value in a while each loop "Mark J. Reed" wrote: > > Well, other than the fact that the while(each) doesn't do aliasing. > Since that would be the whole point, ignore that last message. > > On Fri, Jul 20, 2001 at 01:21:57PM -0400

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread Me
> Sounds like what we really want is a form of "for" which can iterate > over a list of hashes or arrays: > > for my @a ( @foo, @bar ) { ... > > for my %h ( %foo, %bar ) { ... Yes. Isn't the underlying issue in the above how perl6 handles manipulation and ali

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> Why would you want it to print Monkey Hero, I would expect $_ to be > localized, rather than global, which could prove more convenient. No, it's still localized. But the With would mean that $_ in a way becomes a normal variable like $foo was, and the $foo is now the 'default variable'.

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
ce option, in my opinion it's useless, but if was implemented this could be a way:) Ilya -Original Message- From: 'John Porter ' To: [EMAIL PROTECTED] Sent: 07/19/2001 1:46 PM Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) Sterin, Ily

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread 'John Porter '
Sterin, Ilya wrote: > Well then maybe $_ can be a reference to a multidimensional array or hash, > and temp vars can be access like this. > > for ( @foo, @bar ) { > print "$_->[0] : $_->[1]\n"; > } That's bizarre and unnecessary. We can already do this: for ( \@foo, \@bar ) { print "$_

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
Why would you want it to print Monkey Hero, I would expect $_ to be localized, rather than global, which could prove more convenient. Ilya -Original Message- From: Stuart Rocks To: [EMAIL PROTECTED] Sent: 07/19/2001 1:13 PM Subject: Re: what's with 'with'? (was:

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread John Porter
Bart Lateur wrote: > So, in this case, a "with" synonym for "for" would work. > > But this only works for scalars. You can't have a %foo alias to > %Some::Other::hash this way, or a @bar alias to @Some::Other::array. Sounds like what we really want is a form of "for" which can iterate over a lis

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> But can someone reiterate the > difference between the above and > > for($foo){ >print "I am not a $foo\n"; > # or: >print "I am not a "; >print; > } Try this under the current for system, cause it's unclear what will happen for those new to Perl: $foo="monkey"; $_=" coward";

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
Agree. I think that with() should only be used with object references only, and $_ should be set accordingly. Ilya -Original Message- From: John Porter To: [EMAIL PROTECTED] Sent: 07/19/2001 1:01 PM Subject: Re: aliasing - was:[nice2haveit] Sterin, Ilya wrote: > But I thought t

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
: John Porter To: [EMAIL PROTECTED] Sent: 07/19/2001 12:59 PM Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) I believe what is really wanted is for "for" to be able to iterate over lists of arrays or hashes: for my @i ( @foo, @bar ) { ...

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread John Porter
Sterin, Ilya wrote: > But I thought this was related to more than just with(), so if we have > > ### Would now have to be printed as > > print "This is number "; > print; > print " of 10\n"; > > I still believe that although not defining a variable source will use the > temp variable there is s

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> Like "I am not a > coward" which can be easily done with print "I am not a $_"; will now have > to be written in two separate lines, and possibly more if there is more to > follow. > > Ilya Um, of course the original way is still possible!

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread John Porter
I believe what is really wanted is for "for" to be able to iterate over lists of arrays or hashes: for my @i ( @foo, @bar ) { ... for my %i ( %foo, %bar ) { ... with real aliasing occuring. If @_ and %_ are the default iterator variables, then imagine: for

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
I question this too, since as you mentioned with, in my experience works nicely to reference and object like with(object) { .foo(); .bar(); } Ilya -Original Message- From: Mark Koopman To: [EMAIL PROTECTED] Sent: 07/19/2001 12:42 PM Subject: Re: what's with 'with'?

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
es, and possibly more if there is more to follow. Ilya -Original Message- From: Garrett Goebel To: 'Stuart Rocks'; [EMAIL PROTECTED] Sent: 07/19/2001 12:34 PM Subject: what's with 'with'? (was: [aliasing - was:[nice2haveit]]) From: Stuart Rocks [mailto:[EMAIL PROTECTED]

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
cks To: [EMAIL PROTECTED] Sent: 07/19/2001 11:31 AM Subject: Re: aliasing - was:[nice2haveit] > >Then how would you write "I am not a coward" > > with ($foo) > { > print "I am not a"; ##What do I use here or do I have to issue a >#

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Mark Koopman
Garrett Goebel wrote: > From: Stuart Rocks [mailto:[EMAIL PROTECTED]] > >>Both the following would work: >> >>with($foo){ >> print "I am not a $foo\n"; >> # or: >> print "I am not a "; >> print; >>} >> > > Okay... I've been mostly ignoring this thread. But can someone reiterate the > d

what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Garrett Goebel
From: Stuart Rocks [mailto:[EMAIL PROTECTED]] > > Both the following would work: > > with($foo){ >print "I am not a $foo\n"; > # or: >print "I am not a "; >print; > } Okay... I've been mostly ignoring this thread. But can someone reiterate the difference between the above and for

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread Stuart Rocks
> >Then how would you write "I am not a coward" > > with ($foo) > { > print "I am not a"; ##What do I use here or do I have to issue a >##separate print like... > print; > } > > Ilya Well in Perl5, for the print to use default value it's just 'print;'. The same applie

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
Stuart Rocks wrote: >> >> C would also make the [variable, alias, whatever] >> default, but not replace the $_: >> >> $_ = "monkey "; >> $foo = "coward"; >> with ($foo){ >> print; >> print "$_"; >> } >> >> would output "monkey coward". >okay, "coward" is default but $_ has not been r

Re: aliasing - was:[nice2haveit]

2001-07-18 Thread Stuart Rocks
> > So, in this case, a "with" synonym for "for" would work. > > > Particularly if '$_' was implied... So with Perl 6's '.' replacing '->', > and 'with' aliasing 'for': > >with ( $XL.{Applic

Re: aliasing - was:[nice2haveit]

2001-07-18 Thread Stuart Rocks
> > So, in this case, a "with" synonym for "for" would work. > > > Particularly if '$_' was implied... So with Perl 6's '.' replacing '->', > and 'with' aliasing 'for': > >with ( $XL.{Applic

Re: aliasing - was:[nice2haveit]

2001-07-18 Thread raptor
>> Does such a thing exist already? > >A WTDI exists already: > >for ( $XL->{Application}->{ActiveSheet} ) { > $_->cells(1,1) = "Title"; > $_->language() = "English"; >} > >(presuming lvalue-methods, of course...) So, in this case, a "with" synonym for "for" would work. ]- OR

Re: aliasing - was:[nice2haveit]

2001-07-18 Thread jh_lists
resuming lvalue-methods, of course...) > > So, in this case, a "with" synonym for "for" would work. > Particularly if '$_' was implied... So with Perl 6's '.' replacing '->', and 'with' aliasing 'for':

Re: aliasing - was:[nice2haveit]

2001-07-18 Thread Bart Lateur
On Wed, 18 Jul 2001 09:00:25 -0400, John Porter wrote: >> Does such a thing exist already? > >A WTDI exists already: > >for ( $XL->{Application}->{ActiveSheet} ) { > $_->cells(1,1) = "Title"; > $_->language() = "English"; >} > >(presuming lvalue-methods, of course...) So, in th

  1   2   >