Ticket #252 (closed defect: duplicate)

Opened 8 years ago

Last modified 6 years ago

var x = 1 as readonly syntax doesn't work.

Reported by: nevdelap Owned by:
Priority: major Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:


If it should work then the bug report is that it doesn't. If it shouldn't work then the bug report is that the errors it gives indicate something odd going on.

@args -pkg:gtk-sharp-2.0

use Gdk

class Colors


        var black as Color is public, readonly
        var white = Color(255, 255, 255) is public, readonly

        cue init
            .black = Color(0, 0, 0)

class P

    def main is shared
        print, Colors.white

test2.cobra(10): error: Expecting an expression. "public" is a reserved keyword that is not expected here.

var white = Color(255, 255, 255) is readonly

test2.cobra(10): error: Cannot find "readonly".

var white = Color(255, 255, 255) is readonly, public

test2.cobra(10): error: Expecting EOL, but got "," (COMMA) instead.

var black as Color is readonly
var black as Color is readonly, public

These are fine.

Change History

Changed 8 years ago by hopscc

The 'expecting an expression' error is a dup of ticket:34 for which there are a couple of increasingly more sensible patches (from between approx 1 and 2 years ago - how the time flies) plus discussion of issue and fix path to resolution none of which seem worthy of either comment or application.
I suspect that the 'Cannot find "readonly' is from the same cause and possibly the 'Expecting EOL...' error as well ( The exact spoor of that bug varies some on exactly what construct was used after the failure point)

The readonly thing I've lost track of - ticket:100 addressed this and I thought the patch had been ignored/dropped after a little online discussion about procedure but I see theres some readonly support code in the source - so something/some part/all the patch got applied that I either missed or saw and forgot about - In either case the current status wrt the ticket isnt up to date therefore your guess is as good as mine.

So Overall, probably, this bug is a dup (:-)

Changed 6 years ago by hopscc

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