Wiki

Ticket #326 (closed enhancement: fixed)

Opened 12 years ago

Last modified 11 years ago

Move to .Net 4.0: Support Named Parameters

Reported by: hopscc Owned by: hopscc
Priority: major Milestone:
Component: Cobra Compiler Version: 0.9.4
Keywords: Cc:

Description

C# 4.0 supports Named parameters on method paramlist so methods can be called giving params in any order tagged by their name.
Cobra should support this also

see  C# 4.0 New Features Named Parameters

C# uses name:arg in arglist to tag the arg to the parameter.

Cobra should probably use assignment name=arg.

myArrayList = ArrayList()
Process( "foo", true ) # valid, moreData omitted
Process( "foo", true, myArrayList ) # valid
Process( "foo", moreData = myArrayList) # valid, ignoreWS omitted
Process( "foo", moreData=myArrayList, ignoreWS=false ) # valid, but silly

Support this after addressing ticket:325 (Optional Parameters)

Watch out for complications from existing support for auto property assignment (in initializer calls).

Attachments

named-params.patch Download (33.9 KB) - added by hopscc 11 years ago.

Change History

Changed 12 years ago by hopscc

  • owner set to hopscc
  • status changed from new to assigned

Changed 12 years ago by hopscc

As anticipated auto property initialisation ( extended initialisation) is proving a bit of a complication in association with this.
Refactoring PostCallExpr._bindImp.

Also noted no cobra checking on args vs params or best overload for (PostCallExpr?) constructors - falls through to backend compiler. There will be some improvement of this.

Changed 11 years ago by hopscc

Supporting checks on !postCallExpr contructors is proving a little tricky.
I'll address that as a separate enhancement - ticket:336 - after this ticket is closed.

Changed 11 years ago by hopscc

Changed 11 years ago by Charles

Looking at this now.

Changed 11 years ago by Charles

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in changeset:3024

Thanks!

Note: See TracTickets for help on using tickets.