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
surprising consequences
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
  5 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
 
Juerd  
View profile  
 More options Apr 25 2005, 3:05 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd)
Date: Mon, 25 Apr 2005 21:05:49 +0200
Local: Mon, Apr 25 2005 3:05 pm
Subject: surprising consequences
Assuming the following are true:

    A: "if" is now a normal function

    B: "foo() + 3" is (foo) + 3, foo doesn't get 3.

Then does that mean we're stuck with:

    C: "if($foo) { say 'foo' }" being a syntax error?

I currently think A is wrong. Am I right?

Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html


 
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 Apr 25 2005, 3:37 pm
Newsgroups: perl.perl6.language
From: r...@rodadams.net (Rod Adams)
Date: Mon, 25 Apr 2005 14:37:40 -0500
Local: Mon, Apr 25 2005 3:37 pm
Subject: Re: surprising consequences

There will always be various control constructs that cannot be written
as an equivalent function. Otherwise, there is no way to write the
higher level ones.

I suspect that "goto" and "if" are on this list. Possibly they are the
only things on this list, but "return" is a strong contender.

Additionally, any predicate form cannot be a "normal function". You
might be able to define an &infix:<for>, but getting to where you don't
need the {}'s on the LHS block, and getting a proper list on the RHS
gets rather abnormal.

Something that crossed my mind while writing this: Does

    for { say } <== @a;

Work?

-- Rod Adams


 
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.
Juerd  
View profile  
 More options Apr 25 2005, 3:42 pm
Newsgroups: perl.perl6.language
From: ju...@convolution.nl (Juerd)
Date: Mon, 25 Apr 2005 21:42:06 +0200
Local: Mon, Apr 25 2005 3:42 pm
Subject: Re: surprising consequences
Rod Adams skribis 2005-04-25 14:37 (-0500):

> There will always be various control constructs that cannot be written
> as an equivalent function. Otherwise, there is no way to write the
> higher level ones.

Not a problem, because we're using something to bootstrap, and the perl
6 you'll be using to run your Perl 6 scripts will be in compiled form,
free of any need to parse itself.

Self-definition is a wonderful thing.

> Something that crossed my mind while writing this: Does
>    for { say } <== @a;
> Work?

If for's just a function that takes a slurpy list, then I see no reason
why not.

Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html


 
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 Apr 25 2005, 2:36 pm
Newsgroups: perl.perl6.language
From: l...@luqui.org (Luke Palmer)
Date: Mon, 25 Apr 2005 12:36:21 -0600
Local: Mon, Apr 25 2005 2:36 pm
Subject: Re: surprising consequences

Juerd writes:
> Assuming the following are true:

>     A: "if" is now a normal function

Almost.  It's a statement-level form, which looks like a normal function
except for the statement: prepended on its name.  Such constructs (which
include for, while, the whole gang) have a few special properties:

* They can't be used intra-expression.

    say 3 + if foo() { 4 } else { 5 }    # error!

* An opening brace anywhere (not inside brackets) in operator position
  gets passed to them:

    sub foo (*@_);
    sub bar (*@_);

    if foo 1, bar 2 { ... }
                    ^ belongs to the if

You could use if() intra-expression like so:

    say 3 + &statement<if else>().({foo()}):{4}:{5};

(Ick).

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.
Larry Wall  
View profile  
 More options May 3 2005, 8:55 am
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Tue, 3 May 2005 05:55:08 -0700
Local: Tues, May 3 2005 8:55 am
Subject: Re: surprising consequences
On Mon, Apr 25, 2005 at 02:37:40PM -0500, Rod Adams wrote:

: Something that crossed my mind while writing this: Does
:
:    for { say } <== @a;
:
: Work?

Nope.  The brackets where a term is expected would be misconstrued
as an argument to the "for".  Maybe we need an @= for a placeholder:

    for @= { say } <== @;

Or maybe we could just make () serve that purpose:

    for () { say } <== @;

Larry


 
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 »