Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
The C Comma
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  22 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Luke Palmer  
View profile  
 More options Nov 24 2003, 7:48 pm
Newsgroups: perl.perl6.language
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Date: Mon, 24 Nov 2003 17:00:38 -0700
Local: Mon, Nov 24 2003 7:00 pm
Subject: The C Comma
Honestly you guys, I'm not trolling.  I'm just getting a lot of ideas
recently. :-)

The C comma has always bugged me, but its function is indeed useful
(many times I use C<and> in its place, if I know the left side will
always be true). I don't know whether it's staying or not (I've heard
rumors of both), but I'd suggest that it leave and allow itself to be
replaced by a word, alongside C<and>, C<or>, and C<err>.

This word:  C<then>.  

So, from a recent script of mine:

    my $n;
    while $n++ then @accum < $total {
        ...
    }

(Where I got in trouble for using C<and> and never executing anything :-)

To me, it's very clear what's going on, and eliminates the mystery of
the comma in scalar context for a syntax error.

Luke


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael G Schwern  
View profile  
 More options Nov 24 2003, 7:48 pm
Newsgroups: perl.perl6.language
From: schw...@pobox.com (Michael G Schwern)
Date: Mon, 24 Nov 2003 16:40:23 -0800
Local: Mon, Nov 24 2003 7:40 pm
Subject: Re: The C Comma

On Mon, Nov 24, 2003 at 05:00:38PM -0700, Luke Palmer wrote:
> The C comma has always bugged me, but its function is indeed useful
> (many times I use C<and> in its place, if I know the left side will
> always be true). I don't know whether it's staying or not (I've heard
> rumors of both), but I'd suggest that it leave and allow itself to be
> replaced by a word, alongside C<and>, C<or>, and C<err>.

It certainly would solve the annoying Perl 5 "is it a list constructor or
the comma operator?"  No more user confusion and simpler parsing.  Maybe
even eliminate some more parens!  @foo = 1,2,3;

That reason alone is enough for me.

> This word:  C<then>.  

> So, from a recent script of mine:

>     my $n;
>     while $n++ then @accum < $total {
>         ...
>     }

> (Where I got in trouble for using C<and> and never executing anything :-)

> To me, it's very clear what's going on, and eliminates the mystery of
> the comma in scalar context for a syntax error.

I definately agree that this is used rarely enough that it should be a word
and not a single character.

"then" sounds too much like "if/then" which is confusing.  Its exactly
the opposite from what you're trying to convey.

It also doesn't convey anything about "evaluate the left hand side, ignore
the results and evaluate the right".  Unfortunately, I don't have a better
name.

--
Michael G Schwern        schw...@pobox.com  http://www.pobox.com/~schwern/
Now we come to that part of the email you've all been waiting for--the end.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Worthington  
View profile  
 More options Nov 24 2003, 7:48 pm
Newsgroups: perl.perl6.language
From: jonat...@jwcs.net (Jonathan Worthington)
Date: Tue, 25 Nov 2003 00:49:43 -0000
Local: Mon, Nov 24 2003 7:49 pm
Subject: Re: The C Comma
> Honestly you guys, I'm not trolling.  I'm just getting a lot of ideas
> recently. :-)

Honestly, I'm not an expert on Perl 6 syntax.  (And I actually am being
honest... ;-)  But I'll throw in my 2 cents anyway.  :-)

> <snipah>

> This word:  C<then>.

> So, from a recent script of mine:

>     my $n;
>     while $n++ then @accum < $total {
>         ...
>     }

> (Where I got in trouble for using C<and> and never executing anything :-)

> To me, it's very clear what's going on, and eliminates the mystery of
> the comma in scalar context for a syntax error.

To me the word "then" suggests an action based upon what has happened before
(as in, if true then do this).  Maybe I'm just intoxicated with BASIC, but I
still mentally read if constructs as "if conditions then { block }".  I know
you're thinking "do this then do this", but it just doesn't rub me the right
way.

As for punctuation vs word, I'm really not sure.  A , seems kinda natural to
me, but a word would be more useful for writing poetry.

