Okay, this works:
Foo({i as int |
j = i * 2;
print j;
}, 1)
On Wed, Jun 24, 2009 at 2:19 AM, Craig Neuwirt <[email protected]> wrote:
> Thanks,
>
> In certain circumstances I was able to abuse the language and use compund
> assignment operator ,
> if all the statements had a return value. Of course, this breaks down for
> voids
>
> * b.Foo({i | *
> * i.DoSomething(),*
> * i.DoSomethingElse()*
> * })*
>
> cheers,
> craig
> On Tue, Jun 23, 2009 at 5:12 PM, Ayende Rahien <[email protected]> wrote:
>
>> I don't think that you can, but I posted it in the Boo mailing list.
>>
>>
>> On Tue, Jun 23, 2009 at 4:25 PM, Craig Neuwirt <[email protected]>wrote:
>>
>>> The issue I am having is when it isused within a fluent model.
>>>
>>> e.g.
>>>
>>> *class Bar:
>>> def Foo(f as IntCallable) as Bar:
>>> f(2)
>>> return self
>>>
>>> b = Bar()*
>>>
>>> I can do this
>>>
>>> *b.Foo do(i):
>>> print i
>>> print i + 2*
>>>
>>> which is a single call with multiple statements
>>>
>>> and I can do
>>>
>>> *b.Foo({i | print i}).Foo({i | print i + 2})
>>> *
>>> which is chained calls with single statements,
>>>
>>> but how can I do chained calls with multiple statements
>>>
>>> *b;Foo( do(i):
>>> print i
>>> print i + 2
>>> )
>>> .Foo( do(i):
>>> print i + 3
>>> print i + 4
>>> )*
>>>
>>> and I can't figure out that syntax
>>>
>>> thanks,
>>> craig
>>>
>>>
>>> But how can I do the same thing if
>>>
>>>
>>>
>>> On Tue, Jun 23, 2009 at 3:44 AM, Ayende Rahien <[email protected]>wrote:
>>>
>>>> This works for me:
>>>> import System
>>>>
>>>> callable IntCallable(i as int)
>>>>
>>>> def Foo(f as IntCallable):
>>>> f(2)
>>>> Foo do(i):
>>>> print i
>>>>
>>>> On Mon, Jun 22, 2009 at 9:24 PM, Craig Neuwirt <[email protected]>wrote:
>>>>
>>>>> I am trying to use anonymous delegates in a binsor file, but I can only
>>>>> seem to get it to work for delegates with a singe statements, but I need
>>>>> to
>>>>> define multiple statements.
>>>>>
>>>>> e.g. Assume SomeMethod accepts an Action<Something>
>>>>>
>>>>> In my binsor I can do this
>>>>>
>>>>> SomeMethod( {s | s.Hello()} )
>>>>>
>>>>> but how do I define the anonymous delegate with multple statements?
>>>>>
>>>>> I tried
>>>>>
>>>>> SomeMethod( do(s) :
>>>>> s.Hello()
>>>>> s.GoodBye()
>>>>> )
>>>>>
>>>>> And
>>>>>
>>>>> SomeMethod() do(s):
>>>>> s.Hello()
>>>>> s.Goodbye()
>>>>>
>>>>> but neither works
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> thanks,
>>>>> craig
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> >>
>>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---