nothing

2005-03-20 Thread Rod Adams
Does Perl need a no-op function? With the addition of "no bare literals", it makes constructs like 1 while some_func(); an error. I propose creating a no-op function "nothing" that can be used here or anywhere else you specifically wish to do nothing at all. given

Re: nothing

2005-03-21 Thread Larry Wall
the value in a void context, and we could suppress that warning for 0 and 1 like we do Perl 5 without violating our "no barewords" dictum. : I propose creating a no-op function "nothing" that can be used : here or anywhere else you specifically wish to do nothing at all. : :

Re: nothing

2005-03-21 Thread Rod Adams
Larry Wall wrote: On Sun, Mar 20, 2005 at 09:08:08PM -0600, Rod Adams wrote: : I propose creating a no-op function "nothing" that can be used : here or anywhere else you specifically wish to do nothing at all. : : given $this { :when Even { nothing }; :when Prime { ... }; :

Re: nothing

2005-03-21 Thread Juerd
Rod Adams skribis 2005-03-21 14:25 (-0600): > if $expr { > nothing; > } > is harder to get confused over, IMO Except writing something when you mean nothing is kind of weird. It makes sense in rules because it doesn't usually make sense to match nothingness, but for bl

Re: nothing

2005-03-21 Thread Austin Hastings
Juerd wrote: Rod Adams skribis 2005-03-21 14:25 (-0600): if $expr { nothing; } is harder to get confused over, IMO Except writing something when you mean nothing is kind of weird. It makes sense in rules because it doesn't usually make sense to match nothingness, but for blocks

Re: nothing

2005-03-21 Thread Juerd
Austin Hastings skribis 2005-03-21 15:55 (-0500): > I'd like to see nothing as just an alias for {}. > if $expr > { >do nothing; > } > Possibly the most clear piece of P6 code ever. Dangerous, though :) do nothing if $input =~ /\W/; system "rm -- $input

Re: nothing

2005-03-21 Thread Rod Adams
Juerd wrote: Austin Hastings skribis 2005-03-21 15:55 (-0500): I'd like to see nothing as just an alias for {}. if $expr { do nothing; } Possibly the most clear piece of P6 code ever. Dangerous, though :) do nothing if $input =~ /\W/; system "rm -- $input"; Bu

Apropos of nothing...

2001-12-13 Thread Piers Cawley
In the following code fragment, what context is foo() in? @ary[0] = foo() the following code @ary= foo() obviously evaluates @foo in a list context, but in the first I'm no longer sure. -- Piers "It is a truth universally acknowledged that a language in possession of a ri

E6: assume nothing

2003-07-31 Thread Trey Harris
To take the E6 example of currying &part: &List::Part::part.assuming(labels => <>) One had to curry in C to be the same as it was defined in C<&part> originally, i.e. C<< <> >>. What if one wanted to curry in whatever the default is, i.e., assumin

Re: Apropos of nothing...

2001-12-13 Thread Ted Ashton
Thus it was written in the epistle of Piers Cawley, > In the following code fragment, what context is foo() in? > > @ary[0] = foo() Scalar, I would think. Just my guess, Ted -- Ted Ashton ([EMAIL PROTECTED]) | From the Tom Swifty collection: Southern Adventist University| "Multiplicati

Re: Apropos of nothing...

2001-12-13 Thread Mark J. Reed
On Thu, Dec 13, 2001 at 12:12:14PM -0500, Ted Ashton wrote: > Thus it was written in the epistle of Piers Cawley, > > In the following code fragment, what context is foo() in? > > > > @ary[0] = foo() > > Scalar, I would think. I assume that the following would make the assignment a slice an

RE: Apropos of nothing...

2001-12-13 Thread Brent Dax
ll next to mine's.) --Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 "Nothing important happened today." --George III of England's diary entry for 4-Jul-1776

Re: Apropos of nothing...

2001-12-13 Thread Damian Conway
> In the following code fragment, what context is foo() in? > > @ary[0] = foo() Scalar context. @ary[0] is a single element of @ary. To call foo() in list context use any of the following: (@ary[0]) = foo(); # Assign @ary[0] the first element returned @(@ary[

Re: Apropos of nothing...

2001-12-13 Thread Bart Lateur
On Thu, 13 Dec 2001 12:17:44 -0500, Mark J. Reed wrote: > @i = (0); > @ary[@i] = foo(); > >How could one get that behavior without the intermediate array? Parens, likely. (@ary[0]) = foo(); -- Bart.

Re: Apropos of nothing...

2001-12-13 Thread Graham Barr
On Fri, Dec 14, 2001 at 06:39:02AM +1100, Damian Conway wrote: > >> In the following code fragment, what context is foo() in? >> >> @ary[0] = foo() > > Scalar context. @ary[0] is a single element of @ary. > > To call foo() in list context use any of the following: > > (@

Re: Apropos of nothing...

2001-12-13 Thread Damian Conway
> > @ary[0] =()= foo(); # " " " " " "" " > > Hm, thats a change from perl5. In perl5 that would assign the number of > elements returned from foo(). Is there a good reason for this change ? Firstly, Larry may have to rule on which behaviour actually *is*

Re: Apropos of nothing...

2001-12-13 Thread Piers Cawley
"Brent Dax" <[EMAIL PROTECTED]> writes: > Piers Cawley: > # In the following code fragment, what context is foo() in? > # > # @ary[0] = foo() > > The short answer is scalar context. The long answer is below. Note > that the long answer is only the way I think of it. You may think > differe

Re: Apropos of nothing...

2001-12-15 Thread Damian Conway
Piers posed the following puzzles: > @ary[0] = foo() # scalar Yes. > @ary[1,2] = foo() # list context Yes. > @bar = 1; > @ary[@bar] = foo() # ? probably list or maybe scalar... List. With an explicit array as index, it's definitely a (one-element) slice. > @bar = (1,

Re: Apropos of nothing...

2001-12-20 Thread Aaron Sherman
On Sun, Dec 16, 2001 at 03:55:10PM +1100, Damian Conway wrote: [...] >> And, just for laughs: >> >> $ref = [1,2]; >> @ary[$ref] = foo(); # probably a syntax error Ok, as far as I can recall, Larry hinted that arrays and references to arrays would be interchangable in many

Re: Apropos of nothing...

2001-12-20 Thread Piers Cawley
Aaron Sherman <[EMAIL PROTECTED]> writes: > On Sun, Dec 16, 2001 at 03:55:10PM +1100, Damian Conway wrote: > > [...] > >>> And, just for laughs: >>> >>> $ref = [1,2]; >>> @ary[$ref] = foo(); # probably a syntax error > > Ok, as far as I can recall, Larry hinted that arrays a

Re: Apropos of nothing...

2001-12-20 Thread Damian Conway
> > $val = (foo())[0]; > > > > List? > > Scalar, obviously. How do you figure that? (Not a criticism: I'd really like to understand your thought process here so I can assess the relative DWIMity of the two alternatives). > With a possible runtime error if foo doesn't ret

Re: Apropos of nothing...

2001-12-20 Thread Damian Conway
Aaron Sherman wrote: > >> $ref = [1,2]; > >> @ary[$ref] = foo(); # probably a syntax error > > Ok, as far as I can recall, Larry hinted that arrays and references to > arrays would be interchangable in many contexts in P6. In this case, I > can't see any reason that subscripting wou

Re: Apropos of nothing...

2001-12-20 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: >> >$val = (foo())[0]; >> > >> > List? >> >> Scalar, obviously. > > How do you figure that? (Not a criticism: I'd really like to understand your > thought process here so I can assess the relative DWIMity of the two > alternat

Re: Apropos of nothing...

2001-12-21 Thread Piers Cawley
Resending due to BT doing bad things to good nameservers. Damian Conway <[EMAIL PROTECTED]> writes: >> >$val = (foo())[0]; >> > >> > List? >> >> Scalar, obviously. > > How do you figure that? (Not a criticism: I'd really like to understand your > thought process her

Re: E6: assume nothing

2003-07-31 Thread Austin Hastings
;> >>. > > What if one wanted to curry in whatever the default is, i.e., > assuming > "nothing" (different from "assuming nothing"), so that if > List::Part::part > changed its default for C to C<< <> >>, the > client > c

Re: E6: assume nothing

2003-07-31 Thread Trey Harris
In a message dated Thu, 31 Jul 2003, Austin Hastings writes: > assuming(labels => undef) Okay... I think you're wrong, because this would have to be a special case (defaults take effect only when *nothing* is passed in, not when the argument is undefined) but, assuming you're ri

Re: E6: assume nothing

2003-07-31 Thread Austin Hastings
: > In a message dated Thu, 31 Jul 2003, Austin Hastings writes: > > assuming(labels => undef) > > Okay... I think you're wrong, because this would have to be a special > case > (defaults take effect only when *nothing* is passed in, not when the > argument is un

Re: E6: assume nothing

2003-08-01 Thread Damian Conway
Trey asked: To take the E6 example of currying &part: &List::Part::part.assuming(labels => <>) One had to curry in C to be the same as it was defined in C<&part> originally, i.e. C<< <> >>. What if one wanted to curry in whatever the default

Re: E6: assume nothing

2003-08-01 Thread Luke Palmer
<> >>. > > > > What if one wanted to curry in whatever the default is, i.e., assuming > > "nothing" (different from "assuming nothing"), so that if List::Part::part > > changed its default for C to C<< <> >>, the client > >

Re: E6: assume nothing

2003-08-01 Thread Luke Palmer
efined in C<&part> > > > originally, i.e. C<< <> >>. > > > > > > What if one wanted to curry in whatever the default is, i.e., assuming > > > "nothing" (different from "assuming nothing"), so that if List::Part::part

Re: E6: assume nothing

2003-09-07 Thread Jonadab the Unsightly One
Luke Palmer <[EMAIL PROTECTED]> writes: > A synonym of: > > delete %h{foo}; > > would be > > %h{foo} = nonex; This has the potential, if not documented exactly right, to create bogus expectations. Consider... $s = %h{foo} = nonex; After deleting the foo key (and its value, if any)

Autovivification (was Re: E6: assume nothing)

2003-09-08 Thread Paul Johnson
Jonadab the Unsightly One said: > $s = %h{foo} = nonex; > > After deleting the foo key (and its value, if any) from %h this then > probably procedes to autovivify it when evaluating it as an rvalue; Now why on earth would you want to do that? Perl 5 doesn't. By the way, I trust this will be

Re: Autovivification (was Re: E6: assume nothing)

2003-09-25 Thread Larry Wall
On Mon, Sep 08, 2003 at 11:18:12AM +0200, Paul Johnson wrote: : By the way, I trust this will be addressed (if it hasn't been already): : : perl5 -le 'print "gah!" if exists $a{b}{c}; print "phooey!" if exists $a{b}' : : perlfunc says: : : This surprising autovivification in what does not at f

Re: Autovivification (was Re: E6: assume nothing)

2003-09-26 Thread Paul Hodges
--- Larry Wall <[EMAIL PROTECTED]> wrote: > On Mon, Sep 08, 2003 at 11:18:12AM +0200, Paul Johnson wrote: > : By the way, I trust this will be addressed (if it hasn't been > : already): > : > : perl5 -le 'print "gah!" if exists $a{b}{c}; print "phooey!" > : if exists $a{b}' > : > : perlfunc say

Re: [perl #62528] Match.keys method returns nothing.

2009-03-29 Thread Moritz Lenz
Since afaict this is not specced, I'll hand that over to p6l. Eric Hodges (via RT) wrote: > use v6; > > rule test {test}; > > "test" ~~ //; > say '$/.keys => ', $/.keys.perl; > say '%($/).keys => ', %($/).keys.perl; > > # outputs > # $/.keys => [] > # %($/).keys => ["test"] > > > Same could be

Re: [perl #62528] Match.keys method returns nothing.

2009-03-29 Thread Jon Lang
Moritz Lenz wrote: > Since afaict this is not specced, I'll hand that over to p6l. > > Eric Hodges (via RT) wrote: >> use v6; >> >> rule test {test}; >> >> "test" ~~ //; >> say '$/.keys => ', $/.keys.perl; >> say '%($/).keys => ', %($/).keys.perl; >> >> # outputs >> # $/.keys => [] >> # %($/).keys

How to create a function that returns nothing

2003-10-14 Thread Joe Gottman
How do you declare a function that doesn't return anything? For instance, a C++ swap function might be declared template void swap(X &x, X &y); It would be nice to declare the corresponding Perl6 function as sub swap ($x is rw, $y is rw) returns nothing {...} or something s

Re: How to create a function that returns nothing

2003-10-14 Thread Luke Palmer
Joe Gottman writes: > How do you declare a function that doesn't return anything? For instance, a > C++ swap function might be declared >template > void swap(X &x, X &y); > > It would be nice to declare the corresponding Perl6 function as > sub swap ($

Apo4 misc (given nothing, ->, break, c::, keep/undo, hierarchy)

2002-01-20 Thread Me
> "given nothing...": > > given () { ... } do { ... } seems simpler. > Suppose you want to preserve $_ and alias > >given $value -> $g { '->' seems more visually noisy than it need be in this case. Perhaps: given $value as $g

Re: Apo4 misc (given nothing, ->, break, c::, keep/undo, hierarchy)

2002-01-20 Thread Damian Conway
Me wrote: > > "given nothing...": > > > > given () { ... } > > do { ... } > > seems simpler. But doesn't have the same effect. A C inside a C responds to the current value of the "subject" specified by any surrounding topica

Maybe it's Just Nothing (was: Look-ahead arguments in for loops)

2005-09-29 Thread Luke Palmer
def" in most code is considered bad style--then we can steal them for the language's purposes, such as passing to a for block as lookbehind and lookahead parameters when you're near the beginning or end of a list. It seems like I'm making a pretty big deal out of just passing undef w

[perl6/specs] e0325a: [S99] associativity's got nothing to do with it :)

2013-07-02 Thread GitHub
-glossary.pod Log Message: --- [S99] associativity's got nothing to do with it :) Commit: 793babac4bf1316f787b2a08403bb7b1ca6b072c https://github.com/perl6/specs/commit/793babac4bf1316f787b2a08403bb7b1ca6b072c Author: Carl Masak Date: 2013-07-01 (Mon, 01 Jul

Re: Maybe it's Just Nothing (was: Look-ahead arguments in for loops)

2005-09-30 Thread Jonathan Scott Duff
On Thu, Sep 29, 2005 at 11:21:20PM -0600, Luke Palmer wrote: [ discussion on undefs elided ] Since we can annotate our undefs now, perhaps undefs that would be generated because there are no previous or next elements get "tagged" as such. Something like: # assuming $b and $a are "before"