Forums

cue equals

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Re: cue equals

Postby nerdzero » Sun Jul 08, 2012 1:34 pm

Thanks, Charles. I'll update and give it a shot.

If I wanted to take a stab at making "in" work the way I want, would I look at 'class InExpr' in 'Source/BinaryOpExpr.cobra' and/or 'Source/Cobra.Lang/Native.cs'?
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: cue equals

Postby Charles » Mon Jul 09, 2012 10:03 pm

IIRC correctly, InExpr is going to use the .NET Contains() method of the list which in turn is not going to use the strongly typed .equals.

Two approaches I can think to fixing this are modifying InExpr as you've indicated here, or implementing a "cue equals" that produces the Object.equals method as a side effect.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: cue equals

Postby nerdzero » Tue Jul 17, 2012 7:42 am

Yesterday, I finally got a chance to test the latest changes in regards to equality testing and everything seems to be working quite nicely. After reading some docs on MSDN I also found that as long as my class implements the IEquatable<of T> interface, then the "in" operator will call the strongly typed equals as expected. Thanks again, Charles! :D
nerdzero
 
Posts: 286
Location: Chicago, IL

Re: cue equals

Postby Charles » Tue Jul 17, 2012 9:13 am

Good to know. Thanks for the update.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Previous

Return to Discussion

Who is online

Users browsing this forum: No registered users and 46 guests