From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.devel Subject: Re: Declaring Lisp function types Date: Wed, 01 May 2024 16:57:58 -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="18176"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org, stefankangas@gmail.com, adam@alphapapa.net, arthur.miller@live.com To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 01 22:59:30 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 1s2H34-0004WF-F9 for ged-emacs-devel@m.gmane-mx.org; Wed, 01 May 2024 22:59:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2H1k-00024y-VV; Wed, 01 May 2024 16:58:08 -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 1s2H1j-00024T-3s for emacs-devel@gnu.org; Wed, 01 May 2024 16:58:07 -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 1s2H1g-0002zl-Pn; Wed, 01 May 2024 16:58:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=JjlrS5lOq0dTfFXxi6ipTHhD/1rEZEG+EB/htPfG+k8=; b=sG/04slthmyvUhQBphTk gr2KwbIEXh0agS66F9AD3BUwuS6ZqugjPn2PPSTdUpkOotgEEUYBp8MNkOBUw5KVmzkJrs0WhGppy 7eDFh2qsNcnYKzdiS8wA/w61U+3OowVc+PRjcOLg/OtOWOMaj8hyhauzYI7kwfQEdhdvQ0XW8aasb 5GwZlJrAtx5aYQfy4pPOKbupnJ1fpH/hBCAlUMb5WA4p88UuTyg+9gH8MDSzWrYAtH7mKaaBT97GY u17PB2C0Tek2DY1+WLr/jGDFPv3aTwbg7pSPyrcqJHdWJaQZIlx5ewtjlW28OHjrbnM8SEUzETGdT FHv5wYCBcFk3zw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1s2H1a-0002mv-P7; Wed, 01 May 2024 16:58:00 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 30 Apr 2024 14:29:53 -0400") 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:318518 Archived-At: Stefan Monnier writes: >> @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. Thanks, I think it should be more clear now. I don't think we want to be over specific there as what the implementation does when the 'promise' of the declaration is not respected might change in the future. Andrea