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: (declare (type (function... Date: Tue, 07 May 2024 16:32:10 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17882"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Marco Antoniotti Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 07 22:33:21 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 1s4RV2-0004QC-VA for ged-emacs-devel@m.gmane-mx.org; Tue, 07 May 2024 22:33:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4RUM-0004eC-Gy; Tue, 07 May 2024 16:32:38 -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 1s4RUJ-0004dG-Uw for emacs-devel@gnu.org; Tue, 07 May 2024 16:32:36 -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 1s4RUJ-0005N4-7o; Tue, 07 May 2024 16:32:35 -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=7iQ3yO4FHwonpOxqaKxA9H7Q39TNMPrbtQlH8pXyDE0=; b=Bv6UD3m1ppJ18tQTp8pD iEO8jgKX/w5X09VK7F/3LzRYkLRQCy8gT0n4z3jdK9u9W5Ok9cGKzGmouF5pQx8EQEZAdTi11hUEX Md9pIqKtzU/FyPQtwP8UexVd4nIvklS8omfvA0gVX1rIuJ1fW4quYyV2tu0laD/dZ+0PNZ0h1TKHf 2dEvlqLKMITZVRnf6/GTYWY+LU7vs2S9W0VbookruIAyq6SsFsMVJJly6VWotLYaQfKMTeEvOP9oP rwVmCgGeO3Zq87xNBv3xZlPeytLeWG5z1XT8k41OmZKzoOkGbbTyg+DqYn49Ab3/j7vcdtAnVf331 sLaF0l4sBDTtCg==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1s4RTu-00021h-LF; Tue, 07 May 2024 16:32:34 -0400 In-Reply-To: (Marco Antoniotti's message of "Tue, 7 May 2024 13:55:06 +0200") 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:318973 Archived-At: Marco Antoniotti writes: > Hi > > I am at ELS 2024 in Vienna and I saw Andrea Corallo's presentation about the introduction of the > > (defun foo (x) > (declare (type (function (integer) float)) > (+ x 42.0)) > > declaration. > > IMHO (and, I am not afraid to say, of many common lispers) this is shortsighted and a rather gratuitous departure from > what CL does. With some potential unintended consequences down the road. > > The declaration proposed is for the signature of the function as a whole. Using type may prevent ELisp from introducing > the usual CL idiom, as the following one > > (let ((x 42) (y -1)) > (declare (type integer x y)) ; The type declaration refers to names x and y. > ...) > > ... unless you special case the type declaration with no name(s) following the type spec. > > My suggestion: keep type (and ftype) for doing things the CL way (which was the PL/I way :) ) and introduce a signature > spec to be meaningful only at the function toplevel. > > (defun foo (x) > (declare (signature (function (integer) float)) > (+ x 42.0)) > > All the best Ciao Marco, I've no problem changing 'type' for something different if there's agreement, I don't especially like 'signature' as it's a bit verbose for my taste (but I could leave with it). Thanks Andrea PS the presentation you attended must have been really terribile :)