[Vala] [Genie] Generic of a Generic, dict hash/eval overrides
- From: Arc Riley <arcriley gmail com>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] [Genie] Generic of a Generic, dict hash/eval overrides
- Date: Fri, 4 Jun 2010 00:08:53 -0400
What is the intended syntax for something like this:
blobs : list of array of uint8
The best I've found so far is
struct bytes
value : array of uint8
blobs : list of bytes
Which is less desirable as its more verbose to refer to and generates
less-clean code. For this specific case it'd be awesome to have an actual
"bytes" type counterpart to the "string" type.
Also, reading http://jamiemcc.livejournal.com/12009.html:
The big advantage of embedding lists and dicts in the language is that it
makes it much easier for the developer to make use of them. It also means
genie can make decisions about which hashing and equal functions to use
based on the types (Eg for a dict of string,string it would use the glib
g_str_hash and g_str_equal functions automatically although you could of
course specify different ones by setting the properties explicitly) whereas
in vala you would have to type something like :
var map = new Gee.HashMap<string, string>(GLib.str_hash, GLib.str_equal);
There seems to be a problem in that these HashMap properties are read-only:
http://people.gnome.org/~dvillevalois/libgee/doc/gee-1.0/Gee.HashMap.key_hash_func.html<http://people.gnome.org/%7Edvillevalois/libgee/doc/gee-1.0/Gee.HashMap.key_hash_func.html>
The Pythonic way would be for the key type to have a hash and equal
functions and for the dict to use these when present, but it appears
undocumented how to set these functions explicitly.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]