Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Anonymous callables
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
  4 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
 
Ayende Rahien  
View profile  
 More options Jun 23, 6:13 pm
From: Ayende Rahien <aye...@ayende.com>
Date: Wed, 24 Jun 2009 01:13:19 +0300
Local: Tues, Jun 23 2009 6:13 pm
Subject: Anonymous callables

I am trying to make something like this works:
import System

callable IntCallable(i as int)

def Foo(f as IntCallable, i as int):
f(i)

Foo({i |
j = i * 2
print j

}, 1)

Actually, I would probably like the do(i) syntax better, but either of them
give me compilation errors.
Short of defining this as a variable, is there a syntax option that I am
missing?

    Reply to author    Forward  
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.
Justin Chase  
View profile  
 More options Jun 23, 8:20 pm
From: Justin Chase <justin.m.ch...@gmail.com>
Date: Tue, 23 Jun 2009 19:20:50 -0500
Local: Tues, Jun 23 2009 8:20 pm
Subject: Re: Anonymous callables

Feels a little wrong but you can do this:
Foo({i |
j = i * 2;
print j;

}, 1)

I think the semi colons work because the newline is ignored when inside of
another expression (the method invoke expression).

--
Justin Chase
http://www.justnbusiness.com

    Reply to author    Forward  
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.
Ayende Rahien  
View profile  
 More options Jun 23, 10:53 pm
From: Ayende Rahien <aye...@ayende.com>
Date: Wed, 24 Jun 2009 05:53:34 +0300
Local: Tues, Jun 23 2009 10:53 pm
Subject: Re: Anonymous callables

Cool, thanks.

On Wed, Jun 24, 2009 at 3:20 AM, Justin Chase <justin.m.ch...@gmail.com>wrote:


    Reply to author    Forward  
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.
Rodrigo B. de Oliveira  
View profile  
 More options Jun 24, 10:44 am
From: "Rodrigo B. de Oliveira" <rodrigobam...@gmail.com>
Date: Wed, 24 Jun 2009 11:44:41 -0300
Local: Wed, Jun 24 2009 10:44 am
Subject: Re: Anonymous callables

On Tue, Jun 23, 2009 at 7:13 PM, Ayende Rahien <aye...@ayende.com> wrote:

> ...
> Actually, I would probably like the do(i) syntax better, but either of them give me compilation errors.

The "do" syntax only works when the callable is the last argument to the method.

    Reply to author    Forward  
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 »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google