From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Martyanoff Newsgroups: gmane.emacs.devel Subject: Re: as for Calc and the math library Date: Tue, 13 Aug 2024 15:48:08 +0200 Message-ID: <87plqcfs9z.fsf@valhala.localdomain> References: <864j7qhup6.fsf@gnu.org> <87a5hi0yts.fsf@valhala.localdomain> <86y152ge0b.fsf@gnu.org> <875xs60wmc.fsf@valhala.localdomain> <86wmklho4m.fsf@gnu.org> <86bk1whb9v.fsf@gnu.org> <87ttfofu0r.fsf@valhala.localdomain> <864j7oh7nf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27317"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Nicolas Martyanoff , arthur.miller@live.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 13 15:49:02 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sdrtW-0006vu-Kx for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Aug 2024 15:49:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdrsp-0001RA-4A; Tue, 13 Aug 2024 09:48:19 -0400 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 1sdrsn-0001Qy-Lc for emacs-devel@gnu.org; Tue, 13 Aug 2024 09:48:17 -0400 Original-Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sdrsl-0006lc-F7 for emacs-devel@gnu.org; Tue, 13 Aug 2024 09:48:17 -0400 Original-Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-368584f9e36so2706224f8f.2 for ; Tue, 13 Aug 2024 06:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=n16f-net.20230601.gappssmtp.com; s=20230601; t=1723556889; x=1724161689; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=HMN86oREbdi5RZWBT4f6iFPDlr3eYB783eilXPoLU2w=; b=1M9h5fHHfDAELM/E9z/IQudTrXuDfDh9jsJk9bJ8w4d2PgViQhWgkpMTTYJJmY6u6B 9MZTlbtGII5imb54BLWK/kRDLQoJBAeSrov0AWogP1Z63okE9nbkYCNVVOIiN7CKIyrp diGxKMQc/4wYzUVbnHG+CG1ey6WkM6f7RTjIDI4HhMhoRAsagmSmYo4mXQA9okJ9nMNl +aowvRyi/9U4KUP0Zc4id4ifMzS5kh1fIxd+6Hn+1qugMopzrlsdrCHxWOtOktc/EPcy Wg0CFf9o7wal5V/JoMeKg+GxRuQJSESbuEGOib07/tqfbXBfwbVuHbVLtAHeq+qkUbUa 0Bkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723556889; x=1724161689; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HMN86oREbdi5RZWBT4f6iFPDlr3eYB783eilXPoLU2w=; b=oILHtco9trNK8pM/FKNAEPNd/GQZ9I+6vwRdmj7oS6UA3OIMBnAj76NW1ANxq7gufL 88+3cisjcFSJf+lpQ6Z6EwJ5KJ+zVdxx7Q9mhUwyyCqnkngXpcIF+EniDdSBZHAPOFOI ZmH/P+Byp1wLZRBOqeaS6D2GPgBCCn6IGgU5Wnyzy0BehpJ7hIJLHzMXvlR0vFbrQQjT 4q0tjGFCehuqGjMKoucLfJbcz6nUzmOn6GxAVXAQSEleQiQhs/c9Xlc5t3RHFZPf/lJS mcnm5ofFrOsE/jg0RY/kUFUYYkPOBaLB00Yb+vgNYEMqk98g89iR6LIyOhJnv+9/xTtE Cj+g== X-Forwarded-Encrypted: i=1; AJvYcCV7EPkBBiXuG/msJOJJEE+9RIGf2eZVg7lc0WfOoZerUajm8wT0Zgw6SU32Lwc89OrxtBhOeynvK3+b2Gc/spggfNQD X-Gm-Message-State: AOJu0YzjyugnpJFlu/SSwyPuHflXbKka4Mxg/15mFC/etEHTMIn9DHM6 S8A51Th3BwNJwdk78hVaWIqcXAY83aukJD/WBYD580qO0LPJnu/kRhV1AJDIyxhlJUeRBx+v8Yx FjxY= X-Google-Smtp-Source: AGHT+IHokPjy8wqWaeyJFC+4TaZabIuob+ziasBsdk4D0AktEqxhbk7vpQPclRvqEJ8lqZy9LPsQSQ== X-Received: by 2002:a5d:5cd0:0:b0:367:96d6:4c2d with SMTP id ffacd0b85a97d-3716ccf0c36mr2130920f8f.25.1723556889284; Tue, 13 Aug 2024 06:48:09 -0700 (PDT) Original-Received: from valhala (2a01cb040ef2780082125b1239177798.ipv6.abo.wanadoo.fr. [2a01:cb04:ef2:7800:8212:5b12:3917:7798]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c36be6dsm10390223f8f.20.2024.08.13.06.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:48:08 -0700 (PDT) In-Reply-To: <864j7oh7nf.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 13 Aug 2024 16:30:44 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=nicolas@n16f.net; helo=mail-wr1-x42a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322709 Archived-At: Eli Zaretskii writes: >> From: Nicolas Martyanoff >> Cc: arthur miller , nicolas@n16f.net, >> emacs-devel@gnu.org >> Date: Tue, 13 Aug 2024 15:10:28 +0200 >> >> Eli Zaretskii writes: >> >> > AFAIU, there should be no reasons not to be able to load MIT licensed >> > libraries via the emacs-module machinery. >> >> IIRC the reason I abandoned was that you can load a dynamic module but >> there is no mechanism to reload it once modified, meaning one cannot >> develop packages with dynamic modules iteratively. > > This is a technical problem with loading shared libraries, so it will > also happen with FFI, AFAIU. > > In general, unloading and reloading doesn't work in Emacs well even in > Lisp, less so with native-compiled Lisp. Not sure this can be > improved and how, but it would be a welcome addition and enhancement. The main difference is that with a dynamic module, if you want to add a new C function available in elisp or modify an existing one, you have to update the C glue code defining the function and restart Emacs to build and reload it. With the kind of FFI API we are talking about, once the foreign library has been loaded (e.g. libpq), one can write Elisp functions calling foreign functions incrementally. This is not the end of the world if you are just binding a couple functions and you know everything you need. When you are binding a large and complex library, being able to go at it incrementally and testing everything in Emacs at each step makes it much comfortable. Ultimately all of this is moot since the political aspect takes precedence. But thinking about it, it should be possible to build a dynamic module exposing a couple functions whose job would be to open arbitrary shared libraries and call functions with libffi (which is MIT licensed so no license violation here). Some Emacs code could be used to extract constant values, structure layouts and other information necessary at runtime, but it is not that hard (see cffi-grovel in Common Lisp for example). -- Nicolas Martyanoff https://n16f.net nicolas@n16f.net