[Vala] Initializing structs inside an object
- From: Chris Molozian <chris cmoz me>
- To: vala-list gnome org
- Subject: [Vala] Initializing structs inside an object
- Date: Sun, 19 Jun 2011 16:29:02 +0100
Hey,
Not sure what I'm doing wrong here:
------------------------------------------------------------------------
[indent=4]
init
var options = new Options()
print options.version
return
class Options : Object
prop readonly version : bool
const _options : array of OptionEntry = {
{"version", 0, OptionFlags.IN_MAIN, OptionArg.NONE, ref _version,
"output version information and exit", null},
{ null }
}
init
_version = false
------------------------------------------------------------------------
This produces the following compiler error output:
valac --verbose --fatal-warnings --save-temps --enable-checking
--pkg=gtk+-3.0 -d build -o testgtk src/testgtk/main.gs
src/testgtk/main.gs:13.107-13.114: error: Access to instance member
`Options._version' denied
{"version", 0, OptionFlags.IN_MAIN, OptionArg.NONE, ref _version,
^^^^^^^^
src/testgtk/main.gs:13.103-13.114: error: expression type not allowed as
initializer
{"version", 0, OptionFlags.IN_MAIN, OptionArg.NONE, ref _version,
^^^^^^^^^^^^
src/testgtk/main.gs:13.51-13.51: error: expression type not allowed as
initializer
{"version", 0, OptionFlags.IN_MAIN, OptionArg.NONE, ref _version,
^
make: *** [testgtk] Segmentation fault
Cheers,
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]