Hi Al,
On 19.04.2017 14:17, Al Thomas wrote: > Concatenation of variables is done at run time, so you either need to > make the strings constant or use properties to allow the concatenation to > occur at run time: > > void main () { > var a = new Test (); > print (@"Extension: $(Test.ext)\n"); > print (@"Filename: $(a.filename)\n"); > print (@"Path: $(a.path)\n"); > } > > class Test { > public const string ext = ".ext"; > private string _filename; > public string filename {get {_filename = "test" + ext; return _filename;}} > private string _path; > public string path {get {_path = "/full/path/" + filename; return _path;}} > } I tried it out in that way: // Constants used by create_publication_core private string _filename; private string _path; private const string REV_HIST = "Revision_History.xml"; private const string AUTHOR_GROUP = "Author_Group.xml"; private const string ENTITY_FILE_SUFFIX = ".ent"; private const string DIRECTORY_SEPARATOR_CHAR = "/"; private const string ENTITY_FILE_LOCAL = {get {_filename = publication_title + ENTITY_FILE_SUFFIX; return _filename;}} private const string PROJECT_DIR = {get {_path = target_dir + DIRECTORY_SEPARATOR_CHAR + publication_title + DIRECTORY_SEPARATOR_CHAR + create_language; return _path;}} The compiler says: core/create_publication_core.vala:51.48-51.48: error: syntax error, expected `}' private const string ENTITY_FILE_LOCAL = {get {_filename = publication_title + ENTITY_FILE_SUFFIX; return _filename;}} ^ core/create_publication_core.vala:52.42-52.42: error: syntax error, expected `}' private const string PROJECT_DIR = {get {_path = target_dir + DIRECTORY_SEPARATOR_CHAR + publication_title + DIRECTORY_SEPARATOR_CHAR + create_language; return _path;}} Maybe i miss anything? Greetings Sascha -- Sascha Manns Maifeldstraße 10 56727 Mayen P: +49-2651-4014045 W: http://saigkill.tuxfamily.org
signature.asc
Description: OpenPGP digital signature
_______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list