It seems that is something out-of-date in Genie's website. Perhaps HashMaps are not supported anymore or their syntax has changed.
If one tries the examples from the old BarryK website:
uses
Gee
init
var d = new dict of string,string
d["fruit"] = "apple"
d["animal"] = "dog"
d.set("plant","cactus")
d.set("animal","hippopotomus") /*changes from 'dog'*/
if d.contains("plant") == true do print "Key 'plant' is in dictionary"
print "%s", d.get("animal")
for o in d.keys do print o //old libgee use d.get_keys()
for o in d.values do print o //old libgee use d.get_values()
d.remove("animal")
One gets the error dicts.gs:7.36-7.40: error: syntax error, embedded statement cannot be declaration
for the lines starting with:
- if d.contains
- for o in d.keys
- for o in d.values
Furthermore, using the official Genie website there is no much success:
[indent=4]
uses
Gee
init
/* test dicts */
var d = new dict of string,string
/* add or change entries with following */
d["Genie"] = "Great"
d["Vala"] = "Rocks"
/* access entires using d[key] */
/* note that instead of "d.get_keys ()" it is "d.keys" in newer Versions of Gee */
for s in d.get_keys ()
print "%s => %s", s, d[s]
Generates the error: dicts.gs:18.14-18.23: error: The name `get_keys' does not exist in the context of `Gee.HashMap<string,string>'
for line for s in d.get_keys ()
Am I missing something or is the site out of date?
Update For completness, I've been using Manjaro linux, my libgee package is version 0.18 and there is an extra error in compilation gee-0.8.vapi:664.4-664.13: warning: [Deprecated] is deprecated. Use [Version (deprecated = true, deprecated_since = "", replacement = "")]