As for it being an unused feature that could be amplified by better
syntax...I guess I can buy that. I'd just rather not buy it with a keyword
like "then".  :-)

Jonathan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rod Adams  
View profile  
 More options Nov 24 2003, 8:48 pm
Newsgroups: perl.perl6.language
From: r...@rodadams.net (Rod Adams)
Date: Mon, 24 Nov 2003 19:04:06 -0600
Local: Mon, Nov 24 2003 8:04 pm
Subject: Re: The C Comma
At 04:40 PM 11/24/2003 -0800, Michael G Schwern wrote:

>I definately agree that this is used rarely enough that it should be a word
>and not a single character.

>"then" sounds too much like "if/then" which is confusing.  Its exactly
>the opposite from what you're trying to convey.

>It also doesn't convey anything about "evaluate the left hand side, ignore
>the results and evaluate the right".  Unfortunately, I don't have a better
>name.

C<andthen>

Of course I've always thought the semicolon would have been a better choice
for the "C comma". That way C<($a, $b, $c)>  would always be a list, and
C<($a; $b; $c)> would be $c, after $a and $b are evaled.  I haven't thought
out how much havoc this would cause the parser, but from this programmers
view, it seems pretty intuitive.

-- Rod


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damian Conway  
View profile  
 More options Nov 24 2003, 8:48 pm
Newsgroups: perl.perl6.language
From: dam...@conway.org (Damian Conway)
Date: Tue, 25 Nov 2003 12:21:13 +1100
Local: Mon, Nov 24 2003 8:21 pm
Subject: Re: The C Comma
I'm very much in favour of heteronymifying scalar vs list comma too.
Or else eliminating one of them.

Schwern wrote:
> "then" sounds too much like "if/then" which is confusing.

Why? "if/then" has never been Perl syntax.

> It also doesn't convey anything about "evaluate the left hand side, ignore
> the results and evaluate the right".

I think that's exactly what it conveys:

     The suspect drank half a dozen double whiskys then drove into a lake.

Sounds *exactly* like ignoring the results of the left hand side to me. ;-)

> Unfortunately, I don't have a better name.

I don't think there *is* a better word.

Of course, it may well be that, given the rarity of scalar commas, a better
alternative is to simply eliminate them entirely and insist that people use
C<do{...;...;...}> instead.

Damian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gregor N. Purdy  
View profile  
 More options Nov 24 2003, 8:48 pm
Newsgroups: perl.perl6.language
From: gre...@focusresearch.com (Gregor N. Purdy)
Date: Mon, 24 Nov 2003 17:29:57 -0800
Local: Mon, Nov 24 2003 8:29 pm
Subject: Re: The C Comma
Luke --

I guess it might be nice to just do that with a block...

  my $n;
  while { $n++; @accum } < $total {
    ...;
  }

since we already have a nice do-this-then-do-this syntax.

Sure, it looks a little weird in a for loop:

  for ($i = 0; $i < $X; { $i++; some_func() }) {
    ...;
  }

but they are already weird anyway.

FWIW, In the (hypothetical) future Jako (see parrot's
languages/jako/docs/future.pod), I've toyed with a few different ways of
looking at these sorts of constructs, one of which is this (I've made it
look a *little* more Perlish than in future.pod):

You can still write for() like this:

    for ($i = 0; $i < l;$ i++) { print $x[$i], "\n" }

but it is really shorthand for this (there's a nit here wrt mapping
"for (my $i ...)" to something reasonable):

    for { $i = 0 } { $i < l } { $i++ } { print $x[$i], "\n" }

or, more verbosely:

    for {
      $i = 0;
    } while {
      $i < l
    } continue {
      $i++
    } do {
      print $x[$i], "\n"
    }

That is, the construct:

  ( ...; ...; ...; )

is another way of saying

  { ... } { ... } { ... }

which, in the case of for(), is interpreted as

  { ... } while { ... } continue { ... }

when each of the "..." is a single statement. For any case where you
want to use more than one statement for one of the "...", you just use
the more verbose syntax.

Now, that won't map directly to Perl 6, since it will handle continue
differently inside the "do" part (right?), but it fits my mental model
nicely (this idea came from looking at looping constructs from Eiffel
as well as elsewhere and looking for the unifying stuff).

