Ticket #24 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

Const fields can't be initialized correctly

Reported by: lth Assigned to: graydon
Type: defect Priority: blocker
Milestone: M1 Component: RefImpl
Version: 4 Keywords:
Cc: graydon, brendan

Description

A const field without an initializer can't be assigned from the constructor (or any other place for that matter).

Test code:

>> class C {
     function C() { xyzzy=true }
     public const xyzzy
   }
>> c = new C
[object C]
>> c.xyzzy
>> c.xyzzy = 10
10
>> c.xyzzy
>>

Attachments

Change History

Changed 2 years ago by lth

Dup of #42.

Changed 2 years ago by brendan

  • cc set to graydon

See #36, which wants this fixed to be "done".

/be

Changed 2 years ago by brendan

  • cc changed from graydon to graydon, brendan

Changed 2 years ago by graydon

  • owner set to graydon

Changed 2 years ago by lth

  • priority changed from major to blocker

Changed 2 years ago by lth

However, this does work as it should:

class F {
   function F() : xyzzy=true {}
   public const xyzzy
}

Thus settings use magic somehow.

Changed 2 years ago by jeffdyer

  • component changed from RefImpl to Proposals

changing component to Proposals since it is a design issue

Changed 2 years ago by jeffdyer

  • component changed from Proposals to RefImpl

never mind

Changed 2 years ago by lth

Related to #112.

Changed 1 year ago by graydon

Fixed in revision 588c0d... (though you may not enjoy the "fix"; it attempts to follow the semantics in ticket #112).

Changed 1 year ago by graydon

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