From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alptekin SANLI Newsgroups: gmane.lisp.guile.user Subject: G-Golf - with custom parameter type Date: Fri, 17 Nov 2023 19:44:17 +0300 Message-ID: <253f3e43-59a6-4119-9aa6-9fbfcf02366e@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22887"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Nov 17 22:54:50 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r46nZ-0005kl-Uh for guile-user@m.gmane-mx.org; Fri, 17 Nov 2023 22:54:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r46nB-0006j2-0W; Fri, 17 Nov 2023 16:54:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r41xD-0008Uj-U1 for guile-user@gnu.org; Fri, 17 Nov 2023 11:44:30 -0500 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r41xA-0004ef-T2 for guile-user@gnu.org; Fri, 17 Nov 2023 11:44:26 -0500 Original-Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4083dbc43cfso16320705e9.3 for ; Fri, 17 Nov 2023 08:44:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700239459; x=1700844259; darn=gnu.org; h=content-transfer-encoding:subject:from:content-language:to :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ZSdFtBiP9xyaFxpwBAAEZ88BF2ohzZp7l8rsj4b/8J8=; b=mPyLFpEHByyD8Z1RRWktijXGNG08aTbSM/HS8U5aCSMLtrNw/uRHZqKOJk7/8KkQMl 1HY1UIip73ABHfH+eN/Qf0coE960PNWvQxxxJuduZkx3yk+0lTzY7SrRzcGGGhoVJ3IQ r1VNc6jOjAWJ6TrlDhTot+yobflX1fsto3NugctsjCUjcK4tS/HtAOwcY2ITGqg5iqRC JNp6MMmRkkECN36tvntybP/iAEdjFQI723mmhv52ZNMI4FQJ+jnElcpnk7WYOe2Z0u3C N7ijySwJDclHDps6vJWVxiQjPpiBbWlcbd1+JRYumX6CgjHDJaqdLHcPK19Q+IIrFgi7 SA9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700239459; x=1700844259; h=content-transfer-encoding:subject:from:content-language:to :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZSdFtBiP9xyaFxpwBAAEZ88BF2ohzZp7l8rsj4b/8J8=; b=j/g3wDZsHGcnbbJLpfuRU8RGYwwfJ8o7B5EkOL1c9Po3yWuk4cPiCcyV9RI08M0kkl 4VKu5U7PbVZecd8J2yxv5iu/QWrF/cYq/bYAKu35ez2tMbngz9P2ovN91VAWFr3EbN/k atU+rV2PXk4J7t0SinX3EfugwYN1fXv98cbRJ+WTHVZD+EJaJC9nnRj5/7f721lS0s6W O94IVoPOTXqDswn7yhCv9j1bfzRkz/YbhobjRGzj9Kwvi56H6Nf8ANACt8QRowQ8ZBIg ySY8LkwRUbXofNf6OK4X8O8h3GJVLSsPG5nzvy73HQ1HtzNh8eIpQ862hVz+bg1quKg4 SitQ== X-Gm-Message-State: AOJu0YySEEaVotd9bSnnBIS0/juhRRSA5AipmVXSalD3/8c5wQm2yj5s s8m1kwKEDa0ywD8bGG9Fy45HTeybKgo= X-Google-Smtp-Source: AGHT+IGc7odippFTJyMaz90qVwXd1Bfxmis/5L2GLeKLoXdpdA48QQyS68UO0OsAp1Q27SY0yXbtUQ== X-Received: by 2002:a05:600c:154a:b0:401:bdd7:49ae with SMTP id f10-20020a05600c154a00b00401bdd749aemr16735620wmg.18.1700239459108; Fri, 17 Nov 2023 08:44:19 -0800 (PST) Original-Received: from [192.168.255.82] ([85.103.25.145]) by smtp.gmail.com with ESMTPSA id bg6-20020a05600c3c8600b004090ca6d785sm3436193wmb.2.2023.11.17.08.44.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Nov 2023 08:44:18 -0800 (PST) Content-Language: en-US, fr, de-DE, tr Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alptekinsanli@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 17 Nov 2023 16:54:23 -0500 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19309 Archived-At: I'd like to ask a question regarding composite parameter types in . I'm trying to port my simple pygobject/gtk4 app into g-golf; & it's been going pretty well; however, I've hit a roadblock. In the python version, I define several `Gio.SimpleAction`s to attach to my `Gtk.Application` with explicitly specified GVariantTypes, so that I can activate them with arguments over D-Bus. The following works just fine, allowing me to activate this action over the CLI via gdbus: ``` python class OwnGtkApplication(Gtk.Application):     def __init__(self, **kwargs):         ## etc.         new_simple_action = Gio.SimpleAction.new(             "the_name", GLib.VariantType.new("(uus)")             )         self.add_action(new_simple_action)         ## etc.     ## later on     def do_activate(self):         ## etc.         self.lookup_action("new_simple_action").connect(             "activate", self.the_callback)         ## etc.     ## later on     def the_callback(self, the_obj, the_param):         one_uint32 = the_param.get_child_value(0).get_uint32()         one_more = the_param.get_child_value(1).get_uint32()         a_string = the_param.get_child_value(2).get_string()         ## -- now use the extracted values ``` Under g-golf, however, I can't define a with parameters. So the following runs: ``` guile (define (activate app)   (let* ;; etc., etc.,     ((a-new-simple (make #:name "the_name")))     (add-action app a-new-simple)     (connect a-new-simple 'activate (lambda (s-action g-variant)       (log-msg 'WARN g-variant)))     ) ) ``` & the log message just prints `#f`; but whenever I try to add the `#:parameter_type` keyword to `(make )`, I get an unbound variable error. `glib-variant-type-new` doesn't seem to exist; and I don't understand what `g-type-param-variant` does -- or whether it's relevant to my case. I've tried: ``` #:parameter-type `(,g-type-param-uint ,g-type-param-uint ,g-type-param-string) ``` But this gives me: ``` In procedure primitive-call-ip: Wrong type argument in position 1 (expecting PRIMITIVE_P): # ERROR: In procedure foreign-call: Wrong type argument in position 1 (expecting POINTER_P): (# # #) ``` ... but then I'm back to square one; because I don't know how to package a '(uus)' type, and return only the pointer to it. I really hope that it's possible to do what I'm trying to do under Guile, because I've really been enjoying my learning experience so far. Thanks, Alptekin Sanlı