[sugar] Proper D-Bus usage (was Re: October 29 - Tarballs due for 0.83.1)

Bert Freudenberg bert at freudenbergs.de
Wed Oct 29 12:30:14 EDT 2008


On 29.10.2008, at 03:42, Marco Pesenti Gritti wrote:

> On Wed, Oct 29, 2008 at 9:45 AM, Tomeu Vizoso  
> <tomeu at tomeuvizoso.net> wrote:
>>
>> We could easily hack the DS in 0.83 to return D-Bus strings for
>> standard properties that are known (or rather, expected) to contain
>> textual data, but introducing this inconsistency in the API may not  
>> be
>> such a good idea.

I don't see how it would be "inconsistent" that when an activity saves  
a "title" meta-data property which obviously is a string, and it  
resumes, to expect it will be returned as a string and not magically  
converted to a byte array. An activity should not have to care about  
the DS's internal representation.

For custom properties you could state they must be byte arrays, but  
for the known properties it certainly is more appropriate to use the  
actual data type. A byte array is not a string. Or vice versa. If you  
disagree, ask the D-Bus designers why they did put in a string type  
instead of simply using byte arrays.

And after all, the meta data is declared to be a{sv} instead of a{say}  
precisely to accommodate appropriate types for the values.

> After all I think the best solution here is to adapt Etoys.

"Best" in what sense? It indeed is easy enough to make Etoys cope with  
byte arrays, but IMHO it adds to the confusion of every future  
implementer of a non-Python activity.

> The inconsistency could be really confusing.


I mentioned it before, and I still maintain that this is an abuse of D- 
Bus. Things that are strings should be transmitted as strings. If  
nothing else it makes debugging a lot easier - strings will be  
rendered as strings by the various D-Bus diagnostic tools.

So, pretty please ... with sugar on top ;) deliver the strings as  
strings.

- Bert -




More information about the Sugar mailing list