Wiki

Ticket #47 (closed enhancement: duplicate)

Opened 16 years ago

Last modified 16 years ago

Syntax shortcut for declaring properties backed by instance variable

Reported by: hopscc Owned by:
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 hopscc

  • status changed from new to closed
  • resolution set to duplicate
Note: See TracTickets for help on using tickets.