Regards,

-- Gregor

--
Gregor Purdy                            gre...@focusresearch.com
Focus Research, Inc.               http://www.focusresearch.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael G Schwern  
View profile  
 More options Nov 24 2003, 8:48 pm
Newsgroups: perl.perl6.language
From: schw...@pobox.com (Michael G Schwern)
Date: Mon, 24 Nov 2003 17:44:01 -0800
Local: Mon, Nov 24 2003 8:44 pm
Subject: Re: The C Comma

On Tue, Nov 25, 2003 at 12:21:13PM +1100, Damian Conway wrote:
> >"then" sounds too much like "if/then" which is confusing.

> Why? "if/then" has never been Perl syntax.

A lot of people read "if (foo) { bar }" as "if foo then bar" in their heads.
I'm one of them.  Its not a previous syntax thing, its a translation to
English thing.

This may be a consequence of the example used

        while $n++ then $foo > $bar

which I immediately associated with.

        if $n++ then $foo > $bar

I didn't say it makes sense, but that's the rather strong association I have.

--
Michael G Schwern        schw...@pobox.com  http://www.pobox.com/~schwern/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damian Conway  
View profile  
 More options Nov 24 2003, 9:48 pm
Newsgroups: perl.perl6.language
From: dam...@conway.org (Damian Conway)
Date: Tue, 25 Nov 2003 13:03:19 +1100
Local: Mon, Nov 24 2003 9:03 pm
Subject: Re: The C Comma
Schwern observed:

> A lot of people read "if (foo) { bar }" as "if foo then bar" in their heads.
> I'm one of them.  Its not a previous syntax thing, its a translation to
> English thing.

Fair enough. It's not something I do myself, but I can see that many people
might prefer to.

> This may be a consequence of the example used

>    while $n++ then $foo > $bar

> which I immediately associated with.

>    if $n++ then $foo > $bar

Yeah, I can certainly see that.

Perhaps this is yet another argument for insisting on:

        while do {$n++; $foo > $bar}

instead.

Because, like you, I sure would like to be able to get rid of those parens
around comma'd lists.

Damian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Walker  
View profile  
 More options Nov 25 2003, 9:19 am
Newsgroups: perl.perl6.language
From: kwal...@xmission.com (Kevin Walker)
Date: 25 Nov 2003 06:19:02 -0800
Local: Tues, Nov 25 2003 9:19 am
Subject: Re: The C Comma
schw...@pobox.com (Michael G Schwern) wrote in message <news:20031125004023.GB13159@windhund.schwern.org>...

> Unfortunately, I don't have a better name.

"also"?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Scott Duff  
View profile  
 More options Nov 25 2003, 10:49 am
Newsgroups: perl.perl6.language
From: d...@lighthouse.tamucc.edu (Jonathan Scott Duff)
Date: Mon, 24 Nov 2003 19:38:31 -0600
Local: Mon, Nov 24 2003 8:38 pm
Subject: Re: The C Comma

I agree.  

As long as we're fantasizing about alternate names for comma, how
about "also":

        while $n++ also @accum < $total { ... }

or maybe throw some latin in there

        while $n++ et @accum < $total { ... }
        while $n++ cum @accum < $total { ... }               # maybe?

but that's probably more obscure than the comma.

Okay, so I don't have any good ideas either, but I like "also" if
we're getting rid of the "C comma".

-Scott
--
Jonathan Scott Duff
d...@lighthouse.tamucc.edu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Smylers  
View profile  
 More options Nov 25 2003, 12:01 pm
Newsgroups: perl.perl6.language
From: Smyl...@stripey.com (Smylers)
Date: Tue, 25 Nov 2003 07:01:04 GMT
Local: Tues, Nov 25 2003 2:01 am
Subject: Re: The C Comma

Damian Conway writes:
> Perhaps this is yet another argument for insisting on:

>    while do {$n++; $foo > $bar}

> instead.

