From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: William ML Leslie Newsgroups: gmane.lisp.guile.devel Subject: Re: call with value Date: Mon, 13 Apr 2020 12:34:51 +1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="61746"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Apr 13 04:35:20 2020 Return-path: Envelope-to: guile-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 1jNowR-000FxP-F8 for guile-devel@m.gmane-mx.org; Mon, 13 Apr 2020 04:35:19 +0200 Original-Received: from localhost ([::1]:39658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNowP-0000tw-Nb for guile-devel@m.gmane-mx.org; Sun, 12 Apr 2020 22:35:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43093) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNowD-0000ti-CD for guile-devel@gnu.org; Sun, 12 Apr 2020 22:35:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNowC-0000CC-CM for guile-devel@gnu.org; Sun, 12 Apr 2020 22:35:05 -0400 Original-Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:41960) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNowC-0000Be-68 for guile-devel@gnu.org; Sun, 12 Apr 2020 22:35:04 -0400 Original-Received: by mail-il1-x131.google.com with SMTP id f82so3961625ilh.8 for ; Sun, 12 Apr 2020 19:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F7t9ivsVc6M39bSUHGwY8MS//nLyfKzbNnkhMGopVzI=; b=nkrGRImlBMnDCkiCzxVxbDqamQ6xAlDdL4qhQhoKKHZrto0549FoxKXdfm7SI4tEo1 G9vpBJdQ8Fr4SGETFW/vZyCvu/TXnVEG0bQXFAjnRsT9PHhzDmHKiJaGgwIBZBd+bgzD jYUBbwArSFIO3uP/LPP6OJHVQByJTiL1HNFjn8sM8FIuFyo+2IPU5JTI7+PcZjXik0rd t/TZnJykzZgtYgfZS2iR+sv1CrXh6B8ER9aD7iGNT+PdSd0K5jLcg+N8x+HsUFVhhTtf tt2ab5+zAYw0njT2DCJTD4diioz0qUzI+2Pt+MJrTOndLUJPElY0dyLb7JgPqQXSuTrl 8ZTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F7t9ivsVc6M39bSUHGwY8MS//nLyfKzbNnkhMGopVzI=; b=DgoZoNqwUnpWoIL5oJ4zML67cwYhJ9TehE6WaxuPas7JUtdNKCZt3WFeTuslVaJhNf bNXje/lGLS3b7GKP++x3IuW77TX/EcwGRrzNx3w2omz1Ua8qKTS+aK243EQPrJEZbUzN 1Fk4hof1ngjXP+5lU0cENY2pw6qByWezbWYB/uHrH6eyuZZP3XVjr3B2sY5qdS4GPXgQ 5fmNsieS/kX17V1ussr1eUIfQa1FSHSw1yfasRf13be9YZONzDBLSBmGr+5kRoRl/mfY t4uIubB4PwmFDd0ZMlIVXgsSw9/8Rdgr+9TB/T7v3ITmiU9PoZrQE5EVBnbow/4fISYK Qq1A== X-Gm-Message-State: AGi0Pua5CovOPP0wX4fm1nmun8PnARLfxrJm701Ho7ew9s+FjNYRaUq5 RYhLWvtx00lwL5ZMnLQ3ABEtAlAk502eCafnCFk= X-Google-Smtp-Source: APiQypIBUN9wdtUQb45Xlq4XEP1VmGPYbE0L0Ha0dzXLGds8ToQWhxmB478HKxbg88Y0dpy40gSBGPMOU7Id70Y55aQ= X-Received: by 2002:a05:6e02:672:: with SMTP id l18mr3572504ilt.237.1586745303051; Sun, 12 Apr 2020 19:35:03 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::131 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20488 Archived-At: On Mon, 13 Apr 2020 at 02:59, Stefan Israelsson Tampe wrote: > > I have this (on guile 3.0.0), > > (define (f x) (call-with-values (lambda () x) (case-lambda ((x) ...) (x ...))))) > > and the code does not simplify to (define (f x) x), why? > > It would be great to have guile optimize this as in python we have > > x=1,0 > => x=(1,0) > > And the great thing with python on guile is that we get the same behavior with (values 1 0) as a r.h.s. so that we get good interoperability between guile and python. > Hi Stis, I'm not sure if I mentioned this to you earlier, but I'm worried that this won't be a great user experience. When a python function returns a tuple, whether "implicitly" as part of the return statement or not, the invoker still gets one tuple, and is free to unpack it. If I were to call a function that returned a 1-value tuple and instead it got unpacked for me, I would be very confused. Similarly, if a python function `f` returns a tuple and I invoke `g(f(x))`, I expect g to receive one tuple; not a number of arguments. I'd have to say `g(*f(x))` if I wanted it to receive the items as argument values. -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement.