Re: "put" vs "say"

2018-10-21 Thread Parrot Raiser
Thanks for the suggestions. I ran a couple of tests: my $data_list = 1..1001; say $data_list; produces 1..1000 real0m0.357s user0m0.435s sys 0m0.048s my $data_list = 1..1001; put $data_list; produces the list of integers from 1 to 1001 (obviously a single string). real

Re: "put" vs "say"

2018-10-21 Thread Timo Paulssen
put is meant for machines, while say is meant for humans. this is implemented by having say call the .gist method and put calling the .Str method. Try using say and put on a list of a thousand elements or more and you'll see what I mean. HTH   - Timo On 21/10/2018 18:29, Parrot Raiser wrote: >

Re: "temp" vs "my"

2018-10-05 Thread Jonathan Scott Duff
What you want is OUTER ... my $v = "original"; > { > my $v = OUTER::<$v>; > say $v; > $v = "new one"; > say $v; > } > say $v; It's how you access the outer scope from an inner scope. -Scott On Wed, Oct 3, 2018 at 1:10 AM yary wrote: > Reading and playing with

Re: "temp" vs "my"

2018-10-03 Thread Brad Gilbert
Note that OUTER::<$v> only goes up one level. So to go up two levels OUTER::OUTER::<$v> There is also OUTERS::<$v> which will go up as many levels as it needs to find the variable { my $a = 1; my $b = 2; { my $a = 3; { say

Re: "temp" vs "my"

2018-10-03 Thread yary
Thanks! Knew I'd seen the concept of OUTER but couldn't remember the keyword. -y On Wed, Oct 3, 2018 at 5:51 AM, Timo Paulssen wrote: > you can refer to the outer $v as OUTER::('$v'), that ought to help :) > On 03/10/2018 08:10, yary wrote: > > Reading and playing with

Re: "temp" vs "my"

2018-10-03 Thread Timo Paulssen
you can refer to the outer $v as OUTER::('$v'), that ought to help :) On 03/10/2018 08:10, yary wrote: > Reading and playing with https://docs.perl6.org/routine/temp > > There's an example showing how temp is "dynamic" - that any jump > outside a block restores the value. All well and good. > >

Re: Lists vs sets

2010-10-25 Thread Jon Lang
yary wrote: +1 on this On Mon, Oct 25, 2010 at 4:56 PM, Jon Lang datawea...@gmail.com wrote: As for the bit about sets vs. lists: personally, I'd prefer that there not be quite as much difference between them as there currently is. That is, I'd rather sets be usable wherever lists are called

Re: Lists vs sets

2010-10-25 Thread Mason Kramer
That sounds like a subclass of Bag to me. But I don't think that thinking about who is subclassing whom is is how to think about this in Perl 6. All of these types are capable of doing the Iterable role, and that is what methods that could operate on a List, Array, Bag, or Set, should be

Re: Lists vs sets

2010-10-25 Thread Mason Kramer
Sorry: I meant capable *in theory*. It's not in the spec right now for Sets or Bags. On Oct 25, 2010, at 08:41 PM, Mason Kramer wrote: That sounds like a subclass of Bag to me. But I don't think that thinking about who is subclassing whom is is how to think about this in Perl 6. All of

Re: Lists vs sets

2010-10-25 Thread Jon Lang
Mason Kramer wrote: But I don't think that thinking about who is subclassing whom is is how to think about this in Perl 6.  All of these types are capable of doing the Iterable role, and that is what methods that could operate on a List, Array, Bag, or Set, should be calling for. This.  

Re: Lists vs sets

2010-10-25 Thread Darren Duncan
yary wrote: I think of a list conceptually as a subclass of a set- a list is a set, with indexing and ordering added. Implementation-wise I presume they are quite different, since a set falls nicely into the keys of a hash in therms of what you'd typically want to do with it. If a list is a

Re: Lists vs sets

2010-10-25 Thread Jon Lang
Darren Duncan wrote: If a list is a set, does that mean that a list only contains/returns each element once when iterated?  If a list can have duplicates, then a list isn't a set, I would think. -- Darren Duncan Thus Mason's point about Bags. Really, I think that Mason's right in that we

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Richard Hainsworth
Damian Conway wrote: Personally, I'd prefer to see the English conventions carried over to the use of general use of hyphen and underscore in identifiers in the core (and everywhere else). By that, I mean that, in English, the hyphen is notionally a higher precedence word-separator than the

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Peter Scott
Am I the only one who sees a hyphen and thinks binary minus? Just because the parser can disambiguate this use of it doesn't mean the reader's brain can do so as easily. (I assume we're talking about the same character, 0x2D, and not something from further afield in the Unicode tables,

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Moritz Lenz
Peter Scott wrote: Am I the only one who sees a hyphen and thinks binary minus? Just because the parser can disambiguate this use of it doesn't mean the reader's brain can do so as easily. It's all a matter of practice. Since variables begin with sigils, and you should put whitespace

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Shawn H Corey
Darren Duncan wrote: See http://perlcabal.org/syn/S02.html#Names for your answers. Thanks for the link but nowhere in it does it state tha Perl 6 names are case sensitive. The best the do is this, which implies it is but doesn't state it. Other all-caps names are semi-reserved. We may add

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Matthew Walton
On Mon, Apr 12, 2010 at 1:22 PM, Shawn H Corey shawnhco...@gmail.com wrote: Darren Duncan wrote: See http://perlcabal.org/syn/S02.html#Names for your answers. Thanks for the link but nowhere in it does it state tha Perl 6 names are case sensitive.  The best the do is this, which implies it

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Larry Wall
On Sun, Apr 11, 2010 at 03:47:18PM -0700, Darren Duncan wrote: : Damian Conway wrote: : The relevant suggestion regarding hyphens vs underscores is: : : ...to allow both characters, but have them mean the same thing. : : That is, any isolated internal underscore can be replaced with an :

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Aaron Sherman
On Mon, Apr 12, 2010 at 2:23 PM, Larry Wall la...@wall.org wrote: On Sun, Apr 11, 2010 at 03:47:18PM -0700, Darren Duncan wrote: : : I see that making underscores : and hyphens to be equivalent is akin to having case-insensitive : identifiers, where Perl,PERL,perl mean the same thing.

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-12 Thread Geoffrey Broadwell
On Mon, 2010-04-12 at 11:23 -0700, Larry Wall wrote: The standard parser will likely be pointing out spelling errors and conjecturing emendations for near misses. Whole-program analysis can even do this for any method names that look wrongish. The difference between Acme-X and Acme_X is no

RE: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Conrad Schneiker
From: Mark J. Reed [mailto:markjr...@gmail.com] [...] Perl borrows vocabulary almost exclusively from English, but it is not English, and its conventions are not those of English. (And the conventions around hyphens that people are citing are quite specifically those of standard written

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Sundara Raman
On Sun, Apr 11, 2010 at 4:47 AM, Damian Conway dam...@conway.org wrote: And is it really so hard to teach: use underscore by default and reserve hyphens for between a noun and its adjective? Perhaps it *is*, but then that's a very sad reflection on our profession. If anything, it's a sad

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Jonathan Scott Duff
On Sat, Apr 10, 2010 at 5:14 AM, Mark J. Reed markjr...@gmail.com wrote: I'd much rather see a single consistent style throughout the setting than backwards compatibility with p5 naming conventions. If Temporal is the first setting module to use multiword identifiers, I vote for hyphens.

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Damian Conway
Well, if we're not going to try to implement linguistically based hyphenation/underscoriation rules (and I'd still argue that hyphenating adjectives to nouns and underscoring everything else isn't exactly rocket science), then I'd suggest we reconsider a radically different proposal that was made

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Geoffrey Broadwell
On Sat, 2010-04-10 at 17:20 -0700, yary wrote: Adjectives and nouns aren't English-only. So Damian's proposal is multi-culti. One could argue that Perl's identifiers, keywords, etc are based on English so that it is more difficult for a non-English speaker to discern why underscore is used in

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread John Siracusa
On Sun, Apr 11, 2010 at 10:54 AM, Damian Conway dam...@conway.org wrote: Hyphen/underscore equivalence would allow those (apparently elite few) who can correctly use a hyphen to correctly use the hyphen That's about the only advantage of this scheme that I can think of. The disadvantages, which

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Mark J. Reed
Egad, no to the equivalence. We'd be back in case-insensitive-language land, only without the benefit of even that dubious tradition. And at least for me, the beef with mixing hyphens and underscores is not that the great unwashed masses can't handle it, but that there will inevitably be cases

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Matthew
I can't help but agree with Damian. I don't see much of a point in making a distinction between - and _. More specifically, if a user were to define a function (say, i-hate-camel-case()), it would not be good to let them be the same. Readability would suffer when examining someone's code and

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Mark J. Reed
Egad, no to the equivalence. We'd be back in case-insensitive-language land, only without the benefit of even that dubious tradition. And at least for me, the beef with mixing hyphens and underscores is not that the great unwashed masses can't handle it, but that there will inevitably be cases

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Shawn H Corey
Damian Conway wrote: Well, if we're not going to try to implement linguistically based hyphenation/underscoriation rules (and I'd still argue that hyphenating adjectives to nouns and underscoring everything else isn't exactly rocket science), then I'd suggest we reconsider a radically different

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Darren Duncan
Damian Conway wrote: The relevant suggestion regarding hyphens vs underscores is: ...to allow both characters, but have them mean the same thing. That is, any isolated internal underscore can be replaced with an isolated internal hyphen (and vice versa), without changing the meaning of the

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Daniel Ruoso
Em Dom, 2010-04-11 às 07:54 -0700, Damian Conway escreveu: The relevant suggestion regarding hyphens vs underscores is: ...to allow both characters, but have them mean the same thing. er... this smells like :: and ' in Perl 5... Which, while I find Acme::Don't amusing, cannot be stated as

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Dave Rolsky
On Sat, 10 Apr 2010, Mark J. Reed wrote: I'd much rather see a single consistent style throughout the setting than backwards compatibility with p5 naming conventions. Ditto! If Perl 6 style is hyphens, use hyphens everywhere. That transition from P5 DateTime to P6 will then be a simple

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Doug McNutt
${A-1} = 3.14159; $A = $A-1; $A = $A -1; $A-=2; $A = 123E-2; $A = Pi(); $B = sin ($A-1); $B = sin (${A}-1); $B = sin($A -1); -2**2 = -4 except when it comes out +4 as in MS Excel. _2**2 = +4 in some other languages that use _ as a unary minus operator. Will editors be bothered when I try to

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Darren Duncan
Doug McNutt wrote: ${A-1} = 3.14159; $A = $A-1; $A = $A -1; $A-=2; $A = 123E-2; $A = Pi(); $B = sin ($A-1); $B = sin (${A}-1); $B = sin($A -1); -2**2 = -4 except when it comes out +4 as in MS Excel. _2**2 = +4 in some other languages that use _ as a unary minus operator. Will editors be

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Carl Mäsak
John (): Forgive me if this is a question the reveals how poorly I've been following Perl 6 development, but what's the deal with some methods using hyphen-separated words (e.g., day-of-week) while others use normal Perl method names (e.g., set_second)? I'd just like to point out that the

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Mark J. Reed
I'd much rather see a single consistent style throughout the setting than backwards compatibility with p5 naming conventions. If Temporal is the first setting module to use multiword identifiers, I vote for hyphens. They're easier on the fingers and the eyes; underscores have always felt like an

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread John Siracusa
On Sat, Apr 10, 2010 at 6:14 AM, Mark J. Reed markjr...@gmail.com wrote: I'd much rather see a single consistent style throughout Yeah, that's was my main point/question. I wanted to know if it was it some intentional convention (e.g., all methods that change the object state use hyphens, and

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Carl Mäsak
Mark (), John (): I'd much rather see a single consistent style throughout Yeah, that's was my main point/question.  I wanted to know if it was it some intentional convention (e.g., all methods that change the object state use hyphens, and all others use underscores) or if it was just

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Damian Conway
Personally, I'd prefer to see the English conventions carried over to the use of general use of hyphen and underscore in identifiers in the core (and everywhere else). By that, I mean that, in English, the hyphen is notionally a higher precedence word-separator than the space (or than its

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread John Siracusa
On Sat, Apr 10, 2010 at 5:25 PM, Damian Conway dam...@conway.org wrote: Personally, I'd prefer to see the English conventions carried over to the use of general use of hyphen and underscore in identifiers in the core (and everywhere else). That's certainly an example of how hyphens might gain

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Mark J. Reed
In English, hyphens normally indicate an extra level of reification, where e.g. what is normally a phrase is used in a context that requires a single word: The miller gave us the run of the mill. vs. It was a run-of-the-mill event. As such, examples like day?of?week are somewhat infelicitous, as

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Damian Conway
John Siracusa commented: That's certainly an example of how hyphens might gain meaning in Perl 6 names, but I don't think I can endorse it as a convention.  People can't even use hyphens correctly in written English.  I have very little faith that programmers will do any better in code But

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread John Siracusa
On Sat, Apr 10, 2010 at 7:17 PM, Damian Conway dam...@conway.org wrote: And is it really so hard to teach: use underscore by default and reserve hyphens for between a noun and its adjective? Perhaps it *is*, but then that's a very sad reflection on our profession. I'm not sure if the

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread yary
On Sat, Apr 10, 2010 at 4:53 PM, John Siracusa sirac...@gmail.com wrote: I'm not sure if the intersection of people who speak English and people who program is better or worse than average when it comes to grammar, but I do know (from editing my share of writing) that the average is very bad

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Daniel Ruoso
Em Sáb, 2010-04-10 às 19:53 -0400, John Siracusa escreveu: I'm having trouble imaging any convention that involves mixing word separators being successful. But the convention Damian is proposing is simply use underscores. Basically camelCase and with_underscores are conventions on how to

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread John Siracusa
On Sat, Apr 10, 2010 at 8:23 PM, Daniel Ruoso dan...@ruoso.com wrote: Em Sáb, 2010-04-10 às 19:53 -0400, John Siracusa escreveu: I'm having trouble imaging any convention that involves mixing word separators being successful. But the convention Damian is proposing is simply use underscores.

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-10 Thread Mark J. Reed
Agreed. Perl borrows vocabulary almost exclusively from English, but it is not English, and its conventions are not those of English. (And the conventions around hyphens that people are citing are quite specifically those of standard written English; other writing systems, even those using the

Re: But vs. With

2009-12-04 Thread David Green
On 2009-Dec-3, at 8:42 pm, Jon Lang wrote: but _can_ change existing behavior, but doesn't have to. So with becomes the safe version of run-time composition, guaranteeing that whatever you mix in won't disturb existing behavior, and but becomes the unsafe version that you can fall back

Re: But vs. With

2009-12-03 Thread David Green
Lots of things will have default stringifications, say, that may not always merit the contrary force of but. Maybe but should be needed only when a method has already been mixed in anonymously. Oops, that would wreck the canonical example of 0 but true. Since the Bool(Int) method already

Re: But vs. With

2009-12-03 Thread Jon Lang
On Thu, Dec 3, 2009 at 6:38 PM, David Green david.gr...@telus.net wrote: I'm wondering whether we can make use of the contrary sense implied by the word but, and have it apply specifically to cases where something is being overridden.  In cases where there isn't something to override we could

Re: But vs. With

2009-12-03 Thread Richard Hainsworth
David Green wrote: I'm wondering whether we can make use of the contrary sense implied by the word but, and have it apply specifically to cases where something is being overridden. In cases where there isn't something to override we could use a different word, such as with. I must admit to

Re: $*DEFOUT vs. $*OUT

2009-02-22 Thread Timothy S. Nelson
On Sun, 22 Feb 2009, Chris Dolan wrote: Smack me down if this has already been discussed to death, please... S16 (and now S28) say that $*DEFOUT, $*DEFIN and $*DEFERR are what most programs should use instead of $*OUT, $*IN and $*ERR. That seems anti-huffman to me, and I'll bet many

Re: Closure vs Hash Parsing

2008-08-11 Thread Ron
On 10 Aug., 00:58, [EMAIL PROTECTED] (Patrick R. Michaud) wrote: On Fri, Aug 08, 2008 at 07:32:52AM +0200, Carl Mäsak wrote: Jonathan (): That this means the { $_ = uc $_; } above would end up composing a Hash object (unless the semicolon is meant to throw a spanner in the

Re: Closure vs Hash Parsing

2008-08-09 Thread Patrick R. Michaud
On Fri, Aug 08, 2008 at 07:32:52AM +0200, Carl Mäsak wrote: Jonathan (): That this means the { $_ = uc $_; } above would end up composing a Hash object (unless the semicolon is meant to throw a spanner in the hash-composer works?) It says you can use sub to disambiguate, but %ret = map

Re: Closure vs Hash Parsing

2008-08-07 Thread Carl Mäsak
Jonathan (): That this means the { $_ = uc $_; } above would end up composing a Hash object (unless the semicolon is meant to throw a spanner in the hash-composer works?) It says you can use sub to disambiguate, but %ret = map sub { $_ = uc $_; }, split , $text; Doesn't work since $_ isn't

S12 Patch for metacalls, Representation API (Was: Re: Foo.HOW.metamethod vs Foo.^metamethod)

2008-06-11 Thread Daniel Ruoso
Seg, 2008-06-09 às 17:51 -0700, Larry Wall escreveu: On Sat, Jun 07, 2008 at 09:49:03PM +0100, Daniel Ruoso wrote: : 2) Assume the capture-translation and define that : $foo.HOW.can($foo,'bar') keeps the $how as the invocant and must receive : the referring object as first argument. I prefer

Re: Foo.HOW.metamethod vs Foo.^metamethod

2008-06-09 Thread Larry Wall
On Sat, Jun 07, 2008 at 09:49:03PM +0100, Daniel Ruoso wrote: : 2) Assume the capture-translation and define that : $foo.HOW.can($foo,'bar') keeps the $how as the invocant and must receive : the referring object as first argument. I prefer this approach, I think. Larry

Re: given vs for

2008-04-25 Thread Moritz Lenz
Paul Fenwick pjf at perltraining.com.au writes: for ($foo) { when ($_ 500) { ++$_ } when ($_ 1000) { --$_ } default { say Just right $_ } } Ahh... that's exactly what I was looking for. Thanks. Makes you wonder why the 'given' keyword was added, when

Re: given vs for

2008-04-25 Thread Trey Harris
In a message dated Fri, 25 Apr 2008, Moritz Lenz writes: Paul Fenwick pjf at perltraining.com.au writes: for ($foo) { when ($_ 500) { ++$_ } when ($_ 1000) { --$_ } default { say Just right $_ } } Ahh... that's exactly what I was looking for. Thanks.

Re: given vs for

2008-04-25 Thread Mark J. Reed
AIUI, this is the difference: given (@foo) { # this code runs exactly once, topic is @foo } vs for (@foo) { # this code runs once per item in @foo, topic # is @foo[0], then @foo[1], etc. } So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED])

Re: given vs for

2008-04-25 Thread John M. Dlugosz
Moritz Lenz moritz-at-casella.verplant.org |Perl 6| wrote: Paul Fenwick pjf at perltraining.com.au writes: for ($foo) { when ($_ 500) { ++$_ } when ($_ 1000) { --$_ } default { say Just right $_ } } Ahh... that's exactly what I was looking for.

Re: given vs for

2008-04-25 Thread John M. Dlugosz
Trey Harris trey-at-lopsa.org |Perl 6| wrote: In 5.10, given seems to copy its argument, whereas for aliases it. (I haven't looked at the code; maybe it's COW-ing it.) If you add a Csay Value is now $foo; to the end of the below program, and then change Cfor to Cgiven and run the program

Re: given vs for

2008-04-25 Thread Mark J. Reed
On Fri, Apr 25, 2008 at 10:39 AM, John M. Dlugosz [EMAIL PROTECTED] wrote: Are you saying that Perl 5.10 has given/when ? Yes. Perl 5.10 has several Perl 6 features back-ported into it, available via the use feature pragma: say (enables the say() built-in), state (enables state vars), switch

Re: given vs for

2008-04-25 Thread TSa
HaloO, John M. Dlugosz wrote: for @foo {...} is actually short for: for @foo - $_ {...} Ups, I missed that one. Do we also have the fill-me idiom for @foo - $_ {...} And again the question if this is the same as for @foo - $_ is ref {...} Regards, TSa. -- The

Re: given vs for

2008-04-25 Thread Dave Whipp
Mark J. Reed wrote: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should given @foo {...} alias to $_, or @_?

Re: given vs for

2008-04-25 Thread Smylers
Dave Whipp writes: Mark J. Reed wrote: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should given @foo {...} alias to $_, or @_? I'd expect it to alias to C$_, on the grounds that everything always aliases to C$_. What's the

Re: given vs for

2008-04-25 Thread Dave Whipp
Smylers wrote: Dave Whipp writes: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should given @foo {...} alias to $_, or @_? I'd expect it to alias to C$_, on the grounds that everything always aliases to C$_. What's the argument for

Re: given vs for

2008-04-25 Thread Mark J. Reed
The topic should always be $_ unless explicitly requested differently via the arrow. Now in the case of for, it might be nice if @_ bound to the entire collection being iterated over (if any)...

Re: given vs for

2008-04-25 Thread John M. Dlugosz
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote: HaloO, John M. Dlugosz wrote: for @foo {...} is actually short for: for @foo - $_ {...} Ups, I missed that one. Do we also have the fill-me idiom for @foo - $_ {...} No. There is no concept of output parameters. And again

Re: given vs for

2008-04-25 Thread John M. Dlugosz
Dave Whipp dave-at-whipp.name |Perl 6| wrote: Mark J. Reed wrote: So eseentially, given (@foo) means the same as Perl5 for ([EMAIL PROTECTED]) Just wondering: should given @foo {...} alias to $_, or @_? $_. It will contain the whole list as one item, like what Perl 5 does with

Re: given vs for

2008-04-25 Thread Larry Wall
On Fri, Apr 25, 2008 at 01:19:27PM -0500, John M. Dlugosz wrote: given @foo { when .length 5 { say That's a long list } when .length == Inf { say That's a very long list } when .WHAT ~~ Range { say That's an iterator } } Erm, .length is dead, and .WHAT just smells

Re: given vs for

2008-04-25 Thread Dave Whipp
Mark J. Reed wrote: The topic should always be $_ unless explicitly requested differently via the arrow. Now in the case of for, it might be nice if @_ bound to the entire collection being iterated over (if any)... As a perl5-ism: sub foo { say @_; } ... given (@bar) { when ... { foo }

Re: given vs for

2008-04-25 Thread Larry Wall
On Fri, Apr 25, 2008 at 01:05:37PM -0700, Dave Whipp wrote: As a perl5-ism: sub foo { say @_; } ... given (@bar) { when ... { foo } } Does perl6 still have some implicit mechanism to say call sub using current arglist? Yes, you can do it implicitly with one of callsame, callwith,

Re: given vs for

2008-04-25 Thread Trey Harris
To loop back to my earlier question: In Perl 5.10: use strict; use warnings; use feature qw(switch say); my $foo = 10; for ($foo) { when ($foo 50) { $_++ } } say for: $foo; $foo = 10; given ($foo) { when ($foo 50) { $_++ } } say

Re: given vs for

2008-04-25 Thread John M. Dlugosz
Dave Whipp dave-at-whipp.name |Perl 6| wrote: Does perl6 still have some implicit mechanism to say call sub using current arglist? (No, I'm not arguing to support any of this: just asking the questions) Yes. You can use 'callsame' and it knows the current argument list. You can get at

Re: given vs for

2008-04-25 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: However, foo doesn't mean what it means in Perl 5. It's just the function as a noun rather than a verb. Larry A gerund.

Re: 'x' vs. 'xx'

2007-06-03 Thread Chas Owens
On 6/3/07, Jonathan Lang [EMAIL PROTECTED] wrote: Chas Owens wrote: Jonathan Lang wrote: Is there any reason why we can't simply define '$a x $n' as being shorthand for 'cat($a xx $n)'? In what way does the former differ from the latter, other than the use of a Whatever in place of $n?

Re: 'x' vs. 'xx'

2007-06-03 Thread Jonathan Lang
Chas Owens wrote: Jonathan Lang wrote: Chas Owens wrote: Jonathan Lang wrote: Is there any reason why we can't simply define '$a x $n' as being shorthand for 'cat($a xx $n)'? In what way does the former differ from the latter, other than the use of a Whatever in place of $n? $a

Re: 'x' vs. 'xx'

2007-06-03 Thread Chas Owens
On 6/3/07, Jonathan Lang [EMAIL PROTECTED] wrote: Chas Owens wrote: Jonathan Lang wrote: Chas Owens wrote: Jonathan Lang wrote: Is there any reason why we can't simply define '$a x $n' as being shorthand for 'cat($a xx $n)'? In what way does the former differ from the latter,

Re: 'x' vs. 'xx'

2007-06-03 Thread Jonathan Lang
Chas Owens wrote: I am almost certain that the following code is in list context. pugs my @a = '-' x 5, 'foo', '-' x 5; pugs @a (-, foo, -) pugs my @b = cat('-' xx 5), 'foo', cat('-' xx 5) (-, -, -, -, -, foo, -, -, -, -, -) However, it does seem that Pug's version of cat does not

Re: 'x' vs. 'xx'

2007-06-03 Thread Mark J. Reed
Is item context what we're calling scalar these days, or something else? On 6/3/07, Jonathan Lang [EMAIL PROTECTED] wrote: Chas Owens wrote: I am almost certain that the following code is in list context. pugs my @a = '-' x 5, 'foo', '-' x 5; pugs @a (-, foo, -) pugs my @b =

Re: 'x' vs. 'xx'

2007-06-03 Thread Jonathan Lang
Mark J. Reed wrote: Is item context what we're calling scalar these days, or something else? According to S03, it does indeed appear that item context is the current terminology for what perl 5 called scalar context: The item contextualizer item foo() The new name for Perl 5's scalar

Re: 'x' vs. 'xx'

2007-06-03 Thread Chas Owens
On 6/3/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip From what you're saying, I get the impression that you think that '-' x 5 ought to produce a single string of five dashes regardless of whether the context is item or list. Correct? (Note: I'm not asking about what the spec says, since

Re: 'x' vs. 'xx'

2007-06-03 Thread Jonathan Lang
Chas Owens wrote: The current Perl 5 behavior is [EMAIL PROTECTED]:~$ perl -le 'my @a = (- x 5, foo, - x 5); print @a' - foo - [EMAIL PROTECTED]:~$ perl -le 'my @a = ((-) x 5, foo, (-) x 5); print @a' - - - - - foo - - - - - I am against anything other than that for x or xx without a

Re: 'x' vs. 'xx'

2007-06-02 Thread Chas Owens
On 6/2/07, Jonathan Lang [EMAIL PROTECTED] wrote: Is there any reason why we can't simply define '$a x $n' as being shorthand for 'cat($a xx $n)'? In what way does the former differ from the latter, other than the use of a Whatever in place of $n? -- Jonathan Dataweaver Lang $a x $n is

Re: 'x' vs. 'xx'

2007-06-02 Thread Jonathan Lang
Chas Owens wrote: Jonathan Lang wrote: Is there any reason why we can't simply define '$a x $n' as being shorthand for 'cat($a xx $n)'? In what way does the former differ from the latter, other than the use of a Whatever in place of $n? $a x $n is equivalent to join '', $a xx $n, but that

Re: Mutability vs Laziness

2006-09-25 Thread Dave Whipp
Aaron Sherman wrote: It seems to me that there are three core attributes, each of which has two states: Mutability: true, false Laziness: true, false Ordered: true, false I think there's a 4th: exclusivity: whether or not duplicate elements are permitted/exposed (i.e. the

Re: Mutability vs Laziness

2006-09-25 Thread Sam Vilain
Aaron Sherman wrote: Carried over form IRC to placeholder the conversation as I saw it: We define the following in S06 as immutable types: ListLazy Perl list (composed of Seq and Range parts) Seq Completely evaluated (hence immutable) sequence Range

Re: META vs meta

2006-09-15 Thread Aaron Sherman
David Brunton wrote: Aaron Sherman wrote: replies snipped / IMHO, the golden rule of programming languages should be: if you need a namespace, create one. Is there any reason these meta methods could not be part of some default function package like Math::Basic and Math::Trig? The package

Re: META vs meta

2006-09-14 Thread Aaron Sherman
Jonathan Scott Duff wrote: On Wed, Sep 13, 2006 at 10:20:31AM +1200, Sam Vilain wrote: Larry Wall wrote: .META is more correct at the moment. Does making it all upper caps really help? It's still a pollution of the method space, any way that you look at it... Yeah but perl has already

Re: META vs meta

2006-09-14 Thread David Brunton
Aaron Sherman wrote: replies snipped / Is the goal to avoid namespace pollution? If so, shouldn't there be a truly metaish way of getting at the internal namespace so that someone doesn't accidentally render an object unusable by defining the wrong method name (which you can prevent with an

Re: META vs meta

2006-09-12 Thread Sam Vilain
Larry Wall wrote: : There is currently a mismatch between S12 and Pugs. The former specifies $obj.META, the latter has implemented $obj.meta. .META is more correct at the moment. Does making it all upper caps really help? It's still a pollution of the method space, any way that you look

Re: META vs meta

2006-09-12 Thread Jonathan Scott Duff
On Wed, Sep 13, 2006 at 10:20:31AM +1200, Sam Vilain wrote: Larry Wall wrote: : There is currently a mismatch between S12 and Pugs. The former specifies $obj.META, the latter has implemented $obj.meta. .META is more correct at the moment. Does making it all upper caps really

Re: META vs meta

2006-09-11 Thread Larry Wall
On Mon, Sep 11, 2006 at 08:59:51AM -0700, David Brunton wrote: : Hi all, : : There is currently a mismatch between S12 and Pugs. The former specifies $obj.META, the latter has implemented $obj.meta. .META is more correct at the moment. : Is there any reason I shouldn't change the tests from

Re: META vs meta

2006-09-11 Thread David Green
On 9/11/06, Larry Wall wrote: Only that I'm thinking of renaming all the meta-ish methods to use interrogative pronouns: .META- .HOW .SKID- .WHO .PKG - .WHAT .VAR - .WHERE .WHO and .WHAT strike me as better being swapped. Maybe... or some such. Not sure

Re: META vs meta

2006-09-11 Thread Larry Wall
On Mon, Sep 11, 2006 at 10:59:20AM -0600, David Green wrote: : In that case, .WHO definitely makes more sense for the name. I don't see it. Who I am is my identity. What I am is a Person or some such. Larry

Re: META vs meta

2006-09-11 Thread Larry Wall
On Mon, Sep 11, 2006 at 09:18:19AM -0700, Larry Wall wrote: : .PKG - .WHAT I should have said .ref- .WHAT there, since it was the intention to rename .ref that brought all this on in the first place. (And what you actually get from .WHAT is the prototype object

Re: Methods vs. Subs

2006-07-08 Thread Larry Wall
On Sat, Jul 08, 2006 at 07:42:06AM -0700, Jonathan Lang wrote: : Is there anything that you can do with a sub (first parameter being : some sort of object) that you cannot do with a method? Frex, given: : : multi method my_method($invocant:); : : would : : topical_call := my_method.assuming

Re: packages vs. classes

2006-05-26 Thread Stevan Little
On 5/23/06, Sam Vilain [EMAIL PROTECTED] wrote: Right, but we should really ship with at least a set of Meta Object Protocol Roles, that covers the core requirements that we will need for expressing the core types in terms of themselves; - classes and roles - attributes and methods - subsets

  1   2   3   4   >