Skip Menu |
 

This queue is for tickets about the future CPAN distribution.

Report information
The Basics
Id: 131094
Status: resolved
Priority: 0/
Queue: future

People
Owner: Nobody in particular
Requestors: felipe [...] felipegasper.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.45



MIME-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
X-From-Rewrite: unmodified, already matched
X-Outgoing-Spam-Status: No, score=-1.0
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -2.805
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id E5F3324032F for <cpan-bug+future [...] hipster.bestpractical.com>; Wed, 27 Nov 2019 06:28:36 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qG8GPiC-QlOD for <cpan-bug+future [...] hipster.bestpractical.com>; Wed, 27 Nov 2019 06:28:35 -0500 (EST)
Received: from xx1.develooper.com (unknown [147.75.38.233]) by hipster.bestpractical.com (Postfix) with ESMTPS id 80F24240288 for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 06:28:35 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 1B9F6CF28A for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 03:28:35 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 4B0D0CF28B for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 03:28:33 -0800 (PST)
Received: from web1.siteocity.com (web1.siteocity.com [67.227.147.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 6EA98CF28A for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 03:28:24 -0800 (PST)
Received: from [149.248.87.40] (port=55520 helo=felipes-mbp.lan) by web1.siteocity.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from <felipe [...] felipegasper.com>) id 1iZunW-00D4An-IB for bug-future [...] rt.cpan.org; Wed, 27 Nov 2019 04:43:51 -0600
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] felipegasper.com
Delivered-To: cpan-bug+future [...] hipster.bestpractical.com
Subject: then() seems incorrectly documented
Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=felipegasper.com; s=default; h=To:Date:Message-Id:Subject:Mime-Version: Content-Transfer-Encoding:Content-Type:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A4HCKO0fV1H43WtfN0IUivch2lna5LdBK6VcUXFm88c=; b=Xbg6j7e4JbkP6VoLJWe2O0HipY l7N3GPteSqurIDlcHLsKATPh7suabSnfJdvZ7OL5jWt+GiBz2BiKze8y6ZLvR1XTSgxAAx+6z2dWU Esdvz4rcr4TZ9nk0BGe8QCDHjvk5pckGkwlK1hDrpJBHisJWi8wv58izToSbOA1xHU+p1004lspFq wnS0cWYX+EKRKAK99a2B+wJ9hydmxZY8BgAtXA5ufWL/9p2opSJOWi0NXMtoW5I1lU3LgufUj/m77 tJuCLX5pv1J3equJw1SFgyClxHw2lvhATY1y6snugplofDydERxpa9+wHFJgY6xcZKUWi1cXh0ie4 bSqXmIzw==;
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, SUPERLONG_LINE 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1300_1399 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_ALIGNS 0, DKIM_SIGNATURE 0, KNOWN_MSGID 0, KNOWN_MTA_TFX 0, NO_CTA_FOUND 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, SPF_PASS 0, SXL_IP_TFX_WM 0, __BODY_NO_MAILTO 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DKIM_ALIGNS_1 0, __DKIM_ALIGNS_2 0, __FRAUD_ANTIABUSE 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MSGID_APPLEMAIL 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
Date: Wed, 27 Nov 2019 05:43:50 -0500
X-Authenticated-Sender: web1.siteocity.com: felipe [...] felipegasper.com
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2019.11.27.111816
X-Get-Message-Sender-Via: web1.siteocity.com: authenticated_id: fgasper/from_h
To: bug-future [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
X-Source:
X-Spam-Status: No, score=-2.805 tagged_above=-99.9 required=10 tests=[AWL=-1.598, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RDNS_NONE=0.793] autolearn=no
X-Source-Args:
X-Mailer: Apple Mail (2.3445.104.11)
X-Source-Dir:
Message-ID: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com>
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - web1.siteocity.com
X-Antiabuse: Original Domain - rt.cpan.org
X-Antiabuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse: Sender Address Domain - felipegasper.com
Return-Path: <felipe [...] felipegasper.com>
X-Original-To: cpan-bug+future [...] hipster.bestpractical.com
X-RT-Mail-Extension: future
X-Greylist: delayed 2672 seconds by postgrey-1.34 at xx1.develooper.com; Wed, 27 Nov 2019 03:28:24 PST
From: Felipe Gasper <felipe [...] felipegasper.com>
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 1189
Download (untitled) / with headers
text/plain 1.1k
Currently the POD says: ----- then (2 arguments) $future = $f1->then( \&done_code, \&fail_code ) The then method can also be passed the $fail_code block as well, giving a combination of then and else behaviour. This operation is designed to be compatible with the semantics of other future systems, such as Javascript's Q or Promises/A libraries. ----- … yet this isn’t how then() works, as a quick example shows: ----- perl -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123 } )->then( sub { print 456 } )' 123 ----- It should print “123456”, but instead it only prints “123”. A quick comparison with node.js’s implementation: ----- Show quoted text
> Promise.resolve(123).then( () => console.log(123) ).then( () => console.log(234) );
Promise { <pending> } Show quoted text
> 123
234 ----- If Future::then() is described as “compatible” with Promise/A, I would think it would obey the same semantics and immediately resolve the returned Future. Given, though, that Future is already widely used, I assume that its current functionality is as intended; hence, the documentation should indicate what Future::then() does differently from then() on promises. Thank you! -FG
MIME-Version: 1.0
In-Reply-To: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-29816-1574860272-9.131094-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 691
Download (untitled) / with headers
text/plain 691b
On Wed Nov 27 06:28:37 2019, felipe@felipegasper.com wrote: Show quoted text
> perl -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { > print 123 } )->then( sub { print 456 } )' > 123
Oh this is awkward. That's supposed to print an error that the first `then` block didn't return a Future. Instead nothing happened - the error has gone missing :( In any case, as every chaining code block is supposed to yield a Future, your example didn't do that so it doesn't run properly. Instead: $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123; Future->done } )->then( sub { print 456 } )' 123456 I'll investigate why the error went missing -- Paul Evans
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-29816-1574860272-9.131094-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com> <rt-4.0.18-29816-1574860272-9.131094-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-30386-1574860440-1139.131094-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1171
Download (untitled) / with headers
text/plain 1.1k
On Wed Nov 27 08:11:12 2019, PEVANS wrote: Show quoted text
> On Wed Nov 27 06:28:37 2019, felipe@felipegasper.com wrote:
> > perl -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { > > print 123 } )->then( sub { print 456 } )' > > 123
> > Oh this is awkward. That's supposed to print an error that the first > `then` block didn't return a Future. Instead nothing happened - the > error has gone missing :(
Ohright; it's not thrown as an inline error, but instead becomes the failure state of the returned Future. Since you just discarded that, it doesn't appear. Try ->get'ing it: $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123 } )->then( sub { print 456 } )->get' Expected __ANON__(-e line 1) to return a Future at -e line 1. 123 $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123; Future->done } )->then( sub { print 456 } )->get' Expected __ANON__(-e line 1) to return a Future at -e line 1. 123456 $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123; Future->done } )->then( sub { print 456; Future->done } )->get' 123456 -- Paul Evans
MIME-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Outgoing-Spam-Status: No, score=-1.0
X-From-Rewrite: unmodified, already matched
X-Spam-Flag: NO
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -4.405
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] felipegasper.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 784B524032A for <cpan-bug+future [...] hipster.bestpractical.com>; Wed, 27 Nov 2019 08:49:15 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Iho4iwZjyVn1 for <cpan-bug+future [...] hipster.bestpractical.com>; Wed, 27 Nov 2019 08:49:13 -0500 (EST)
Received: from xx1.develooper.com (unknown [147.75.38.233]) by hipster.bestpractical.com (Postfix) with ESMTPS id A2F3E2401B1 for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 08:49:13 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 34B13CF28A for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 05:49:13 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id C1B8CCF28B for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 05:49:07 -0800 (PST)
Received: from web1.siteocity.com (web1.siteocity.com [67.227.147.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 4EA7ACF28A for <bug-future [...] rt.cpan.org>; Wed, 27 Nov 2019 05:49:07 -0800 (PST)
Received: from [149.248.87.40] (port=56655 helo=felipes-mbp.lan) by web1.siteocity.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from <felipe [...] felipegasper.com>) id 1iZxgn-00DdGg-11 for bug-future [...] rt.cpan.org; Wed, 27 Nov 2019 07:49:05 -0600
Delivered-To: cpan-bug+future [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #131094] then() seems incorrectly documented
Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=felipegasper.com; s=default; h=Message-Id:In-Reply-To:To:References:Date: Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0m9DqpdGjY3vf+COuUrUfenBs+LHNGKE9aDH79mqNhE=; b=B1wVc0h20emQ92g9YnDZqLOrqV 5xIqAA6Duvt4HbXxtU7IglH2CoJDGDoDi8/ckwS1oD6y5hAHL3smP6LOAkjpuF5RSzSiWZ5SVOUo7 sETSsf4m7UlggxnmSL6XZewU6XrVORs0GLD3MKPsluK2hvKEJbR57qQ3gWfzEQM/CXopBAYsJbFnb YxPaWDXiry9oX6kcewYKmTVwzsHrJhBQmzai3nYWoochxAWvVtP5NtqRxvYNnU2/r3dpryW8ypWZt GoK309UxvVrlSv0aibQVbdlREiHKykBLGA26UFCHPHtoC2MRcXsgJ7EDgNNWbdKXk8Bmb9SkTuEYt /+6Z6KHQ==;
Date: Wed, 27 Nov 2019 08:49:04 -0500
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, SUPERLONG_LINE 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1400_1499 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_ALIGNS 0, DKIM_SIGNATURE 0, IN_REP_TO 0, KNOWN_MSGID 0, KNOWN_MTA_TFX 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, NO_URI_HTTPS 0, REFERENCES 0, SPF_PASS 0, SXL_IP_TFX_WM 0, __ANY_URI 0, __BODY_NO_MAILTO 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DKIM_ALIGNS_1 0, __DKIM_ALIGNS_2 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FORWARDED_MSG 0, __FRAUD_ANTIABUSE 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_REFERENCES 0, __HAS_X_MAILER 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MSGID_APPLEMAIL 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_MAILTO 0, __URI_NO_WWW 0, __URI_NS , __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
X-Authenticated-Sender: web1.siteocity.com: felipe [...] felipegasper.com
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2019.11.27.133917
X-Get-Message-Sender-Via: web1.siteocity.com: authenticated_id: fgasper/from_h
To: bug-future [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
X-Source:
X-Source-Args:
In-Reply-To: <rt-4.0.18-30386-1574860440-1767.131094-6-0 [...] rt.cpan.org>
X-Spam-Status: No, score=-4.405 tagged_above=-99.9 required=10 tests=[AWL=0.802, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FROM_OUR_RT=-4, RDNS_NONE=0.793] autolearn=ham
X-Mailer: Apple Mail (2.3445.104.11)
X-Source-Dir:
X-RT-Interface: API
References: <RT-Ticket-131094 [...] rt.cpan.org> <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com> <rt-4.0.18-29816-1574860272-9.131094-6-0 [...] rt.cpan.org> <rt-4.0.18-30386-1574860440-1767.131094-6-0 [...] rt.cpan.org>
Message-ID: <8D891EE3-9926-4486-847E-5AF95F01A76B [...] felipegasper.com>
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - web1.siteocity.com
X-Antiabuse: Original Domain - rt.cpan.org
X-Antiabuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse: Sender Address Domain - felipegasper.com
Return-Path: <felipe [...] felipegasper.com>
X-RT-Mail-Extension: future
X-Original-To: cpan-bug+future [...] hipster.bestpractical.com
From: Felipe Gasper <felipe [...] felipegasper.com>
RT-Message-ID: <rt-4.0.18-6111-1574862556-140.131094-0-0 [...] rt.cpan.org>
Content-Length: 1330
Download (untitled) / with headers
text/plain 1.2k
Show quoted text
> Le 27 nov. 2019 à 08:14, Paul Evans via RT <bug-future@rt.cpan.org> a écrit : > > Ohright; it's not thrown as an inline error, but instead becomes the failure state of the returned Future. Since you just discarded that, it doesn't appear. Try ->get'ing it: > > $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123 } )->then( sub { print 456 } )->get' > Expected __ANON__(-e line 1) to return a Future at -e line 1. > 123 > > $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123; Future->done } )->then( sub { print 456 } )->get' > Expected __ANON__(-e line 1) to return a Future at -e line 1. > 123456 > > $ perl -Mwarnings -MFuture -e'my $f = Future->done(123); my $f2 = $f->then( sub { print 123; Future->done } )->then( sub { print 456; Future->done } )->get' > 123456
Ah, thank you for clarifying! Mostly what I’m getting at, though, is that this interface appears to work quite differently from then() as promise objects implement it. With promises, the return from the then() callback is given to the next promise down the chain, and only if the then() callback throws/dies is the returned promise a failure. That being the case, should the documentation be updated to describe a bit more fully what Future::then() does? Thank you!
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-6111-1574862556-140.131094-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <RT-Ticket-131094 [...] rt.cpan.org> <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com> <rt-4.0.18-29816-1574860272-9.131094-6-0 [...] rt.cpan.org> <rt-4.0.18-30386-1574860440-1767.131094-6-0 [...] rt.cpan.org> <8D891EE3-9926-4486-847E-5AF95F01A76B [...] felipegasper.com> <rt-4.0.18-6111-1574862556-140.131094-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-23345-1580178764-1005.131094-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 685
Download (untitled) / with headers
text/plain 685b
On Wed Nov 27 08:49:16 2019, felipe@felipegasper.com wrote: Show quoted text
> Mostly what I’m getting at, though, is that this interface appears to > work quite differently from then() as promise objects implement it. > With promises, the return from the then() callback is given to the > next promise down the chain, and only if the then() callback > throws/dies is the returned promise a failure.
But that is what is happening here. $ perl -MFuture -E 'say Future->done("First") ->then(sub { say "Previous result was $_[0]"; Future->done("second") }) ->then(sub { say "The next result was $_[0]"; Future->done }) ->get' Previous result was First The next result was second -- Paul Evans
MIME-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Outgoing-Spam-Status: No, score=-1.0
X-From-Rewrite: unmodified, already matched
X-Spam-Flag: NO
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
content-type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -4.603
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] felipegasper.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 88BE5240304 for <cpan-bug+future [...] hipster.bestpractical.com>; Tue, 28 Jan 2020 19:40:33 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fK5aGaCpIGYb for <cpan-bug+future [...] hipster.bestpractical.com>; Tue, 28 Jan 2020 19:40:31 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [147.75.38.233]) by hipster.bestpractical.com (Postfix) with ESMTPS id 763E62401C8 for <bug-future [...] rt.cpan.org>; Tue, 28 Jan 2020 19:40:31 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 9717F7C1C7 for <bug-future [...] rt.cpan.org>; Tue, 28 Jan 2020 16:40:30 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id 7CA377CEED for <bug-future [...] rt.cpan.org>; Tue, 28 Jan 2020 16:40:28 -0800 (PST)
Received: from web1.siteocity.com (web1.siteocity.com [67.227.147.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id D648C7C1C7 for <bug-future [...] rt.cpan.org>; Tue, 28 Jan 2020 16:40:27 -0800 (PST)
Received: from hou-2.nat.cptxoffice.net ([184.94.197.2]:46091 helo=[10.3.5.43]) by web1.siteocity.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from <felipe [...] felipegasper.com>) id 1iwbP8-007Nrn-Du for bug-future [...] rt.cpan.org; Tue, 28 Jan 2020 18:40:27 -0600
Delivered-To: cpan-bug+future [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #131094] then() seems incorrectly documented
Dkim-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=felipegasper.com; s=default; h=Message-Id:In-Reply-To:To:References:Date: Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kSYmv51U1MVOXJp+rP7rB9j4LVaAV5bpGkxUkhWz2wc=; b=f/T16rEkZr9M+ytKaZ2g3M7gUj NFWKw5QrsOBr0PoDyxhngfA3yZN4zl7NvqbZCHeQGzmj15TFu+pYCV1b1jDjZxFeFXG1qyqKjYtzB qO9L0aJQSSpd9My8MW7CYrpxh8srllnpwj3uc/rvVqqEMLDa8pixLdI8URRd8yRpkiYVtuOahaDM8 KoFck4aVtTSzlXuuyc7QLDw7EzShueJh73KcYKTWkAxblDYLcSB+wgNhHPoNfHpkKV+/6OY7fU2P1 46H4XwUGBjDUukAYZX1sYtjWwod0X11oBIwfjMIyjIs8HbauiiPrjqU11JqHIdG+ePyUaLg7GFGI1 5QRez3XQ==;
Date: Tue, 28 Jan 2020 19:40:24 -0500
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, SUPERLONG_LINE 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_ALIGNS 0, DKIM_SIGNATURE 0, IN_REP_TO 0, KNOWN_MSGID 0, KNOWN_MTA_TFX 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, SPF_PASS 0, SXL_IP_TFX_WM 0, URI_ENDS_IN_HTML 0, URI_WITH_PATH_ONLY 0, __ANY_URI 0, __BODY_NO_MAILTO 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __DKIM_ALIGNS_1 0, __DKIM_ALIGNS_2 0, __DQ_NEG_HEUR 0, __DQ_NEG_IP 0, __FORWARDED_MSG 0, __FRAUD_ANTIABUSE 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_REFERENCES 0, __HAS_X_MAILER 0, __HTTPS_URI 0, __IN_REP_TO 0, __MAIL_CHAIN 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MSGID_APPLEMAIL 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __SUBJ_REPLY 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_IN_BODY 0, __URI_MAILTO 0, __URI_NOT_IMG 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0, __blackholes.mail-abuse.org_ERROR , __zen.spamhaus.org_ERROR '
X-Authenticated-Sender: web1.siteocity.com: felipe [...] felipegasper.com
X-Spam-Level:
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2019.11.28.70017
X-Get-Message-Sender-Via: web1.siteocity.com: authenticated_id: fgasper/from_h
To: bug-future [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
X-Source:
X-Source-Args:
In-Reply-To: <rt-4.0.18-23345-1580178764-1358.131094-6-0 [...] rt.cpan.org>
X-Spam-Status: No, score=-4.603 tagged_above=-99.9 required=10 tests=[AWL=1.397, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FROM_OUR_RT=-4] autolearn=ham
X-Mailer: Apple Mail (2.3445.104.11)
X-Source-Dir:
X-RT-Interface: API
References: <RT-Ticket-131094 [...] rt.cpan.org> <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com> <rt-4.0.18-29816-1574860272-9.131094-6-0 [...] rt.cpan.org> <rt-4.0.18-30386-1574860440-1767.131094-6-0 [...] rt.cpan.org> <8D891EE3-9926-4486-847E-5AF95F01A76B [...] felipegasper.com> <rt-4.0.18-6111-1574862556-140.131094-6-0 [...] rt.cpan.org> <rt-4.0.18-23345-1580178764-1358.131094-6-0 [...] rt.cpan.org>
Message-ID: <281A1702-33C6-4AF2-A0B8-0C82D7ACD24B [...] felipegasper.com>
X-Antiabuse: This header was added to track abuse, please include it with any abuse report
X-Antiabuse: Primary Hostname - web1.siteocity.com
X-Antiabuse: Original Domain - rt.cpan.org
X-Antiabuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse: Sender Address Domain - felipegasper.com
Return-Path: <felipe [...] felipegasper.com>
X-RT-Mail-Extension: future
X-Original-To: cpan-bug+future [...] hipster.bestpractical.com
X-PMX-Perl: Suspicious Attachment
From: Felipe Gasper <felipe [...] felipegasper.com>
RT-Message-ID: <rt-4.0.18-29891-1580258434-713.131094-0-0 [...] rt.cpan.org>
Content-Length: 1900
Download (untitled) / with headers
text/plain 1.8k
Show quoted text
> On Jan 27, 2020, at 9:32 PM, Paul Evans via RT <bug-future@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=131094 > > > On Wed Nov 27 08:49:16 2019, felipe@felipegasper.com wrote:
>> Mostly what I’m getting at, though, is that this interface appears to >> work quite differently from then() as promise objects implement it. >> With promises, the return from the then() callback is given to the >> next promise down the chain, and only if the then() callback >> throws/dies is the returned promise a failure.
> > But that is what is happening here. > > $ perl -MFuture -E 'say Future->done("First") > ->then(sub { say "Previous result was $_[0]"; Future->done("second") }) > ->then(sub { say "The next result was $_[0]"; Future->done }) > ->get' > Previous result was First > The next result was second
The *return* from the callback is what promises propagate, though. Future appears to require another Future in order to propagate and discard the callback’s return, which diverges from the usual promise interface: ===== Show quoted text
> node
Welcome to Node.js v12.13.1. Type ".help" for more information. Show quoted text
> Promise.resolve("first").then( v => { console.log(v); return "second" } ).then( v => { console.log(v); } )
Promise { <pending> } Show quoted text
> first
second Show quoted text
> perl -MPromises::Deferred -e'my $d = Promises::Deferred->new(); $d->resolve("first"); $d->promise()->then( sub { print shift; return "second" } )->then( sub { print shift } )'
firstsecond Show quoted text
> perl -MPromise::ES6 -e'Promise::ES6->resolve("first")->then( sub { print shift; return "second" } )->then( sub { print shift } )'
firstsecond Show quoted text
> perl -MFuture -e'Future->done("first")->then( sub { print shift; return "second" } )->then( sub { print shift } )'
Calling ->then in void context at -e line 1. first ===== I’m not proposing that Future be changed, but merely that the documentation clarify this divergence. -FG
MIME-Version: 1.0
In-Reply-To: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <BA61C538-6AA7-4D3F-8539-153D7B9C5290 [...] felipegasper.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-18778-1603127893-739.131094-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 110
Download (untitled) / with headers
text/plain 110b
Behaviour was changed in 0.45 to accept non-Future return values which are silently upgraded. -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.