From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70368: [PATCH] Use a dedicated type to represent interpreted-function values Date: Thu, 18 Apr 2024 19:49:36 +0300 Message-ID: <86mspqd3a7.fsf@gnu.org> References: <86il0ko6f9.fsf@gnu.org> <86h6g4m29n.fsf@gnu.org> <86sezmlvht.fsf@gnu.org> <86cyqqlqkw.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24872"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70368@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 18 18:50:23 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rxUxr-0006HW-8I for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Apr 2024 18:50:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxUxS-000834-JU; Thu, 18 Apr 2024 12:49:58 -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 1rxUxR-00082g-6s for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 12:49:57 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxUxQ-00056H-VL for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 12:49:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rxUxe-0000e3-9d for bug-gnu-emacs@gnu.org; Thu, 18 Apr 2024 12:50:10 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Apr 2024 16:50:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70368 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70368-submit@debbugs.gnu.org id=B70368.17134590062408 (code B ref 70368); Thu, 18 Apr 2024 16:50:09 +0000 Original-Received: (at 70368) by debbugs.gnu.org; 18 Apr 2024 16:50:06 +0000 Original-Received: from localhost ([127.0.0.1]:53450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxUxW-0000cH-CX for submit@debbugs.gnu.org; Thu, 18 Apr 2024 12:50:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rxUxT-0000bD-Kc for 70368@debbugs.gnu.org; Thu, 18 Apr 2024 12:50:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxUxA-00053y-4I; Thu, 18 Apr 2024 12:49:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7TJVj0vXd0D7j2NnYMislfl+6XPcC4InEJ7lbYAUE/I=; b=Smh+j6r/SA1A K49+pxiikPrRDgf7vMWy3b22YDOrmzivEfoQZtkZyPR9+3TguCpAGubGWEQKrjaUR03yciMMe/VJo gmshgIroIj8q4uL1tgIM45y63eTt/nSN0caOKY/4QBMZyCql2ZlcHctjUqYaTf/lrHjiG4OR7C/Mq mIwAZ5IlWjmCLPGgKEOhXwUh8DgygFUsSkWF1uvBKKUWQ8DrlJ5lXMwbtVcWI+SqtcvQdtLAyF4Ts yA6kTFg9dGMquOAN2KTNKw9iWQtvIbavyN/+YWhzKb8jUXLpurY93//sTRyBEqSy3tIbwOFrx/13n ybDUUuPJAu7DAw0L0/iLJA==; In-Reply-To: (message from Stefan Monnier on Thu, 18 Apr 2024 12:36:36 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283591 Archived-At: > From: Stefan Monnier > Cc: 70368@debbugs.gnu.org > Date: Thu, 18 Apr 2024 12:36:36 -0400 > > OK, I've updated my patch according to your suggestions, see the result > below (and in the `scratch/interpreted-function` branch). > Any further comment/objection? Just a few minor nits, really. > >From 7842af6095db4384898725fb4a14ebaa11379a34 Mon Sep 17 00:00:00 2001 > From: Stefan Monnier > Date: Sun, 24 Mar 2024 18:32:25 -0400 > Subject: [PATCH 1/2] (COMPILED): Rename to CLOSURE > > In preparation for the use of `PVEC_COMPILED` objects for > interpreted functions, rename them to use a more neutral name. > > * src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`. > (enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`. > Also use `CODE` rather than `BYTECODE`. > (CLOSUREP): Rename from `COMPILEDP`. > (enum Lisp_Closure): Rename from `Lisp_Compiled`. > > * src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c, > * src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c, > * src/profiler.c: Rename all uses accordingly. > * src/.gdbinit (xclosure): Rename from `xcompiled`. > (xcompiled): New obsolete alias. > (xpr): Adjust accordingly. Also adjust to new PVEC_CLOSURE tag name. You are still quoting `like this`. > +Thus code that attempts to "dig" into the internal structure of an > +interpreted function's object with the likes of 'car' or 'cdr' will > +no longer work and will need to use 'aref' used instead to extract its ^^^^ That "used" should be removed. > +DEFUN ("closurep", Fclosurep, Sclosurep, > + 1, 1, 0, > + doc: /* Return t if OBJECT is a function of type `closure'. */) > + (Lisp_Object object) > +{ > + if (CLOSUREP (object)) > + return Qt; > + return Qnil; > +} This new function should be in NEWS. > +DEFUN ("interpreted-function-p", Finterpreted_function_p, > + Sinterpreted_function_p, 1, 1, 0, > + doc: /* Return t if OBJECT is a function of type `interpreted-function'. */) > + (Lisp_Object object) Likewise. > +DEFUN ("make-interpreted-closure", Fmake_interpreted_closure, > + Smake_interpreted_closure, 3, 5, 0, > + doc: /* Make an interpreted closure. > +ARGS should be the list of formal arguments. > +BODY should be a non-empty list of forms. > +ENV should be a lexical environment, like the second argument of `eval'. > +IFORM if non-nil should be of the form (interactive ...). */) > + (Lisp_Object args, Lisp_Object body, Lisp_Object env, > + Lisp_Object docstring, Lisp_Object iform) Likewise. Thanks.