From freedesktop-dbus Sat Jan 28 16:03:28 2023 From: Thiago Macieira Date: Sat, 28 Jan 2023 16:03:28 +0000 To: freedesktop-dbus Subject: Re: Default value for `in` parameter Message-Id: <20684129.0c2gjJ1VT2 () tjmaciei-mobl5> X-MARC-Message: https://marc.info/?l=freedesktop-dbus&m=167492179114210 On Saturday, 28 January 2023 04:01:14 PST Charles Wong wrote: > Hi, > > Is this the right place to ask dbus questions? > > For example, there is a dbus config (is from > https://gjs.guide/guides/gio/dbus.html#high-level-proxies): > ```xml > > > > > ``` > > Is it possible to set a default value to parameter `input` and mark it as > unrequired? No, it's not. Please understand the introspection is a completely optional step. What you're suggestion would require a client to parse the XML to discover the default value. However, the client can just place the call with fewer arguments. If the destination service knows how to deal with that, then the problem is solved. This would be like "overloading" in C++, where you can have multiple methods with the same names but different parameters. The wire protocol permits this and many C++-based applications have such methods. It's also permitted and permissible in the XML introspection by the schema, but it is discouraged for compatibility reasons. For your own service and clients, you can do it, but just remember this won't be accepted for use in widely-standardised services. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel DCAI Cloud Engineering