Re: Functional programming with GLib



On 2 May 2017 at 00:09, Matthias Clasen <matthias clasen gmail com> wrote:

On Thu, Apr 27, 2017 at 10:29 AM, Emmanuele Bassi <ebassi gmail com> wrote:

For command line parsing I'd actually favour a slightly bolder
approach of deprecating GOptionContext, and having something slightly
more modern — in terms of being bindable in other languages, and
well-integrated with API like GApplication.


What is lacking in the current incarnation of commandline option support in
GApplication?

In general, a nicer API that does not rely on
GOptionEntry/GOptionGroup, which are barely introspectable, or that
does not rely on calling g_application_add_main_option() for every
single option in order to avoid the memory management weirdness of
GOptionEntry.

The other issue is that the command line options are accessible using
the GVariant API as a dictionary, which requires additional
translation into application data structures; you need to use
g_variant_dict_lookup(), which is not the nicest API in the world;
high level languages may be able to unpack the GVariantDict, but I'm
not entirely sure if that's actually the case.

Adding command line parsing in JavaScript based on the GLib API (since
JS does not have a "native" module to do that, like Python's
ArgParser) is usually pretty rough; I'd like to see something better
in that area.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]