Yes please!  Is anybody here a fan of the C comma?  I don't think I've
ever used it -- well, not intentionally, anyway -- but these are the
situations where I've spotted it being used:

  * iterating through multiple variables at once in a C-style C<for>
    loop (now C<loop>) -- this style of loop is rare itself in ideomatic
    Perl, and the Perl 6 C<for> syntax provides ways of looping with
    several variables

  * golf -- but I'm assuming that we aren't (purposefully) adding in
    features just for golfing reasons

  * constructs such as this [Perl 5]:

      warn "Invalid data", next unless /^\s*(\w+)\s*=\s*(.*)/ || /^\s*$/;

    Doing something else just before C<next> to abort a loop iteration
    is fairly common.  I dislike the above line because I find the order
    it evaluates in so awkward (end then start then middle), so always
    find some other way of expressing such logic.

    But it appears that many people do like using C<,> in this way, so
    removing it may be controversial.

> Because, like you, I sure would like to be able to get rid of those
> parens around comma'd lists.

I think the last time this came up[*0] Larry said that he was going to
make:

  my @num = 2, 97, 44;

'work' by fiddling with the precedence rules.  That sounds good, but I'd
still prefer the C comma to go away entirely.

  [*0]  Possibly in response to the proposal, synthesized into an RFC by
  Luke, that square brackets rather than parens be used to denote lists.

Smylers


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Williams  
View profile  
 More options Nov 25 2003, 3:48 pm
Newsgroups: perl.perl6.language
From: willi...@tni.com (John Williams)
Date: Tue, 25 Nov 2003 13:46:39 -0700 (MST)
Local: Tues, Nov 25 2003 3:46 pm
Subject: Re: The C Comma

On Mon, 24 Nov 2003, Jonathan Scott Duff wrote:
> or maybe throw some latin in there

>    while $n++ et @accum < $total { ... }
>    while $n++ cum @accum < $total { ... }               # maybe?

I think "ac" is the latin conjunction you want.

  ac : conj. and, and also, and besides


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark J. Reed  
View profile  
 More options Nov 25 2003, 4:49 pm
Newsgroups: perl.perl6.language
From: mark.r...@turner.com (Mark J. Reed)
Date: Tue, 25 Nov 2003 15:54:04 -0500
Local: Tues, Nov 25 2003 3:54 pm
Subject: Re: The C Comma

On 2003-11-25 at 13:46:39, John Williams wrote:

> On Mon, 24 Nov 2003, Jonathan Scott Duff wrote:
> > or maybe throw some latin in there

> >       while $n++ et @accum < $total { ... }
> >       while $n++ cum @accum < $total { ... }               # maybe?

> I think "ac" is the latin conjunction you want.

>   ac : conj. and, and also, and besides

Perhaps an enclitic form?

        while $n++ (@accum < $total)que { ... }

;-)

--
Mark REED                    | CNN Internet Technology
1 CNN Center Rm SW0831G      | mark.r...@cnn.com
Atlanta, GA 30348      USA   | +1 404 827 4754


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Turoff  
View profile  
 More options Nov 25 2003, 4:49 pm
Newsgroups: perl.perl6.language
From: zi...@panix.com (Adam Turoff)
Date: Tue, 25 Nov 2003 16:03:43 -0500
Local: Tues, Nov 25 2003 4:03 pm
Subject: Re: The C Comma

That looks like syntactic sugar for

        while (do) {$n++; $foo > $bar}

and could be interpreted as either:

        while "do" {...}  ## perl5 bareword
        while do() {...}

Luke's "then" feels like the best fit on the one hand, and the worst fit
on the other.  Everything else feels worse, though.

Z.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gordon Henriksen  
View profile  
 More options Nov 25 2003, 4:49 pm
Newsgroups: perl.perl6.language
From: malic...@mac.com (Gordon Henriksen)
Date: Tue, 25 Nov 2003 13:56:16 -0500
Local: Tues, Nov 25 2003 1:56 pm
Subject: RE: The C Comma

Damian Conway wrote:
> Micheal G. Schwern wrote:

> > It also doesn't convey anything about "evaluate the left
> > hand side, ignore the results and evaluate the right".

> I think that's exactly what it conveys:

>      The suspect drank half a dozen double whiskys then drove
>      into a lake.

