Wiki

Ticket #46 (closed enhancement: fixed)

Opened 16 years ago

Last modified 16 years ago

Syntax shortcut for declaring properties backed by instance variable

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

Description

Discussed in  Syntax relaxation on var in march 2008

Provide a syntax shortcut on properties to both declare a property and implicitly define a backing variable for it.

equivalent to

var _v is <type>
pro v from var # also get/set

either totally implicit
e.g

get customer as Customer?
   # The line above explicitly declares a read only property of type 'Customer?'
   # and implicitly declares the variable '_customer' of type 'Customer?'.
   
   def init
      _customer = 'some customer'
      print .customer

or semi declaratively

get customer from var as Customer?
# the combo of a property and (implicit _named ) var decl

  def init
      _customer = 'some customer'
      print .customer

Change History

Changed 16 years ago by Chuck

I'm working on this now.

Changed 16 years ago by Chuck

  • status changed from new to accepted
  • owner set to Chuck

Woops, forgot to "Accept the ticket".

Changed 16 years ago by Chuck

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

Done in changeset:1720 where you can see the test case.

Note: See TracTickets for help on using tickets.