From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Declaring Lisp function types Date: Tue, 30 Apr 2024 14:29:53 -0400 Message-ID: References: <8634sdjgoj.fsf@gnu.org> <86mspaq4ro.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="11120"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Andrea Corallo , emacs-devel@gnu.org, stefankangas@gmail.com, adam@alphapapa.net, arthur.miller@live.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 30 20:30:23 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 1s1sFC-0002cH-5n for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Apr 2024 20:30:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1sEu-0006oi-9k; Tue, 30 Apr 2024 14:30:04 -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 1s1sEr-0006nl-1h for emacs-devel@gnu.org; Tue, 30 Apr 2024 14:30:01 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1sEj-0002Oh-U7; Tue, 30 Apr 2024 14:29:59 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1D5D21000AD; Tue, 30 Apr 2024 14:29:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1714501789; bh=m52TIqaNpdm09vEDSlG6dLP3fpTywukCTEc9GdfgWEA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=W4uuO8bZ/6igdSancwgSm91xSOfG3xBHXN/OEQo2xrC7Hefcc5NcE1+J0mMiV0SFV 5CX/yHkebo6yfq91OMS5EInOom4TXmsPq+2xqgJwepaHK3Wq0p9VStc5jAwuRk+eLi kZT9DYkHmhS9XlS79zml9ZfihX5v/eP+vFuER8GybgKgaFW66LvefdG3nzT5vvUAKq 1M9myHupZElApeQjV44jKqWwyXcxtEn2Lg+To/PFAiYfmNkF9h2sh+BbUMjGJwKVG4 J0+/cvURnKuXTITN5UzNt/Py5KEV+HLpfEeulxY+v8yDpGsKC1TtM4rfs55d7Hy0zD YNpV/wMes9A6Q== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ACCAF10005D; Tue, 30 Apr 2024 14:29:49 -0400 (EDT) Original-Received: from alfajor (unknown [23.233.234.148]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7DEFE1201DD; Tue, 30 Apr 2024 14:29:49 -0400 (EDT) In-Reply-To: <86mspaq4ro.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Apr 2024 17:55:23 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:318441 Archived-At: > @item (type @var{type}) > Declare @var{type} to be the type of this function. This is used for > documentation by @code{describe-function}. Also it can be used by the > native compiler (@pxref{Native-Compilation}) for improving code > generation and for deriving more precisely the type of other functions > without type declaration. > > Without any discussion of what can be @var{type} and no examples, this > is too abstract. I learned more about it from the other parts of the > changeset, where you actually use this. So please say something about > what can be @var{type}, and add one or two examples. Thanks Eli for reminding me: as mentioned earlier, I think we should clarify what are the possible consequences if a type does not faithfully reflect the behavior of the function. Examples of questions that one should be able to answer based on the doc: - Can an incorrect type affect Emacs' behavior (other than performance)? - And if so, can it cause a crash? - What if the type is/was right but an advice does not obey the original type of the advised function? The doc doesn't need to answer those questions directly, but it should describe the possible effects of type annotations in enough details that we can answer those questions. Stefan