Forums

LINQ

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

LINQ

Postby Charles » Mon Feb 11, 2008 3:14 am

I was asked in an email:
What are your plans for LINQ (Expression, Lambda, ...) support in cobra?

The plan is to fully embrace it. Right now Cobra has LINQ Jr:
names = for name in names where name.trim.length get name.trim

So you can enumerate, filter and transform. Obviously there's a lot missing and it's not backed by expression trees so it's not the "real thing". But it was a good start for .NET 2.0.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: LINQ

Postby neuruss » Mon Feb 11, 2008 6:44 pm

So I assume that you are not looking to implement list comprehensions (ala python), since Linq offers the same capabilities.
Is that right?
neuruss
 
Posts: 23

Re: LINQ

Postby Charles » Mon Feb 11, 2008 11:29 pm

What Cobra currently offers matches Python's list comprehensions in capability. The syntax is different for two reasons.

One is to match the order that you would use with the statements approach:
results = []
for name in names
if name.trim.length
results.add(name)
names = results
# expression version is same order; reuses brain space:
names = for name in names where name.trim.length get name.trim


The other is to support Intellisense:
names = for name in names where name.trim.length get name._


In Python, they put the transformation expression first:
Code: Select all
names = name._

No Intellisense for you!
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 20 guests