> Sounds *exactly* like ignoring the results of the left hand
> side to me. ;-)

Not to be a wet-blanket grammar nazi, but the sentence you give as an
example isn't proper English. "Then" is an adverb,* not a conjugation.

    The suspect drank half a dozen double whiskeys;
    then he drove into a lake.

    The suspect drank half a dozen double whiskeys
    and then drove into a lake.

--

Gordon Henriksen
IT Manager
ICLUBcentral Inc.
gor...@iclub.com

* - It's also a sometimes a noun ("live has been hard since then") and
rarely an adjective ("the then president").


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gordon Henriksen  
View profile  
 More options Nov 25 2003, 4:49 pm
Newsgroups: perl.perl6.language
From: malic...@mac.com (Gordon Henriksen)
Date: Tue, 25 Nov 2003 14:00:26 -0500
Local: Tues, Nov 25 2003 2:00 pm
Subject: RE: The C Comma

Jonathan Scott Duff wrote:
> or maybe throw some latin in there

>    while $n++ et @accum < $total { ... }
>    while $n++ cum @accum < $total { ... }               # maybe?

"Et," of course, is unsuitable as a direct synonym for "and."

I'm afraid that adding the second would cause Perl source code
to trigger spam filters...

--

Gordon Henriksen
IT Manager
ICLUBcentral Inc.
gor...@iclub.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Scott Duff  
View profile  
 More options Nov 25 2003, 4:49 pm
Newsgroups: perl.perl6.language
From: d...@lighthouse.tamucc.edu (Jonathan Scott Duff)
Date: Tue, 25 Nov 2003 14:55:51 -0600
Local: Tues, Nov 25 2003 3:55 pm
Subject: Re: The C Comma

On Tue, Nov 25, 2003 at 01:46:39PM -0700, John Williams wrote:
> On Mon, 24 Nov 2003, Jonathan Scott Duff wrote:
> > or maybe throw some latin in there

> >       while $n++ et @accum < $total { ... }
> >       while $n++ cum @accum < $total { ... }               # maybe?

> I think "ac" is the latin conjunction you want.

>   ac : conj. and, and also, and besides

Actually, I've become more convinced that I don't want any of these
:-)

        while do { $x++; @a < 5 } { ... }

or something like that is fine with me.

-Scott
--
Jonathan Scott Duff
d...@lighthouse.tamucc.edu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Austin Hastings  
View profile  
 More options Nov 25 2003, 6:48 pm
Newsgroups: perl.perl6.language
From: Austin_Hasti...@Yahoo.com (Austin Hastings)
Date: Tue, 25 Nov 2003 18:36:59 -0500
Local: Tues, Nov 25 2003 6:36 pm
Subject: RE: The C Comma

Hmm. Why not just explicitly allow semicolon when surrounded by parens?

  while ($n++; $foo > $bar) {...}

Removing the parens changes the results, which is just what you'd expect
mathematically.

  $f = (0, 1, 2, $n++, $foo > $bar);    # List

  $f = (0; 1; 2; $n++; $foo > $bar);    # Sequence of statements, three
useless.

"C" style C<for> loops then look like:

  for (($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)) {...}

Which is on the one hand yucky, but on the other hand very explicit.

(I suppose I could propose using semicolon for the list separator, but that
would drive the syntax-highlighters insane, and I like syntax-highlighting.)

=Austin

PS: An immediate drawback that occurs to me is that of catching unbalanced
parens -- when the statement terminator is a valid sequence delimiter, all
the rest of the code looks like a sequence. But the first nesting closing
brace would probably catch that.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Palmer  
View profile  
 More options Nov 25 2003, 7:00 pm
Newsgroups: perl.perl6.language
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Date: Tue, 25 Nov 2003 16:48:08 -0700
Local: Tues, Nov 25 2003 6:48 pm
Subject: Re: The C Comma

Well, because the intent of the original proposal was to "fatten up" the
C comma to make it explicit, easy to see, and clearly unambiguous.  A
semicolon does none of these things.  It also, as you mention, prevents
the compiler from catching a rather common syntax error.

