From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: Default lexical-binding to t Date: Wed, 6 Nov 2024 09:54:06 -0800 Message-ID: References: <86ttcnuppm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17975"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, emacs-devel@gnu.org To: Stefan Monnier , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 06 18:55:13 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 1t8kFJ-0004YX-93 for ged-emacs-devel@m.gmane-mx.org; Wed, 06 Nov 2024 18:55:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8kEQ-0004a4-Rs; Wed, 06 Nov 2024 12:54:14 -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 1t8kEO-0004Zq-3w for emacs-devel@gnu.org; Wed, 06 Nov 2024 12:54:12 -0500 Original-Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8kEM-0002j1-KF; Wed, 06 Nov 2024 12:54:11 -0500 Original-Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-71e4244fdc6so7487b3a.0; Wed, 06 Nov 2024 09:54:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730915648; x=1731520448; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=x5GU1S3y3RCX6rRFrzfCCg9b3aGLt/w+gJFHLXNaRI0=; b=LNfNDXUfXEiXjOD+0iyCdyHAwy61XIEO33b6XSOaHBMdt/OCe/UmRqZpZnE/394en+ jU6y9+nKCq8LvQ1HX508Fdf12qWmpG12hvFZcaucJ2/xaboMR7tl7JDJVkti9SUdeQh/ bTRuER+x64AnuW4V+sdjH6iZHWNxLfNl1AV8RNm2i2oAmAFpE3xUiuC1ShSNLSnHsIY8 EkowuSM4B/dn7VS+wWdfpnApGSduscwObSIMYzYBLLeDKt7j2iPuWLMyDR1DBDXpYMPD jHZbc9kL45GYQvVDMNKAdQfNgp/37w0d7El03+fRm+U0STdyDgYMbDbYUvDSTrsopBT1 EcPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730915648; x=1731520448; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=x5GU1S3y3RCX6rRFrzfCCg9b3aGLt/w+gJFHLXNaRI0=; b=IL1K1ukS1UbR1WAhXpNbJwagjHVwMjh6uj/NZKsEaXzEG//8u7od791tQ2/0A6OHjn bMLEVsuTWDAWlFvW0im0XT8jHG2meemEI/cQgCnni+HBSUQsbOjNWuPDcd4x8sbgcNXL J7sOMguJPxo+iXVj7iy3v9NpRRycoxGpvUG5NzTHHloQFaaUVqBAFYWWXG0urtHIzqke MXH/IT6F/783wBjhGXthoaHdKL7QV892YjrnMX9d1dX1OWkPPF3cQDvJOSC4zfjjsHFr 3/RQZw6FmmAQi84Sg0xspKrYyWXLna0McB7fxT88JoNiDxgWLI9lkjjEahkAd5jZ1e9x aqrA== X-Forwarded-Encrypted: i=1; AJvYcCUkLXHqH0V78jDbUjcTi/GOmD+foD1UzrXXrwVg/nIgJfBUvpQk8ilrIbc3nwAV3Xc1Iusk@gnu.org, AJvYcCWRD7M5G5aBseRulqzVYlrgBTCRXnaxL9TuuNcY4Sp02TwP/qqpGqQ6u3z1Ur608rv+yJHE4lPbFH1kfVo=@gnu.org X-Gm-Message-State: AOJu0YxgHgcfauzltMAUzbvOpLFTjxOMixRBYmDQMwDRoMMzk4wrGods CQoZfHixoWDYXpaxhaadcOc1U2hdz77IvUyabg3A9y94tlimC5JihxlSdQ== X-Google-Smtp-Source: AGHT+IFZvSFUHlgT+aqLu6exe+nHlwhA3E0WwZme/ncn175NUCAB5lOGiqIrpBz/P4ekpeFRMt4dIw== X-Received: by 2002:a05:6a00:17a2:b0:71e:2a0:b0b8 with SMTP id d2e1a72fcca58-720c98a3b34mr27231202b3a.1.1730915648090; Wed, 06 Nov 2024 09:54:08 -0800 (PST) Original-Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-720bc1b8cb9sm12396501b3a.11.2024.11.06.09.54.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Nov 2024 09:54:07 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=jporterbugs@gmail.com; helo=mail-pf1-x42b.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 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:325185 Archived-At: On 11/5/2024 12:24 PM, Stefan Monnier wrote: >> What bothers me is how do I know whether a given Lisp file of mine >> will have problems under lexical-binding. Do we have any tools which >> will help me determine that? > > It's generally impossible to do that reliably (it can be reduced to > a variant of the halting problem), but the problem is exactly the same > as that of converting from dynbind to lexbind (which we do describe in > the manual). How about a less-reliable tool that catches some easy-to-detect problems? For example, look in every defun and see if the macro-expanded form of the function body refers to a variable that is neither 1) declared with 'defvar' or 2) let-bound in that function. This logic might not be exactly what we want since I haven't thought very long about it, but something along these lines could hopefully catch many errors. Even if we can't catch 100% of issues, catching 80% of them would make users' lives easier.