Re: Filter on future doesn't make sense

Avi Levi <[email protected]> Sun, 10 Jul 2016 10:19:44 +0300
Newsgroups gmane.comp.lang.scala
Message-ID <CAP0Sp2ni0kGvsx5fL56fS-noaRPpnyWwJyzh949G4nxVF_E8JQ@mail.gmail.com>
--001a1140e1e437f364053742dcec
Content-Type: text/plain; charset=UTF-8

Yeah, you are right . I take that back
On Jul 10, 2016 08:19, "Naftoli Gugenheim" <[email protected]> wrote:

>
>
> On Fri, Jul 1, 2016, 2:53 AM Avi Levi <[email protected]> wrote:
>
>> I was trying to figure out what should I accept when filtering over a
>> future .
>> the current implementation yields either a T or an exception which kind
>> of breaks referential transparency (doesn't it ?) .
>>
>
> How would it break referential transparency? It's just a value that
> happens to extend Throwable. (Actually throwing an exception might break
> RT, but that's not happening.)
>
> Isn't there the same question about Try#filter?
>
>
>
> on the other hand what can I expect given this expression
>>
>> *def foo(i:Int):Future[Int]*
>>
>> the type result of
>>
>> *foo(1).filter(_ % 2 == 0)*
>>
>>
>> I.M.H.O I would expect it to yield Option[T]  which makes more sense to
>> express that we might get a value that pass the filter or not . is that
>> make sense ?
>>
>> Cheers
>> Avi
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "scala-language" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "scala-language" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/scala-language/wpGOB8f7qmY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--001a1140e1e437f364053742dcec
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">Yeah, you are right . I take that back </p>
<div class=3D"gmail_quote">On Jul 10, 2016 08:19, &quot;Naftoli Gugenheim&q=
uot; &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&g=
t; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br>=
<div class=3D"gmail_quote"><div dir=3D"ltr">On Fri, Jul 1, 2016, 2:53 AM Av=
i Levi &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">123avi@gma=
il.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"l=
tr">I was trying to figure out what should I accept when filtering over a f=
uture .<div>the current implementation yields either a T or an exception wh=
ich kind of breaks referential transparency (doesn&#39;t it ?) .</div></div=
></blockquote></div><div><br></div><div>How would it break referential tran=
sparency? It&#39;s just a value that happens to extend Throwable. (Actually=
 throwing an exception might break RT, but that&#39;s not happening.)</div>=
<div><br></div><div>Isn&#39;t there the same question about Try#filter?</di=
v><div><br></div><div><br></div><div><br></div><div class=3D"gmail_quote"><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>on the other hand what =
can I expect given this expression=C2=A0</div><div>







<p><span><i>def foo(i:Int):Future[Int]</i></span></p><p><span>the type resu=
lt of=C2=A0</span></p><p><i>foo(1).filter(_ % 2 =3D=3D 0)</i></p>







<p><span><br></span></p></div><div>I.M.H.O I would expect it to yield Optio=
n[T] =C2=A0which makes more sense to express that we might get a value that=
 pass the filter or not . is that make sense ?</div><div><br></div><div>Che=
ers</div><div>Avi=C2=A0</div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;scala-language&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]" targ=
et=3D"_blank">[email protected]</a>.<br>
For more options, visit <a href=3D"https://groups.google.com/d/optout" targ=
et=3D"_blank">https://groups.google.com/d/optout</a>.<br>
</blockquote></div>

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;scala-language&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
d/topic/scala-language/wpGOB8f7qmY/unsubscribe" target=3D"_blank">https://g=
roups.google.com/d/topic/scala-language/wpGOB8f7qmY/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:[email protected]" target=3D"_blank">s=
[email protected]</a>.<br>
For more options, visit <a href=3D"https://groups.google.com/d/optout" targ=
et=3D"_blank">https://groups.google.com/d/optout</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;scala-language&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">scal=
[email protected]</a>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

--001a1140e1e437f364053742dcec--