Re: [Vala] [Genie] Generic of a Generic, dict hash/eval overrides
- From: Arc Riley <arcriley gmail com>
- To: jamie mccrack gmail com
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] [Genie] Generic of a Generic, dict hash/eval overrides
- Date: Sat, 5 Jun 2010 21:13:14 -0400
It's a Genie issue now, since they are private properties but can be
constructed with the hash/equal functions (just like GHashTable).
Can we get support for this added in before the next valac release?
Suboptimally I'm having to use a GLib.HashTable instead of a dict.
On Fri, Jun 4, 2010 at 9:22 AM, Jamie McCracken <jamie mccrack gmail com>wrote:
On Fri, 2010-06-04 at 00:08 -0400, Arc Riley wrote:
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>
<
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.
Its a libgee issue AFAICT - they used to expose hash and equal functions
but have hidden them when I last looked
jamie
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]