But other than that, uh, sure.  Providing we spell parens C< do{} >.  :-)

> Removing the parens changes the results, which is just what you'd expect
> mathematically.

>   $f = (0, 1, 2, $n++, $foo > $bar);    # List

>   $f = (0; 1; 2; $n++; $foo > $bar);    # Sequence of statements, three
> useless.

> "C" style C<for> loops then look like:

>   for (($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)) {...}

By which you mean

    loop ($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)
    {...}

right?

Perhaps my favorite syntactic thing Perl 6 has done so far is gotten rid
of those dastardly parens on control constructs!  Yay!

Luke


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gordon Henriksen  
View profile  
 More options Nov 25 2003, 7:00 pm
Newsgroups: perl.perl6.language
From: malic...@mac.com (Gordon Henriksen)
Date: Tue, 25 Nov 2003 16:13:22 -0500
Local: Tues, Nov 25 2003 4:13 pm
Subject: RE: The C Comma

Adam Turoff wrote:
> Damian Conway wrote:

> > Perhaps this is yet another argument for insisting on:

> >       while do {$n++; $foo > $bar}

> > instead.

> That looks like syntactic sugar for

>    while (do) {$n++; $foo > $bar}

do is not merely prototyped, but a builtin. With a mandatory {} arg, why
wouldn't it be greedy?

On the other hand, ()-less conditionals are giving me heebie-jeebies
very distinctly reminiscent of Perl 5's indirect object method
invocation syntax.

--

Gordon Henriksen
IT Manager
ICLUBcentral Inc.
gor...@iclub.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Macdonald  
View profile  
 More options Nov 25 2003, 7:00 pm
Newsgroups: perl.perl6.language
From: j...@algate.perlwolf.com (John Macdonald)
Date: Tue, 25 Nov 2003 19:52:52 -0500
Local: Tues, Nov 25 2003 7:52 pm
Subject: Re: The C Comma

On Tue, Nov 25, 2003 at 04:48:08PM -0700, Luke Palmer wrote:
> Austin Hastings writes:
> > "C" style C<for> loops then look like:

> >   for (($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)) {...}

> By which you mean

>     loop ($a = 0; $b = $num_elts); $a < @arry; ($a++; $b -= $offset)
>     {...}

> right?

> Perhaps my favorite syntactic thing Perl 6 has done so far is gotten rid
> of those dastardly parens on control constructs!  Yay!

That combination means that in "for ( ; ; ) { }" the
parens are required, yet in "loop ; ; { }" they are
disallowed.  (Anything in parens immediately following
the keyword would be just the init portion, it could
no longer contain all three parts.)  So, not just the
keyword name, but the syntax is required to change.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Hodges  
View profile  
 More options Nov 26 2003, 4:39 pm
Newsgroups: perl.perl6.language
From: Paul.Hod...@bellsouth.com (Paul Hodges)
Date: 26 Nov 2003 13:39:50 -0800
Local: Wed, Nov 26 2003 4:39 pm
Subject: Re: The C Comma

dam...@conway.org (Damian Conway) wrote in message <news:3FC2AE89.5060908@conway.org>...
> I'm very much in favour of heteronymifying scalar vs list comma too.
> Or else eliminating one of them.

I definitely use the C-style comma, but would prefer eliminating it.
I can write that code another way.

Further down the thread, someone mentioned saying "then" in your head
when reading it into English. Okay, I can understand that, so let's
pick another word. I don't think this needs small Huffman coding; how
about "andthen"?

    warn "failed: $!" andthen next unless whatever();

Some of us already use "and", though I don't think we should (even
though I do).
"andthen" is poor English, but clear enough, and pretty rarely needed
anyway, right? Personally, I like "then" better, but I thought it
wouldn't hurt to make the suggestion.

> Of course, it may well be that, given the rarity of scalar commas, a better
> alternative is to simply eliminate them entirely and insist that people use
> C<do{...;...;...}> instead.

> Damian

How about the case someone mentioned of

  while do { ...

looking like

  while "do" {...
or
  while do() {...

???

I didn't see anyone respond to that yet. It didn't look like so much
of a problem to me, but maybe I just missed the subtleties?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »