Wiki

Ticket #329 (new enhancement)

Opened 12 years ago

Last modified 11 years ago

Move to .Net 4.0: Generate C# Automatic properties and Object Initializers for Cobra property inits (codegen)

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

Description

Modify C# codegen to use newer (.Net 3.0) C# Object Initializers.

(This is a replacement for the existing handling for auto property setting on Constructors)

see  C# 3.0 Features

Change History

Changed 12 years ago by hopscc

  • summary changed from Move to .Net 4.0: Generate C# Object Initializers for Cobra property inits (codegen) to Move to .Net 4.0: Generate C# Automatic properties and Object Initializers for Cobra property inits (codegen)

Also change codegen to use Automatic properties syntax (elides decl of backing variable) for Props that have simple get/set access to a backing variable.

see  C# 3.0 Features

probably can also use newer (.Net 3.0) Collection Initialiser and Dictionary Initialiser syntax rather than current code.

Changed 11 years ago by Charles

I don't think this one is possible: "Also change codegen to use Automatic properties syntax (elides decl of backing variable) for Props that have simple get/set access to a backing variable."

Because C# and Cobra differ on the backing variable. In C#, the backing var is private and cannot be referenced anywhere in the call vs. in Cobra, the backing var is protected and named _foo.

Changed 11 years ago by hopscc

OK, sounds reasonable
Shouldnt make any difference since in most cases no-one will be looking/using the C# generated code directly anyway

Can probably close this one then....

Changed 11 years ago by Charles

Well this is a compound ticket with the subject specifying two different things:

  • Generate C# Automatic properties
  • Generate Object Initializers for Cobra property inits (codegen)

So probably this ticket should be closed and a new one opened for the 2nd item. Right?

Changed 11 years ago by hopscc

Or just rename this one (back oops) - already noted not/cant do the C# automatic properties.

Note: See TracTickets for help on using tickets.