> I'm trying to use Moq with Boo, but i'm having some problems in how to > pass the lambdas to Moq.
> interface IBehavior: > Name as string: > get > set
> def Start()
> behavior = Mock[of IBehavior]() > behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1") > behavior.Setup({b as IBehavior | b.Start()})
> The compiler complains in the Setyp methods.
> Using Boo 0.9.1.3287
Hi Georges,
Are you using Boo trunk or Boo 0.9.1 (the version number is still the same, Rodrigo feel free to "bin update" ;-) ) ? If confirmed with trunk can you post the -vvv output here.
I'm using one version between the latest stable and the trunk version.
But looking at the Moq code, it looks like the setup method needs a
lambda expression as parameter. Exists in Boo any way to express
lambda expressios ? If i'm not mistaken they aren't the samething as
callables/delegates.
Thx
Sent from my iPhone
On 04/07/2009, at 01:36, Cedric Vivier <cedr...@neonux.com> wrote:
> On Sat, Jul 4, 2009 at 4:48 AM, Georges Benatti Junior <gbena...@gmail.com > > wrote:
> I'm trying to use Moq with Boo, but i'm having some problems in how to
> pass the lambdas to Moq.
> interface IBehavior:
> Name as string:
> get
> set
> def Start()
> behavior = Mock[of IBehavior]()
> behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1")
> behavior.Setup({b as IBehavior | b.Start()})
> The compiler complains in the Setyp methods.
> Using Boo 0.9.1.3287
> Hi Georges,
> Are you using Boo trunk or Boo 0.9.1 (the version number is still
> the same, Rodrigo feel free to "bin update" ;-) ) ?
> If confirmed with trunk can you post the -vvv output here.
What is the error exactly?
Lambdas in C# are sort of interesting in that they can be used to express
two different types, Delegates or Expressions. I'm not sure how it works in
Boo, but if it can't compile a lambda into an expression that might explain
your error. For example in C#:
But will compile to different types. I'm guessing the Moq framework is using
the Expression<T, bool>? In that case you get an expression tree which you
can look at and query to get all of the inner expressions at runtime and do
reflection and what not. You can also compile it into a delegate on the fly
and execute it. Will boo compile lambdas into Expression<Delegate>? or does
it always build a delegate?
On Sun, Jul 5, 2009 at 6:06 PM, Georges Benatti Jr <gbena...@gmail.com>wrote:
> I'm using one version between the latest stable and the trunk version.
> But looking at the Moq code, it looks like the setup method needs a lambda
> expression as parameter. Exists in Boo any way to express lambda expressios
> ? If i'm not mistaken they aren't the samething as callables/delegates.
> Thx
> Sent from my iPhone
> On 04/07/2009, at 01:36, Cedric Vivier <cedr...@neonux.com> wrote:
> On Sat, Jul 4, 2009 at 4:48 AM, Georges Benatti Junior <<gbena...@gmail.com>
> gbena...@gmail.com> wrote:
>> I'm trying to use Moq with Boo, but i'm having some problems in how to
>> pass the lambdas to Moq.
>> interface IBehavior:
>> Name as string:
>> get
>> set
>> def Start()
>> behavior = Mock[of IBehavior]()
>> behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1")
>> behavior.Setup({b as IBehavior | b.Start()})
>> The compiler complains in the Setyp methods.
>> Using Boo 0.9.1.3287
> Hi Georges,
> Are you using Boo trunk or Boo 0.9.1 (the version number is still the same,
> Rodrigo feel free to "bin update" ;-) ) ?
> If confirmed with trunk can you post the -vvv output here.
That is the case, Moq expects Expressions and not delegates, because
it introspect the Expression to see if some call to the method defined
in the expression tree was called.
I'm almost sure that Boo doesn't compile a lambda to a Expression, so
it can't be used with Moq :(
On Mon, Jul 6, 2009 at 12:57 PM, Justin Chase<justin.m.ch...@gmail.com> wrote:
> What is the error exactly?
> Lambdas in C# are sort of interesting in that they can be used to express
> two different types, Delegates or Expressions. I'm not sure how it works in
> Boo, but if it can't compile a lambda into an expression that might explain
> your error. For example in C#:
> void A<T>(Expression<Func<T, bool>> expression) { ... }
> void B<T>(Func<T, bool>> func) { ... }
> Can both be called like this:
> A(a => a.Value > 100);
> B(b => b.Value > 100);
> But will compile to different types. I'm guessing the Moq framework is using
> the Expression<T, bool>? In that case you get an expression tree which you
> can look at and query to get all of the inner expressions at runtime and do
> reflection and what not. You can also compile it into a delegate on the fly
> and execute it. Will boo compile lambdas into Expression<Delegate>? or does
> it always build a delegate?
> On Sun, Jul 5, 2009 at 6:06 PM, Georges Benatti Jr <gbena...@gmail.com>
> wrote:
>> Hi
>> I'm using one version between the latest stable and the trunk version.
>> But looking at the Moq code, it looks like the setup method needs a lambda
>> expression as parameter. Exists in Boo any way to express lambda expressios
>> ? If i'm not mistaken they aren't the samething as callables/delegates.
>> Thx
>> Sent from my iPhone
>> On 04/07/2009, at 01:36, Cedric Vivier <cedr...@neonux.com> wrote:
>> On Sat, Jul 4, 2009 at 4:48 AM, Georges Benatti Junior
>> <gbena...@gmail.com> wrote:
>>> I'm trying to use Moq with Boo, but i'm having some problems in how to
>>> pass the lambdas to Moq.
>>> interface IBehavior:
>>> Name as string:
>>> get
>>> set
>>> def Start()
>>> behavior = Mock[of IBehavior]()
>>> behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1")
>>> behavior.Setup({b as IBehavior | b.Start()})
>>> The compiler complains in the Setyp methods.
>>> Using Boo 0.9.1.3287
>> Hi Georges,
>> Are you using Boo trunk or Boo 0.9.1 (the version number is still the
>> same, Rodrigo feel free to "bin update" ;-) ) ?
>> If confirmed with trunk can you post the -vvv output here.
> That is the case, Moq expects Expressions and not delegates, because
> it introspect the Expression to see if some call to the method defined
> in the expression tree was called.
> I'm almost sure that Boo doesn't compile a lambda to a Expression, so
> it can't be used with Moq :(
> Thanks, Guys
> On Mon, Jul 6, 2009 at 12:57 PM, Justin Chase<justin.m.ch...@gmail.com>
> wrote:
> > What is the error exactly?
> > Lambdas in C# are sort of interesting in that they can be used to express
> > two different types, Delegates or Expressions. I'm not sure how it works
> in
> > Boo, but if it can't compile a lambda into an expression that might
> explain
> > your error. For example in C#:
> > void A<T>(Expression<Func<T, bool>> expression) { ... }
> > void B<T>(Func<T, bool>> func) { ... }
> > Can both be called like this:
> > A(a => a.Value > 100);
> > B(b => b.Value > 100);
> > But will compile to different types. I'm guessing the Moq framework is
> using
> > the Expression<T, bool>? In that case you get an expression tree which
> you
> > can look at and query to get all of the inner expressions at runtime and
> do
> > reflection and what not. You can also compile it into a delegate on the
> fly
> > and execute it. Will boo compile lambdas into Expression<Delegate>? or
> does
> > it always build a delegate?
> > On Sun, Jul 5, 2009 at 6:06 PM, Georges Benatti Jr <gbena...@gmail.com>
> > wrote:
> >> Hi
> >> I'm using one version between the latest stable and the trunk version.
> >> But looking at the Moq code, it looks like the setup method needs a
> lambda
> >> expression as parameter. Exists in Boo any way to express lambda
> expressios
> >> ? If i'm not mistaken they aren't the samething as callables/delegates.
> >> Thx
> >> Sent from my iPhone
> >> On 04/07/2009, at 01:36, Cedric Vivier <cedr...@neonux.com> wrote:
> >> On Sat, Jul 4, 2009 at 4:48 AM, Georges Benatti Junior
> >> <gbena...@gmail.com> wrote:
> >>> I'm trying to use Moq with Boo, but i'm having some problems in how to
> >>> pass the lambdas to Moq.
> >>> interface IBehavior:
> >>> Name as string:
> >>> get
> >>> set
> >>> def Start()
> >>> behavior = Mock[of IBehavior]()
> >>> behavior.Setup({b as IBehavior | b.Name}).Returns("Behavior_1")
> >>> behavior.Setup({b as IBehavior | b.Start()})
> >>> The compiler complains in the Setyp methods.
> >>> Using Boo 0.9.1.3287
> >> Hi Georges,
> >> Are you using Boo trunk or Boo 0.9.1 (the version number is still the
> >> same, Rodrigo feel free to "bin update" ;-) ) ?
> >> If confirmed with trunk can you post the -vvv output here.