Forums

Cobra January 2009 Update

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

Cobra January 2009 Update

Postby Charles » Tue Feb 03, 2009 9:05 pm

This is a new update for January, covering improvements since the last update for December.

To get access to these improvements, there is a HowToInstallFromSource wiki page covering the ease and benefits of using Cobra from the source repository, and how to do it.

The following improvements are due to patches and feedback from the community as well as my own efforts. Thanks to all contributors including hopscc, gauthier and others!

Language

-- Improved and clarified the behavior of surrounding namespaces and "use". See discussion for details.

Library

-- Added extension methods to IEnumerable and IList<of T> that are immediately available in Cobra programs. See StandardLibraryExtensionMethods.

Misc

-- Added or improved 9 error messages.

-- Fixed 14 bugs.

-- Made 1 optimization regarding numeric for loops. (credit: hopscc)

Docs, Samples and How-To's

-- I presented Cobra at SoCal Code Camp Fullerton 2009-01. Here are the slides in PDF format.

-- New Cobra related project: http://code.google.com/p/nant-cobra-tasks/ by gauthier

-- We worked out some new sample code for writing a number in plain English via this discussion thread.

-- New or updated wiki pages this month:
---- RelatedProjects
---- NAntCobraTasks

-- New or updated wiki pages in the past couple days:
---- TypesOverview
---- StreamType
---- StandardLibraryExtensionMethods

-- Added Shapes sample whose purpose is to "see this small problem written in several different OO languages".


The next update will be around March 1 for the month of February, but you can always keep up to date by following the discussion forums.

We hope you'll try out the latest Cobra!


Best regards,

Chuck Esterbrook
Charles
 
Posts: 2451
Location: Los Angeles, CA

Re: Cobra January 2009 Update

Postby jonathandavid » Wed Feb 04, 2009 4:59 am

Thanks Chuck, this is a good update. For me the best part is that we can now pass delegates as constructor initializers. Hopefully soon we'll have named (or keyword) arguments!


Chuck wrote:Library

-- Added extension methods to IEnumerable and IList<of T> that are immediately available in Cobra programs. See StandardLibraryExtensionMethods42.


I see you've added a version of split that take the separators as a List<of char> (as oppose to their clumsier .NET counterparts, that take arrays). However, you've forgotten the version of split that takes the maximum number of generated tokens:

"1,2,3,4".split([c','], 2) => "1" "2,3,4"

Also, you'll concede that the [c','] syntax, albeit better than the array one, is far from ideal. Why not take the separators a a string instead? This way, the example above becomes:

"1,2,3,4".split(',', 2)

Way better, IMHO.

Also, I see that you've create another version of split that takes an IList<of T>. I'm sure there is a good reason for that, can you enlighten me? In case you reject my "separators as a string" suggestion, why not have split take an IEnumerable<of T> (T*), which would cover all possible collections?
jonathandavid
 
Posts: 159

Re: Cobra January 2009 Update

Postby Charles » Wed Feb 04, 2009 7:04 am

I'm all for your suggestions. I just added a couple of split's that someone had requested and did not take the time to flesh out all the possibilities. The IList overload is there for convenience--you can pass anything IList. Then List is in there for efficiency. And yes "char*" should be in there (remember I now favor streams over directly naming IEnumerable<of T>)).

And yes to splitting on strings both for nice syntax and also the functionality.

Would you mind doing this and submitting a patch? I'm always on the hook for the brain teasing bugs, backend refactoring and other things. I could use some parallel efforts!
Charles
 
Posts: 2451
Location: Los Angeles, CA

Re: Cobra January 2009 Update

Postby jonathandavid » Wed Feb 04, 2009 9:57 am

Chuck wrote:I'm all for your suggestions. I just added a couple of split's that someone had requested and did not take the time to flesh out all the possibilities. The IList overload is there for convenience--you can pass anything IList. Then List is in there for efficiency. And yes "char*" should be in there (remember I now favor streams over directly naming IEnumerable<of T>)).

And yes to splitting on strings both for nice syntax and also the functionality.

Would you mind doing this and submitting a patch? I'm always on the hook for the brain teasing bugs, backend refactoring and other things. I could use some parallel efforts!


Ok, I'll be glad to help.
jonathandavid
 
Posts: 159

Re: Cobra January 2009 Update

Postby jonathandavid » Thu Feb 05, 2009 12:39 am

I've added a ticket.
jonathandavid
 
Posts: 159


Return to Discussion

Who is online

Users browsing this forum: No registered users and 2 guests