編集可能
2012年8月26日

scala.util.Try

まとめました。
4
Tony Morris @dibblego

OH: "wow, scala.util.Try is really bad" Yes it sure is all L3 and everything. /cc @gersei

2012-08-23 15:42:35
Tony Morris @dibblego

Just learned that #scala.util.Try is spectacularly bad, not just bad. Is this why twitter's errors suck balls?

2012-08-26 08:03:47
Richard Wallace @purefn

@dibblego Oh wow. I didn't realize how dangerous it was until just now. I guess reliable/consistent behavior is just for us neckbeards.

2012-08-26 08:23:49
Tony Morris @dibblego

@purefn If you think scala.util.Try is dangerous, wait until you see the #scala mailing lists! Morans iz dangerouz.

2012-08-26 09:06:33
Tony Morris @dibblego

OH: "the biggest travesty of scala.util.Try is... endorsed by people... know better, so that people that are new will not learn properly"

2012-08-26 09:38:55
Dan Rosen @mergeconflict

@dibblego In what way is it worse than you already believed? I'm extremely curious now...

2012-08-26 09:46:00
Tony Morris @dibblego

@mergeconflict see map and flatMap for spectacularly dangerous law-breaking.

2012-08-26 09:50:21
Dan Rosen @mergeconflict

@dibblego hmm, has somebody written at length about this yet? i'm tempted.

2012-08-26 11:04:09
Tony Morris @dibblego

@mergeconflict No, but others have suggested I do (I don't know if I get a chance). I argued that it will fall on the usual deaf ears, ...

2012-08-26 11:05:16
Tony Morris @dibblego

@mergeconflict ..it was counter-argued that at least for the purposes of learning and discussion for those who are open to it -- I agree.

2012-08-26 11:05:46
Dan Rosen @mergeconflict

@dibblego the worst case I'm seeing here is the composition law for functors: Success(a) map { f compose g } != Success(a) map g map f

2012-08-26 11:13:15
Tony Morris @dibblego

@mergeconflict Discussing on IRC at the moment -- it's a tad more complicated (depends on how you define equality).

2012-08-26 11:15:51
Tony Morris @dibblego

@mergeconflict forall x f. (x map f).isSuccess == x.isSuccess // false

2012-08-26 11:16:05
Tony Morris @dibblego

@mergeconflict unless of course, you redefine identity, in which case, you've not satisfied the functor laws -- equivocation all the way.

2012-08-26 11:16:48
Tony Morris @dibblego

@mergeconflict irc://# Also the #scala channel, but it also gets ridiculous and very often so YMMV.

2012-08-26 11:21:27
Dan Rosen @mergeconflict

Well, I filed a bug on #scala.util.Try: https://t.co/QuFZlWyK. Now what do I win?

2012-08-26 14:22:33
Josh Suereth @jsuereth

@mergeconflict with a response now. You don't have to limit your math to one category. It is flexible,

2012-08-26 20:15:33
Josh Suereth @jsuereth

@dibblego @mergeconflict you can also redefine the initial category not to include arrows that catch stuff.

2012-08-26 20:16:57
Josh Suereth @jsuereth

@dibblego @mergeconflict which is the intent of try. Don't use it if you want your arrows catching exceptions.

2012-08-26 20:18:13
Tony Morris @dibblego

@jsuereth @mergeconflict I think more accurate is, "don't use it if you want your program to work."

2012-08-26 21:55:40
Brian McKenna @puffnfresh

@dibblego @mergeconflict doesn't it flat out break the left identity law by catching exceptions in binds?

2012-08-26 22:16:13
Josh Suereth @jsuereth

@dibblego @mergeconflict to be fair, I feel that way about exceptions. Would rather see types encode possible failures.

2012-08-26 22:30:19
Tony Morris @dibblego

@jsuereth @mergeconflict Sorry, but scala.util.Try is a total write-off and should never be used in my opinion.

2012-08-27 06:22:56
残りを読む(93)

コメント

コメントがまだありません。感想を最初に伝えてみませんか?