----- March 28th, 2016 -----
koher [11:39 AM] joined #discussion, and invited @omochimetaru. Also, @hkato193 joined, @shingt joined, @norio_nomura joined.
koher [11:42 AM]
Yeah, we extensively discussed adding a Result type internally, but ultimately couldn't justify it. The only real use case we could see in the wild was for threading errors through CPS-inversion-style abstractions like async promises, something we hope to provide proper language support for. More generally, expressing effects as monadic values is a pretty awful abstraction; aside from polluting the Internet with an endless deluge of unhelpful tutorials, they also don't compose cleanly, they impose nesting where is desiredâyou have to pick between
Result<Async<T>>
andAsync<Result<T>>
, or buildResultT<AsyncT<Identity>><T>
out of monad transformersâand they don't do the natural thing when used with other higher-order abstractionsâif you're mapping athrows
function over a collection, you probably want to propagate that error likerethrows
does, not end up with a collection ofResult<T>
. I'd rather see us adopt an extensible algebraic effects system, something like http://www.eff-lang.org, which provides a framework forthrows
,async
and other control flow effects to be cleanly composed and abstracted over. I seethrows
as the first seed of that. -- Joe Groff https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160314/012545.html
ikesyo [11:42 AM] joined #discussion
koher [11:43 AM]
ãããèªãéãã©ããã³ã¢ããŒã ã¯ã¢ããçãªãšã©ãŒãã³ããªã³ã°ãç®æããŠãªããããªã®ã§ãæè¿å°ã Result
ãšè·é¢ã眮ããæ¹ãããããããªãããªããšããæ°ãããŠããšãã話ã§ãã
[11:44]
Result
ãããããã§ãŠããã Haskell ã® do
èšæ³ã¿ãããªã®ããªããš flatMap
ãã§ãŒã³ããèŸãããšãã話ããã£ãŠã
[11:44] ã¢ããªã«ãã£ãã¯ã¿ããªããã§ãšã©ãŒãã³ããªã³ã°ããŠãã€ã¡ãŒãžããããªããããšããããšããã£ãŠã (edited)
[11:45]
try! Swift ã§ã¯ Result
ãš do
, try
, catch
ãèåã§ããæ¹åãããããããªããã£ãŠè©±ããããã©ã
[11:46]
ïŒ Error Handling Rationale and Proposal ã«ã Result
ãå¿
èŠã ã£ãŠæžããŠãã£ããã swift-evolution ã§ã typed throws ã®è©±ã«æ±ºçãã€ããã Result
ã«ã€ããŠè©±ããããªæ°é
ããã£ããã©ïŒ
dictav [11:47 AM] joined #discussion. Also, @huin joined.
koher [11:48 AM]
ãã£ã¡ã®æ¹åã«ãããªããããªãè²ããªãã®ã Result
ãŸã¿ãã«ããŠããããããä»ã¯ throws
ã§æžããŠãããæ¹ãããã®ããªããšã
[11:48] Eff ãããããªãããããŸã Joe Groff ã®èšã£ãŠãæ¹æ³ã®ã€ã¡ãŒãžããããªãã§ããã
[11:49]
ã§ããããä»ã®æ®µé㧠throws
ã§éåæåŠçã©ãããã®ïŒã£ãŠè©±ããã£ãŠã
[11:50]
func download(url: NSURL, completion: Result<NSData, NetworkError> -> ()) { ⊠}
[11:50] ã®ä»£ããã«
[11:51]
func download(url: NSURL, completion: (() throws -> NSData) -> ()) { ⊠}
[11:51] ã®ããã«æžãã®ã¯ã©ãããªããšãã話ãããŠãŸããã
econa77 [11:52 AM] joined #discussion
koher [11:54 AM]
@omochimetaru çã«ã¯ã () throws -> NSData
ã¯åç
§ééã§ããããšãåã§ä¿èšŒãããŠãªããã
[11:55] åä»ãã匱ããªã£ã¡ãã£ãŠãéšåã埮åŠã ãšã
ooba [11:55 AM] joined #discussion
koher [11:56 AM]
ä»ã®æ¡ãšããŠã JS ã® Promise
ã® then
ã¿ããã«æåãšå€±æã®äºã€ã®ã³ãŒã«ããã¯ãæž¡ããæ¹æ³ãæãã£ããã©ãæåãšå€±æãããŸãçµ±åããŠåŠçã§ããªãã埮åŠãªæ°ãããŸãã
omochimetaru [11:59 AM] åç §ééæ§ã®è«ç¹ãå ·äœçãªäŸã§èšãæãããšããã®completionã§åãåãã¯ããŒãžã£ããäŸãã°2å3ååŒã³åºãããæ¯ååãçµæã«ãªãã®ããšãããããåŒã³åºãäºãdownloaderåŽã«å¯Ÿããéç¥ã®æ©èœ(äŸãã°ãã¯ãªãŒã³ãããã¿ã¹ã¯ãèµ·åãããšã)ãå«ãã®ã§ã¯ãªãããã£ãŠã©ã€ãã©ãªãŠãŒã¶ãŒãç¡é§ã«æ··ä¹±ãããšããäºã§ãã (edited)
koher [12:00 PM] æ話ããŠããå¯äœçšãæããªãããšãä¿èšŒããåã¿ãããªã®ããããšãããã
omochimetaru [12:01 PM] ãªãã»ã©
koher [12:01 PM] å¯äœçšãæã€é¢æ°ã¯å¯äœçšãæããªãåã«ã¯ä»£å ¥ã§ããªããã©éã¯ã§ããã
[12:01] ã¯ã©ã¹ããã€ãã¥ãŒã¿ãã«âãã¥ãŒã¿ãã«ã¯ä»£å ¥ã§ãããã©éã¯ã§ããªãã
[12:02]
Swift ãåºãæ㯠mutating
ããããïŒïŒãšæã£ããã©ã¡ãã£ãšéã£ãã
omochimetaru [12:02 PM] ä»®ã«åç §ç䟡ã§ããNSDataã®ç°ãªãã€ã³ã¹ã¿ã³ã¹ãæ¯åçæãããããåãã€ã³ã¹ã¿ã³ã¹ãæ¯åè¿ããããã®æåã®éãã¯èµ·ããããïŒ
[12:02] ã€ãã¥ãŒã¿ãã«ã ããå®è³ªåé¡ã«ã¯ãªããªãããª
koher [12:03 PM] åç §ééãªãåãã€ã³ã¹ã¿ã³ã¹ãè¿ãããããªãïŒ
[12:03] ãããšã¯éããªããïŒ
omochimetaru [12:03 PM] äŸãã°å éšã§char * ããã£ããã£ããã¯ããŒãžã£ã«ãªã£ãŠãã°
[12:03] ããããã ãšã¡ã¢ãªç®¡ççã«ç Žç¶»ãããã ã
koher [12:03 PM] ãŸãã§ããåãã€ã³ã¹ã¿ã³ã¹ãã©ããã¯å¥ã«åé¡ãããªããšæãã (edited)
[12:05] ããŒããçµæ§ãããšæããã ãã©ãªãã
func download(url: NSURL, completion: (() throws -> NSData) -> ()) { ⊠}
omochimetaru [12:06 PM] Resultã§æ¥ãã»ããå¬ããã§ãã
koher [12:08 PM]
å㯠throws
ãããã ã£ããã©ã
[12:08]
do
, try
, catch
ã£ãŠçµå± Haskell ã® do
æ§æã ããªã£ãŠèªèã«ãªã£ãŠãã
[12:09] ç©æ¥µçã«äœ¿ã£ããããããããªããã£ãŠæ°åã
toshi0383 [12:11 PM] joined #discussion
koher [12:11 PM]
Result
ã ãšè€æ°ãŸãšããŠåŠçããã®ã¯ïŒ flatMap
ã®ãã¹ãïŒã¢ããªã«ãã£ãïŒ dematerialize
ïŒ
omochimetaru [12:12 PM] ããããã©ã€ãã©ãªã®ãŠãŒã¶ãŒãµã€ãã ãã
[12:13] 奜ããªæžãæ¹
[12:13] ã¢ããªå šäœã§çµ±äžããã°ãããã©
koher [12:13 PM] ã©ããèŸããªãããªãã
omochimetaru [12:13 PM] throws掟ã®äººãdematerializeããã°
[12:13] ïŒæã§try-catchã¹ã¿ã€ã«ã«æã£ãŠããããã
[12:13] ãŸãã¯Resultã§æž¡ã£ãŠããã®ã䟿å©ã ãšæã
[12:14] è€æ°ãŸãšããŠã£ãŠãäœãè€æ°ã®è©±ã§ããïŒ
koher [12:14 PM]
è€æ°ã® Result
ãã¢ã³ã©ããããããšããšãã
[12:14]
ããšãã° JSON ããã³ãŒãããŠãŠçµæã Result
ã§å€§éã«è¿ã£ãŠãããšãã«ã
[12:15] éåæãã話ããã¡ãã£ãŠããã
omochimetaru [12:15 PM] ãã®ã±ãŒã¹ã¯throwsã®ã»ãã䟿å©ãããšæãã€ã€ãã
koher [12:15 PM]
ããããåæãªã throws
ã§ãããã ãã©ã
[12:16]
ã§ã Result
ã®å
è¡ããæªãããªã£ãŠãããã (edited)
omochimetaru [12:16 PM] ããã¯ãã
koher [12:16 PM]
throws
䟿å©ãšããèªèã«å€ãã£ãŠããã
[12:16]
ãªãå
šéš throws
ã«å¯ãã¡ãããããªããšããäžã§
[12:17] éåæã¯ã©ããããïŒã£ãŠè©±ãªãããã
omochimetaru [12:17 PM] ãã£ãã®ã±ãŒã¹ã§
[12:17] ()ã§åŒã³åºããŠT | Errorã«ãªãã®ãš
[12:17] .demateiralize()ã§åŒã³åºããŠT | Errorã«ãªãã®
[12:18] ïŒïŒæåãããããå€ãããªã代ããã«
[12:18] åçã«ãïŒè æäžã®å€ã§ãããšãã確信ãåŸããã
[12:18] JoeGroffã®æåã®ãã€ã£ãŠãéåæã«èšåããŠãªããããªïŒ
koher [12:19 PM]
ããŒããã³ãŒã«ããã¯ã§ (() throws -> NSData) -> ()
ã® () throws -> NSData
ãå¯äœçšãæã€ãªããŠãèãã¥ãããšæããã©ãªãã
omochimetaru [12:19 PM] éãã®ããéåæã®éšåãã³ãŒã«ããã¯ã¹ã¿ã€ã«ãããªããŠPromiseã«ããããã«ãªã¹ã«ãªã£ãŠããã£ãŠè©±ãªã®ããª
koher [12:19 PM]
ãšãããã Error Handling Rationale ã§éåæãšã㧠Result
ãèŠãããã£ãŠæžãããŠããŠ
[12:20]
ãããåŒçšã㊠Result
ãš throws
ãèåããããã£ãŠè©±ãããã
[12:20]
Result
ãããããã£ãŠã
[12:21]
確ãã« Foo<Bar<T>>
ãªã®ã Bar<Foo<T>>
ãªã®ãã®åé¡ã¯ãã£ãŠã
[12:21] ããã®æ±ãã¯é¢åãããããã
[12:22]
which provides a framework for
throws
,async
and other control flow effects to be cleanly composed and abstracted over.
[12:22] ãããæ¬åœãªããã£ã¡ã®æ¹ãããæ°ãããã
[12:22] ã€ã¡ãŒãžãããŠãªããã©ã
omochimetaru [12:26 PM] Effããã£ãç¯å²ã®ã€ã¡ãŒãžã ãš
[12:26] ã³ãŒããèªåçã«ç¶ç¶æž¡ãã«ãªã£ãŠããã®ç¶ç¶ãåããæ¹ã®å®è£ ãå€ã§æžãããã
[12:27] tryããªããæ£åžžç³»ãæžããŠãã£ãŠããšã©ãŒã ã£ããè±åºããå¶åŸ¡ãš
[12:27] awaitããªããéåæåŒã³åºããæžããŠãã£ãŠãèŠããäžã·ãŒã±ã³ã·ã£ã«ãªã³ãŒãã
[12:27] ã©ã£ã¡ããtryãšãawaitãšãã®ç®å°ãç¡ããŠ
[12:27] çŽ çŽãªæ£åžžç³»ã ããæžãããšãã§ããŠ
[12:28] ã¿ãããªæãã ã£ããã©
[12:28] é«åºŠãªäŸã¯è§£èªã§ããªãã£ãããçµã¿åãããå Žåã«ã©ããªã£ãŠãããšãã¯ããããããªã
koher [12:28 PM]
ããããä»ã® do
ã«ã¯æ»ãå€ããªããããããåé¡ã«ãªãããšã¯ãªãã®ãã
[12:29]
äŸãã° Swift ã« async
, await
ãè¿œå ããããšããŠãã
[12:29]
do {
let foo = try makeFoo()
let bar = await makeBar()
âŠ
} catch _ {
âŠ
}
[12:30]
ãšããŠããçµæãåããéšåããªããã Result<Promise<T>>
ãªã®ã Promise<Result<T>>
ãªã®ãã¿ãããªåé¡ãèµ·ããåŸãªãïŒ
omochimetaru [12:31 PM] ããã©ããªãã ãã
[12:32] ããã§ãããã ãš
koher [12:32 PM]
âããã«ãããã foo
ã§å€±æãããåæçã«ã baz
ã«å€±æãããéåæçã« catch
ã«å
¥ãïŒ
do {
let foo = try makeFoo()
let bar = await makeBar()
let baz = try makeBaz()
âŠ
} catch _ {
âŠ
}
omochimetaru [12:33 PM] ãã®äŸã§makeFooãšmakeBarã®è¿ãå€ã®ããåŸãåã£ãŠãªãã§ããïŒ
[12:33] makeFoo㯠Result or Result<Promise> ïŒ
[12:33] ããéãããthrowsã ããã»ã»ã»
koher [12:33 PM]
func makeFoo() throws -> Foo
func makeBar() async -> Bar
func makeBaz() throws -> Baz
(edited)
norio_nomura [12:34 PM] C# ããããªä»çµã¿ã ã£ãæ°ãããã
omochimetaru [12:34 PM] C#ã®async/awaitã¯äŸå€ä»æ§ãšãã£ã€ããŠãŠãawaitããæã«äŸå€é£ã¶ãšcatchã§ããæ°ãããŸããã
[12:35] makeBar() async -> Bar ; makeBar() async throws -> Bar
[12:35] ã§ãã©ã£ã¡ã§ãããããã«ã§ããã®ãã
koher [12:35 PM] ããããããªæãã® async/await ã Swift ã«éŠŽæã¿ããã
335g [12:36 PM] joined #discussion
koher [12:36 PM]
åæçã«ãéåæçã«ã catch
ã«é£ãã§ããããããããããšã«ãªããªãããªã»ã»ã»ã
omochimetaru [12:36 PM] ãããã«å ¥ãååé¡ã¯ãªãã»ã»ã»ïŒ
norio_nomura [12:36 PM] https://msdn.microsoft.com/ja-jp/library/0yd65esw.aspx
koher [12:38 PM]
@norio_nomura: 確ãã« catch
ã«éåæçã«é£ãã§ããã§ããã
[12:39]
ããã£ãŠ await
åã«äŸå€çºçããå Žåãåã catch
ã«åæçã«é£ã¶ãã§ãããïŒ
omochimetaru [12:39 PM] C#ã®å Žåtry-catchãããã¡ãœããèªäœãasyncé¢æ°ã«ãªããããåæãšéåæã®æ··ä¹±ã¯ãªãã£ãŠããšã§ããã
koher [12:39 PM] ããã¯ä»ã®ãšãã Swift ããããããªãïŒ
[12:40]
catch
çžåœã® wait
ã¿ãããªã®ãäœã£ãŠ
[12:40] éåæâåæãå®çŸããªããš
[12:40]
å€åŽã®é¢æ°ã¯å¿
ã async
ãããªããšãããªããªãã
omochimetaru [12:40 PM] C#ã¯ãŸãã«ããã§ããããšãããWinRTããªïŒ
[12:41] åæçãªåŸ æ©ãã§ããªãããã«åŸ¹åºãããŠã
[12:41] async修食ãã©ãã©ãäžãŸã§äŒæ¬ããŸããJavaã®throwsã¿ããã«
koher [12:41 PM]
do {
let a = await asyncGetInt()
let b = await asyncGetInt()
let sum = a + b
âŠ
} wait
[12:41] ãããªããšãã§ããŠãããæ°ãããã
omochimetaru [12:43 PM] C#ã§
[12:43] ãšã©ãŒãéåæã«æ»ããšãã¯
[12:43] asyncã«ãªã£ãŠãã£ãŠããšã§ãããïŒ
tarunon [12:43 PM] joined #discussion
omochimetaru [12:44 PM] asyncãããã®ã«ããããã³ãŒã«ããã¯åããã·ã°ããã£ã«ããã¡ãªããç¡ããããã ããª
[12:44] ãŠããšã¯ãããããã®è°è«ã¯ãasync/awaitãå ¥ãã°è§£æ±ºããŠãã³ãŒã«ããã¯ãç¡ããªã
[12:44] ã£ãŠã®ãå°æ¥çãªæ¹åæ§ã®èŠèŸŒã¿ã§
[12:44] ãããèŠæ®ããäžæçãªAPIãã©ãããã
koher [12:45 PM] async/await ã¯ãŸã ããããªãããããªãïŒ Swift 3.0 以éã ãããã
omochimetaru [12:45 PM] æ¥ãŠã»ãããªã
norio_nomura [12:45 PM] èšèªã¬ãã«ã§ãã«ãã¹ã¬ããã«å¯Ÿå¿ããã£ãŠããšã§ãããïŒ
[12:45] ããããªãïŒ
omochimetaru [12:45 PM] ãã«ãã¹ã¬ãããšã¯éããªããããªïŒ
koher [12:45 PM]
Concurrency: Swift 3.0 relies entirely on platform concurrency primitives (libdispatch, Foundation, pthreads, etc.) for concurrency. Language support for concurrency is an often-requested and potentially high-value feature, but is too large to be in scope for Swift 3.0.
akio0911b [12:46 PM] joined #discussion
omochimetaru [12:46 PM] å éšçã«ã¯Promiseãžã®å€æã§ãawaitã®çºç«ã¯GUIãšãã®ã³ãŒã«ããã¯ãšåãã ãããã¡ã€ã³ã¹ã¬ã§èµ°è¡ããŸã
[12:47] èšèªä»æ§ããã¹ã¬ããã£ã³ã°ä»æ§ãèŠå®ããã«ã¹ã±ãžã¥ãŒã©ãŒãšãã ãã§ãã©ãããã©ãŒã åºæå®è£ ã§async/awaitãå®çŸã§ãããã©ããããããããªã
koher [12:48 PM]
PromiseK 㧠Promise
èªäœãå®çŸããããšã¯ãã«ãã¹ã¬ããé¢ä¿ãªãã§ããããããã¯ã ãã¯å¿
èŠã ã£ããã©ã
[12:48] ã ããã async/await ãã§ããããïŒ
omochimetaru [12:49 PM] 3.0ã«concurrencyå ¥ããªãäºã確å®ããŠãäžã§async/awaitãæ¥ããã©ããïœ
[12:49] ã§ãéã«èšããš
[12:50] 3.0ã§async/awaitå ¥ããªããªãããã®äžä»£ã§ã®ã³ãŒã«ããã¯ã§ãšã©ãŒæ»ãæšå¥šãã¿ãŒã³ã¯ã©ããªãã®åé¡ã¯æ®ã£ãŠãããã
koher [12:50 PM] ããã 3.0 ã§ã¯æ¥ãªããšæãã
[12:50]
The only real use case we could see in the wild was for threading errors through CPS-inversion-style abstractions like async promises, something we hope to provide proper language support for.
[12:51] ãããããããš3.0以éã§ã¯æ€èšããããïŒ
omochimetaru [12:51 PM] äžåæã£ããã§ããã©
[12:51] async/awaitãããšã©ãŒ(throws)ä»æ§ãå«ããéåæä»æ§ã«ãªããšããŠ
[12:52] çŸå®ã®ããã°ã©ããšããŠãRx掟ãRAC掟ã®äººãã¡ãå± ãŠ
[12:52] ããã¯ããšã©ãŒãšäŸå€ãšãããã«ãã¹ããªãŒã (Tãnåè¿ã)ã£ãŠããæ©èœãŸã§æã£ãã¢ãã(ïŒ)
norio_nomura [12:52 PM] C# ã® async/await ã®ãããŒã¯ãããåèã«ãªã? https://msdn.microsoft.com/ja-jp/library/hh191443.aspx#Anchor_2 >èŠãŠã人ã
omochimetaru [12:52 PM] ã«å¯ããŠãã£ã¡ããããã§
[12:53] throwsãasyncã䜿ãããå šéšObservableã«ããšãã°ãããã£ãŠãªãããã ãã©
[12:53] ãããasyncã¿ããã«æŒç®åå/èšèªæ©èœå
[12:53] ã§ãããã®ããªã
[12:54] throwsã®è¯ããšãããšããŠã¯throws -> () ã§ããã£ãã匷å¶ãã§ããŠããšããç¹ãããã®ã§ããããã§ãããããRxãæããšæããã ãã©ã
[12:54] error_unused_resultã¯å®çšçã«ã¯åœ¹ç«ã€ãã©ãçµæã䜿ãã€ã€ããšã©ãŒã®äºå¿ããŠããã¿ãŒã³ã¯ãããããã
koher [12:55 PM] èšèªãšããŠç®æãæ¹åãšéãæ¹åã®ã¹ã¿ã€ã«ã®ã©ã€ãã©ãªããã®ãŠãŒã¶ãŒãçºå±ããããšèªäœã¯ããããªãããããªãããªã
omochimetaru [12:55 PM] ããããRxãC#ã®MVVMãšåãã«ãŒããªã®ã ã£ãïŒ
koher [12:55 PM] å€æ§æ§ãšããŠãæªãããšã¯ãªããšæããã
[12:56] ã§ããèšèªãšããŠã®æ¹åæ§ã¯ãããã人ãã¡ã®ååšãšã¯ç¬ç«ã«ãããã¹ãæ¹åæ§ãç®æãããããªãïŒ
[12:56] Rxããã€ã¯ããœããç³»ãããªãã£ãïŒ
norio_nomura [12:56 PM] Rx.NET ã§ãããïŒ
[12:57] ãã£ãšãweb ãšããŠã¯ãã£ã¡ http://reactivex.io
koher [12:58 PM]
ããã¯ããšã©ãŒãšäŸå€ãšãããã«ãã¹ããªãŒã (Tãnåè¿ã)ã£ãŠããæ©èœãŸã§æã£ãã¢ãã(ïŒ) ãªãã§ãã§ããã¢ããçãªæ¹åæ§ã¯çãæªããšæãã
[12:58] ã¢ããã§ãªããŠãã ãã©ã
[12:58] ãšã©ãŒãçºçããªããããããªããã®ãå¿ ããšã©ãŒåŠçã§ããïŒãããã¯åŒ·å¶ããïŒã£ãŠããšã ãã
omochimetaru [12:59 PM] Rxã ãšã¹ããªãŒã ãããªããŠEventã§æž¡ãå¯èœæ§ãããããã
koher [12:59 PM] 匷å¶ãããç¡é§ã ãã匷å¶ããªãã£ããå®å šãããªããã
omochimetaru [12:59 PM] ãŸã確ãã«
koher [12:59 PM] ã°ãã°ãã®æ©èœãšããŠæäŸããŠãŠã奜ãã«çµã¿åãããããã®ãããããããªãããªã
omochimetaru [12:59 PM] @norio_nomura: ãªãããWinRTæ¡ä»¶ãã¡ãã£ãšãã£ããšãã«
[1:00] @norio_nomura: Observableçãªåãã¡ãã»ãèŠãããŠ
koher [1:00 PM] ãªã³ã¯ããããšãããããŸãã > @norio_nomura ãã
omochimetaru [1:00 PM] ãããRxãšç¹ãããã®ã ã£ãã®ãããªãã ã£ãã®ããªãŒãšã»ã»ã»
[1:01]
ã°ãã°ãã®æ©èœãšããŠæäŸããŠãŠã奜ãã«çµã¿åããããã throwsç¡ãasyncãããããã£ãŠããšã§ããïŒ
koher [1:02 PM] ããŒãããã£ãŠãããæ°ãããã
omochimetaru [1:02 PM] func nya() async throws -> String ; ãšã©ãŒãããããéåæã¡ãœãã func wan() async -> String ; ãšã©ãŒãããããªãéåæã¡ãœãã
[1:02]
func nya() async throws -> String ; ãšã©ãŒãããããéåæã¡ãœãã
func wan() async -> String ; ãšã©ãŒãããããªãéåæã¡ãœãã
do {
let x = await nya()
let y = await wan()
} catch {
}
(edited)
[1:02] nyaã®æ¹ã®awaitã¯æé»ã«tryãæžãããŠããæãïŒ
koher [1:03 PM] è«ççã«ãšã©ãŒãçºçããªãéåæåŠçïŒNç§åŸ ã€ã ãïŒã§ãšã©ãŒãçºçããå Žå㯠Universal error ãšããŠæ±ããšãã
[1:03]
throws
㯠Recoverable error ã®ããã®ãã®ã ããã Universal error ã¯ã¹ã«ãŒã
omochimetaru [1:04 PM] ã¯ãªãã¯ããããæ»ãasyncé¢æ°ãšããæ³å®ããã°ããããŸãã
koher [1:04 PM] âãããªããããªãïŒ
func nya() async throws -> String ; ãšã©ãŒãããããéåæã¡ãœãã
func wan() async -> String ; ãšã©ãŒãããããªãéåæã¡ãœãã
do {
let x = await try nya()
let y = await wan()
} catch {
}
omochimetaru [1:05 PM] ãããããšæ°ã«ãªãã®ã
func piyo() throws async -> String
ã
let z = try await piyo()
ã«ãªãã®ãã©ããã§ã»ã»ã»
koher [1:05 PM] é çªå€ããŠãç䟡ãããªãïŒ
[1:05] ãã£ãããæã£ãŠããã ãã©ã Union type ã Foo|ErrorA|ErrorB == Foo|ErrorB|ErrorA ãªã®ã«
omochimetaru [1:05 PM] ãããªãããã
koher [1:06 PM]
ã¢ããã ãš Either<Foo, Either<ErrorA, ErrorB>> != Either<Foo, Either<ErrorB, ErrorA>>
ã«ãªã£ã¡ããããã«
[1:07]
ã¢ããã ãš Result<Promise<T>>
ãªã®ã Promise<Result<T>>
ãªã®ããåé¡ã«ãªããã©
[1:07]
throws
ãš async
ã ãš throws async
ãªã®ã async throws
ãªã®ãã try await
ãªã®ã await try
ãªã®ããåé¡ã«ãªããªããšãããšãããããã
omochimetaru [1:08 PM] ãããã«ã
tarunon [1:08 PM]
Result<Promise<T>>
ãšPromise<Result<T>>
ã¯ããããæå³ãéããããª
koher [1:08 PM] ããã§ãããæå³ã¯éããŸããã
[1:09]
çŸå®çã«ã¯ Promise<Result<T>>
ããèŠããªãããïŒ
[1:09] ãããšãéããªããã
[1:10] å ¥ãåã®é åºã«ãã ããå¿ èŠã®ãªãïŒå°ãªãïŒãã®ã«ã€ããŠããããæ±ããªããšãããªããšãããã¢ããã®èŸããªã®ããªãšã
omochimetaru [1:10 PM] Result<Promise>ã¯Promiseããåãåºããå Žåã«ã¯å€±æããªãéåæã¿ã¹ã¯ã«ãªãããã 倱æã®ç¢ºèªãåæçã«(ã¿ã¹ã¯çºç«åã«)確å®ã§ãããã©
koher [1:11 PM] ããããããªãã ãã©
omochimetaru [1:11 PM] Tãåãåºãã®ã«éåæã¿ã¹ã¯ã®çºç«ãå¿ èŠãªä»¥äžãéåæã«ãšã©ãŒãæ»ã£ãŠãããšããŠãããŸãå°ããªããããªæ°ããããªã
[1:11] ã©ããªãã ãããããã£ãŠããªãã§ãã§ããã¢ããã«æŒãä»ããã°ããçºæ³ãªæ°ãããŠ
koher [1:11 PM]
ãã®å Žåã£ãŠ Result
ã®äžã« Promise
å
¥ããªãããããªãæå³ããããŸãªãæ°ãããã
[1:11] ãŸãåå²ããŠããéåæåŠçæããã°ããããã§ã
[1:12]
èªåãé¢æ°æžããšãã« Result<Promise<T>>
ãäœããããŠãŒã¹ã±ãŒã¹ãæãã€ããªããããªïŒ
omochimetaru [1:13 PM] ããšãã°
[1:13] åŒæ°ã§URLã®æååããããŠ
[1:13] ããŠã³ããŒãçµæã®NSDataãè¿ããããªãã¿ãŒã³ã§
[1:13]
åŒæ°ã®URLãhttp://
ã¿ãã㪠(edited)
[1:13] ïŒïŒ
tarunon [1:13 PM] w
omochimetaru [1:13 PM] ãã ããæååãããªãã£ããã
koher [1:14 PM]
åæ§ã«ã (âŠ) throws async -> Foo
ã¯å¿
ãéåæã§ããæ°ãããã
[1:14] ãã®å Žåã£ãŠ
tarunon [1:14 PM] äºåã«ãã§ãã¯ããããErrorãèµ·ããå ŽåãéåæãšããŠæ±ã£ãŠãå·®ãæ¯ããªã
omochimetaru [1:14 PM] âã®äŸã¯å®éRACã§äœã£ãŠããšããã£ããã©SignalProducerã«å šéšæŒãä»ããŸããã»ã»ã»
koher [1:14 PM] éåæåŠçã§ãšã©ãŒãçºçããã±ãŒã¹ãããããã§
[1:14] ã¢ããçã«ã¯
tarunon [1:14 PM]
Result<Promise<Result<T>>>
koher [1:14 PM]
Result<Promise<Result<T>>
tarunon [1:14 PM] çºçåŸ ã£ããªãã§ãã
omochimetaru [1:14 PM] Result<Promise<Result>
koher [1:14 PM] ã¿ããªåãããšãïœ
omochimetaru [1:14 PM] ïœïœ
[1:14] ãããæžããŠã¿ããã£ã
tarunon [1:15 PM] ãŸãã«ãã®ãã¿ãŒã³ãã®éæžãããã§ããã
omochimetaru [1:15 PM] mjsk (edited)
koher [1:15 PM]
ã§ãå€åããã Promise<Result<T>>
ãšããŠè¿ãé¢æ°ã«ããã ãããã
tarunon [1:15 PM] ãšããã
koher [1:16 PM]
throws async -> T
㯠Promise<Result<T>>
ã§è¯ããããªæ°ãã
tarunon [1:16 PM] Observableãå®äœã¯Promise<Result>ã§ãã
[1:16] å®äœãšãããå®éãšããã
[1:16] å€åããã¯ããã§è¯ãã£ãŠ (edited)
[1:17] ãªãã§ãäžã«ãã£ãããã«ãswift doãHaskellã®doèšæ³çžåœã®ãã®ãªã
[1:18] RACãšãRxã§ãã£ãŠãã¢ããã«è©°ã蟌ãã äžçããå šéšdoã®äžã«éããŠããïŒã¿ãããªããã
[1:18] ã«ãªããšè¯ãã®ããª
koher [1:18 PM] ããã§ãåã ãåºå¥ãããŠããŠãèªç±ã«çµã¿åããããããšããããã§ããã
[1:19] throws/try/catch, async/await/wait 以å€ã«äœããããããããªãã§ããã©ã»ã»ã»ã
[1:19] ã¢ããããšã«ããŒã¯ãŒãçšæããããã«ãããªãã§ãããã
[1:19] ããŒã¯ãŒãçšæãããã®ã«ã€ããŠã¯çµã¿åãããæã®å ¥ãåé ãèŠå®ããªããšãããªããã
[1:20] ã©ã£ã¡ã®é çªãå¿ èŠãšããªããšããŸããããªããã
omochimetaru [1:20 PM] Optionalã¢ããïŒ
koher [1:20 PM] äžã€ä»¥äžã®é çªãèãã ããšèŸããã»ã»ã»ã
[1:21]
ãããã ãã Optional
㯠Result
ã«çµ±åããŠã Result
ãš throws
ãçµ±åããŠ
omochimetaru [1:21 PM] Resultãšåãã§tryã§å¥ãããã°ãã説
koher [1:21 PM]
ã£ãŠã®ãæãæãããã ãã©ã Result
ã¯åŽäžãããã®ã§ã»ã»ã»ã
[1:21] ãããããã¯ãŸã ææ¡ããããšæã£ãŠããã ãã©ã
omochimetaru [1:22 PM] ãªããéåæãšãšã©ãŒã¿ããã«æ±ºå®çã«éããã€ãæãã€ããªããã§ããã
koher [1:22 PM]
nil
ã ã£ãå Žå㯠NilError
ã¿ãããªãã®ã«ãªãã¹ããªã®ãã catch
ããªãå Žå㯠throws
ä»ãã代ããã« Optional
ãè¿ãããã«ããã®ãã§
[1:22] 話ãéã£ãŠããŠã
[1:23]
åŸè
ã®å Žå㯠throws
ã®äžçãšæ··ãã£ã¡ãã£ãŠã³ãŒãèªã¿ã¥ãããã
[1:23]
throws
ãšæ··ããŠäœ¿ã£ããã©ããªãã®ïŒã£ãŠè©±ããããã
[1:25]
è€æ°ãŸãšããŠåŠçããã®ãèŸãåé¡ã¯ Result
ã ãã§ãªã Optional
ã«ããã£ãŠã Optional binding ã§ãããçšåºŠã¯ã§ãããã©ã©ãããŠãã§ããªãã±ãŒã¹ããããã
[1:25]
ãã£ã±ã do
, try
, catch
ã§ããããããšæãã
[1:26]
do {
let sum: Int = (try Int(str1)) + (try Int(str2))
} catch _ {
...
}
tarunon [1:27 PM]
Optional
ã«ã throws -> Wrapped
ãªã¢ã³ã©ããçšã®ãªãã¬ãŒã¿ãããã°è§£æ±ºããæ°ã¯ãã
[1:27]
Result
ãããã
omochimetaru [1:27 PM] ããã ã
Int(str1).flatMap { x in Int(str2).map { y in x + y} }
ããã®ã¯ãã£ã±ç¡ãã£ãã
[1:28]
@tarunon: åãäºãèããŠã!
ãããã ã£ããããã£ãã®ã§ã¯ãšã¡ãã£ãšãæã£ã
[1:28]
!
ã¯ãã£ã±ããããããªãããã£ãŠãã話ãkoherãšãããã§ããã©ã
tarunon [1:29 PM] try! Int(str)!ã§è¯ãããããšãæã£ãã
omochimetaru [1:29 PM] !ãT or crashãã throws -> Tã«å€ãããšãããªããŸããã (edited)
koher [1:30 PM]
ã§ã !
ã¯å€±æãããšãã«ã¯æ»ãèŠæã£ãŠããæå³ã§çµ±äžãããŠããã
[1:30]
!
ã§ãšã©ãŒãé£ãã§ãã³ããªã³ã°ã¯è¯ããªããšæããã§ãããã
tarunon [1:31 PM] ãŸãããã¯ãããšããŠãéã«ãªãã¬ãŒã¿ããäžå足ãã®ã¯
[1:31] çŸå®çãªè§£æ³ãªæ°ã¯ãããã§ããã
[1:31] ãšããã
omochimetaru [1:32 PM]
ãŸãå人çã«ã¯ .value
ã§ã .unwrap()
ã§ããããã©ã»ã»ã» (edited)
koher [1:32 PM]
.value
㯠throws
ã§ããªããã
tarunon [1:32 PM] ããã§ãããå¥ã«ç¡çã«èšå·äœ¿ããªããŠã
koher [1:32 PM]
func value() throws -> T
ããªãã
omochimetaru [1:33 PM] Optionalã¯Resultã®å°ããçãªã®ã«ãResultã¯ãããŸãŸtryã§ããŠãããã¡ãžã£ãŒã§ãšã£ã€ããããã¯ãã®Optionalã¯ãäžæéãããã£ãŠã®ã¯æ°æã¡æªãã¯ãã
koher [1:33 PM]
ã§ããã® .value()
ãèŸããªãããçŽæ¥ try
ã§ã¢ã³ã©ããã§ãããããããšãã話ãªæ°ãã
[1:33] 2.2 æç¹ã®çŸå®çãªæ¡ãšããŠã¯ããã ãšæããã©ã (edited)
[1:34]
do {
let sum: Int = (try Int(str1).value()) + (try Int(str2).value())
} catch _ {
âŠ
}
(edited)
[1:34] é·ãã»ã»ã»ã
[1:35] SwiftyJSON ã§ãã³ãŒãããŠã€ãã·ã£ã©ã€ã¶ã«æž¡ããšããšãçºçãããã»ã»ã»ã
tarunon [1:35 PM]
.value()
㯠Int()
ã®å€åŽãªæ°ããã
koher [1:35 PM] ããæ¬åœã§ããã
omochimetaru [1:35 PM]
éã«Resultã«å¯ŸããOptionalã®éååã
func eat() may -> T
[1:37] Resultãthrowsã«ãã£ãŠäžèŠã«ãªããªãOptionalãªããŠèŠããªãã£ãã»ã»ã»ïŒã£ãŠããšã«ãªãã»ã»ã»ïŒ
koher [1:37 PM]
enum Result<T, E: ErrorType> { ⊠}
struct NilError: ErrorType {}
typealias Optional<T> = Result<T, NilError>
omochimetaru [1:37 PM] ããããã£ãšãããããæµç³ã«ç¡è¶ã
koher [1:37 PM] ããããããšæããã ãã©ãªãã
omochimetaru [1:37 PM] ããã¯è¶ æããŸã
tarunon [1:37 PM] äžçŽè åãéããæw
omochimetaru [1:37 PM] åãã©ä»ããšã€ãªã¢ã¹æ¥ããã
koher [1:38 PM]
ãããã NilError
ã 0 ãã€ãã ãã
[1:38] sizeof(Optional) ããããŸã§éãã
[1:38]
ããã§ã typed throws ãå°å
¥ãããŠäžã€ã ããšã©ãŒåæå®ã§ããããã«ãªã£ãŠã throws E -> T
ã -> Result<T, E>
ãšç䟡ã«ãªã£ãŠã (edited)
[1:39]
ã ãšã Optional
ã Result
ã try
ã§ã¢ã³ã©ããã§ããã
[1:40]
ã§ã Result
ã®éã¯éããããããããã£ã±ã Result
å
¥ãããã£ãŠããšã«ãªããªããšç¡çã
omochimetaru [1:40 PM] ããã§ããã
koher [1:42 PM] ïŒïŒ
[1:42] swiftlang/swift-evolution#68 GitHub Allow Type Annotation on Throws, Take 2 by owensd · Pull Request #68 · apple/swift-evolution · GitHub This is a revised proposal for typed throws based on the feedback from the mailing list, and based on the request from Doug to flush out the specifics more fully.
[1:42] ããã©ãããã ããã£ãŠæã£ãŠãããäžç«¯ãªãžã§ã¯ããããŠãã
[1:42] 3.0ã§ã¯ãããªãã£ãŠã
[1:42] Typed throws
[1:43] 3 ã¶æéæŸçœ®ãããŠãã®ã«ã
inamiy [1:44 PM] joined #discussion
koher [1:44 PM] ãšããããšã¯ãã°ãã㯠Untyped Throws ãç¶ç¶ããã®ã¯æ±ºå®ã§ããã
omochimetaru [1:46 PM] https://github.com/owensd/swift-evolution/blob/090f40de5065a6592d2cf5a78f395257d6f60809/proposals/allow-type-annotations-on-throw.md ãµãã»ã»ã» GitHub owensd/swift-evolution Contribute to swift-evolution development by creating an account on GitHub.
koher [1:47 PM]
so it could come into Swift in a later release without compromising the design
omochimetaru [1:47 PM]
Aren't we just creating Java checked-exceptions, which we all know are terrible?
No. The primary reason is that a function can only return a single error-type.
[1:47] ãªãã»ã©
kozyty [2:07 PM] joined #discussion
inamiy [2:13 PM]
func nya() async throws
è€æ°ã®ã¢ããæ§é ã絡ã¿åã£ãŠãããšãèšè¿°ãããªãèŠãããã§ãããã
[2:15] https://speakerdeck.com/inamiy/swift-2-error-handling-vs-result-t-e æãtryããããã£ãŠã»ããçãªè©±ãããã®ã§ãåèã«ãªãã° Speaker Deck Swift 2 Error Handling vs Result Swift 2 (& LLDB) ã·ã³ããžãŠã http://realm.connpass.com/event/16556/ (65kB)
tarunon [2:21 PM] ããŒã
[2:22] doæ§æèªäœã¯ããã蟺ãã©ããã«åºæ¥ãã®ãçæ³ãªæ°ã¯ããã®ã§
[2:23] async throwsã®èšè¿°ã®é çªã«é¢ãããã
[2:23]
do { ... } await { ... } catch { ... }
ãšãåºæ¥ããšè¯ãã®ããªãšãæããŸãã
koher [2:27 PM] @inamiy: ãªã³ã¯ããããšãããããŸãïŒãããšãŠãããæŽçãããŠãŸãããåã try! Swift ã§è©±ãå¿ èŠãªãã£ãã®ã§ã¯ïœ
[2:28] Joe Groff ã®âã¯ãããã§ããïŒ
they also don't compose cleanly, they impose nesting where is desiredâyou have to pick between
Result<Async<T>>
andAsync<Result<T>>
, or buildResultT<AsyncT<Identity>><T>
out of monad transformersâand they don't do the natural thing when used with other higher-order abstractionsâif you're mapping athrows
function over a collection, you probably want to propagate that error likerethrows
does, not end up with a collection ofResult<T>
. I'd rather see us adopt an extensible algebraic effects system, something like http://www.eff-lang.org, which provides a framework forthrows
,async
and other control flow effects to be cleanly composed and abstracted over. I seethrows
as the first seed of that.
inamiy [2:30 PM] :point_up_2: ãåã«ã¡ãŒãªã³ã°ãªã¹ãã§èªãã§åãã人ã§ãïœ
koher [2:30 PM] ïœ
[2:31]
âã§è©±ããŠãã¿ããã« throws
ã async
ãã¢ããã«ãããã³ã°ããã«å°å
¥ããæ¹åŒãªãå
¥ãååé¡ãèµ·ãããªãã®ã§ãããããããªæ°ãããŠããŸããå
¥ãåã®å€ãšå
ãæ°ã«ããªããŠããçµã¿åãããªããã§ããã
[2:32] åã¯ããã»ã© Haskell ã䜿ã£ãããšã¯ãªããã§ããã Haskell ãšãã ãšãã®å ¥ãåã®é åºã¯ sequence ãšãã§åœç¶æäœãããã®ãšæããããŠããã§ããããïŒãããšããã£ãããªãã®ïŒ
omochimetaru [2:33 PM] inamiyããã®ã¹ã©ã€ããèªãã§ããéäžã§ããã() throws -> Tãã§ãŠãããã
koher [2:34 PM] ããããããå«ããŠæŽçãããŠãã
inamiy [2:34 PM] åã®ãã¹ãæ§é ãå«ããŠããã¡ããšå®çŸ©ããããšãæ¬åœã®æå³ã§ã®type safeã ãšæãã®ã§ã
[2:35] ãå ¥ãåã®å€ãšå ãæ°ã«ããªããŠããçµã¿åãããªãã ããããŠããŸããšãåå®å šãæŸæ£ããŠããããšã«ãªã£ãŠããŸãããªãšæããŸããä»ã®throwing funcã®ããã«
[2:37] ResultãªããflatMapErrorããããã®ããããtype safeãªèšèšã§ããããã«ã«ãžã¥ã¢ã«ã«æžããã ãã¹ããªãã®èšèš
koher [2:39 PM]
åçš®ã®ã¢ãããªãããã§ãããâã§è©±é¡ã«ãªã£ãŠã Result<Promise<Result<T>>>
ãšãèŸããªãã§ããïŒ
inamiy [2:40 PM] Swift 3ã¯ã«ãžã¥ã¢ã«ããç®æããŠãããšãããããã®ã§ãtype safetyã¯äºã®æ¬¡ãªã®ããªããšããå°è±¡ã§ãã
[2:40] Result<Promise<Result>> å šç¶ããã§ãïŒ
koher [2:41 PM] do èšæ³ããããã°èŸããªãã£ãŠããšã§ããïŒ Swift ã ãšèŸãã§ãããïŒ
tarunon [2:41 PM] throwing func ãšã async funcãèšèªä»æ§ã®é åã«æã£ãŠããããšã§ãåã®åé¡ããåãé¢ãããšããŠããããã«ãæãã
[2:42] ã¢ããã®ã¹ãããããã£é£ã°ããŠãçŽæ¥doèšæ³ã«æã£ãŠã£ãŠãæãã§ãããã
inamiy [2:42 PM] åçè«ã¯è©³ãããªãã§ããã©ããåã®ãã¹ãããšãåå®å šãã¯è¡šè£äžäœãããªãããšæããŸãã
koher [2:43 PM]
ãããã« Result<Promise<Result<T>>>
ãš Promise<Result<T>>
ã¯æå³ãç°ãªãã®ã§
omochimetaru [2:43 PM] Rustã®try!ãã¯ãå±éã¯ããã¥ã¡ã³ãèªãã ãšããã§ããšãªããŸãã
koher [2:43 PM] ãããå³å¯ã«åºå¥ãããå Žåã«ããããåºå¥ã§ãããšããã®ã¯éèŠãªã®ãããããŸãããã
[2:44] äžæ¹ã§æå³ã®ãªããã¹ãããããšæããã§ãããã
[2:44]
A|B|C
ãè¡šãããã ããªã®ã« Either<A, Either<B, C>>
ã Either<Either<A, B>, C>
ãæžãããšãã
[2:45]
ã¢ããã®ã¹ãããããã£é£ã°ããŠãçŽæ¥doèšæ³ã«æã£ãŠã£ãŠãæãã§ãããã ä»ã® Swift ã¯ãããªæãã§ãããã
[2:46] @inamiy ãããåã¯ãããã¢ãããšé¢é£ä»ããããšãèããŠãããã©ãä»ã®æ¹åæ§ã¯ @tarunon ããã®èšã
throwing func ãšã async funcãèšèªä»æ§ã®é åã«æã£ãŠããããšã§ãåã®åé¡ããåãé¢ãããšããŠããããã«ãæãã ã®ããã«èŠããŸãããã
inamiy [2:47 PM]
A|B|C`` ããã¯
|` ã®associativity/precedence次第ã§çæ¹ã«æ±ºãŸããŸããã
koher [2:48 PM]
ãããã£ãš A|B|C
㯠Ceylon ãšãã® Union type çãªæå³ã§ããã A|B|C == A|C|B
[2:48] ãããæå³ãããã ããªã®ã«è¡šçŸã®ä»æ¹ããããããã£ãŠããã®è¡šçŸã®èªç±åºŠã¯äžèŠãããªãããšãã話ã§ããã
inamiy [2:50 PM] Union type é¢çœããã§ãã
[2:50] ïŒãã ãA|B|C == A|C|B ã¯åçã«ã€ã³ãŒã«ã«æ¬æ¥ãªããªãæ°ãããŸããïŒ
koher [2:50 PM]
@inamiy: âã ãš Result<Promise<Result<Promise<Result<Foo>>>>>
ãåœç¶ã£ãŠæãã§ããïŒ
let foo = do {
let a = try âŠ
let b = await âŠ
let c = try âŠ
let d = try âŠ
let e = await âŠ
let f = try âŠ
Foo(a, b, c, d, e, f)
}
tarunon [2:50 PM] 錻氎åºãw
[2:51] ã³ã³ãã€ã©ã«åã£ãŠå¹žããªäžçã¯ãã©ã£ã¡ãªãã ãã
koher [2:51 PM]
Union type ã ãš A|A == A
, A|B|B|C == A|B|C
ã§ããã
inamiy [2:51 PM] åã¯æ·±ãïœ
[2:52] äžã®ã³ãŒãã¯ãå¿ èŠããã£ãŠããã®åã§type safeã«ããããªãããããæ¹åããªãšããæ°ãããŸã (edited)
koher [2:53 PM]
ãã ã 99% ã®ãŠãŒã¹ã±ãŒã¹ã§ã¯ Promise<Result<Foo>>
ãã»ããã ãã ãšæããã§ããããã»ã»ã»ã
tarunon [2:55 PM] awaitã«ãªã£ãŠèšèªä»æ§ã«çµã¿èŸŒãŸãããšããã§
[2:55] åå®å šã«ããã人ã¯ãããã©ããããPromiseäœã£ãŠäœ¿ãã ãã®ãããªæ°ããã
inamiy [2:55 PM]
Result<Promise<Result<Promise<Result<Foo>>>>>
ãã flattenã㊠Promise<Result<Foo>>
ãäœãããšã¯å¯èœãªã®ã§ããã®å€æããžãã¯ãèšèªå
ã§ã©ãå®çŸ©ãããã«ããããã§ãã ãã ã Result<Promise<Result<Foo>>>
ãäœãããå Žåããã£ãšããã
omochimetaru [2:56 PM] ãªãã»ã©
inamiy [2:57 PM] åã¯èšèªå ã§åæã«ãã®å€æåŠçãäœããã®ããžãã¯ã§ãã£ãŠããŸããããèªåã§å¥œããªããã«äœããã掟ã§ããã
yuta-t [3:00 PM] joined #discussion
omochimetaru [3:03 PM] swiftã ãšåç §ã«ãŠã³ã¿ãèšèªã«çµã¿èŸŒãŸããŠããã©ã C++ã ãšçããã¹ããïŒã«ãŠã³ã¿ããã€ã³ã¿åŽ/ã«ãŠã³ã¿ããªããžã§ã¯ãåŽ)ãšãæŠç¥ãéžã¹ãã®ãé£æ³ããŸãã
[3:04] ä»ã®éžæè¢ããããšãããåãæšãŠãŠèšèªä»æ§ã«ææ ŒããŠããéçšã§èšèªã®åæ§ãåºãŠããŸããã
[3:06] ãã¹ã±ã«ã®doæ§æã¯ãŠãŒã¶ããã®æ¡åŒµæ§ãæ®ã圢ã§ç¹æ®ã
inamiy [3:08 PM] ã§ãããSwiftã«Haskell doãããã°ãthrows / asyncèšæ³ãå®ã¯èŠããªããããããªãããšèããŠãŸãã
koher [3:09 PM] å®éããªã䌌ãŠãŸããããã
[3:10]
æ»ãå€ããªãã®ã¯ç°ãªããŸããã try
ã <-
ãšèªã¿æ¿ããã°ãšãŠããã䌌ãŠããŸãã
[3:10]
do
ã£ãŠããŒã¯ãŒãããã㊠Haskell ã«äŒŒããŠããæ°ãããŸãã (edited)
omochimetaru [3:12 PM] Effã£ãŠHaskellã®doãããçºå±ãããæ©èœãšããããã§ããã
[3:14] http://www.eff-lang.org/try/ Exampleã® Overview of syntax Printing to the standard output ã¯ç解ã§ãããã§ããã Non-Determinismãæå³äžæã§ããã
koher [3:14 PM]
Eff ã®è©³çŽ°ãããã£ãŠãªãããäœãèšããªããã©ããããã£ããŸã§è©±ããŠãã¿ãã㪠throws
ãš async
ããã©ããã«è§£æ±ºãããã ãšããã @inamiy ããã®èšã£ãŠãããã¹ãã«ããè¡šçŸåã¯å€±ãããŠããŸã£ãŠãããã
omochimetaru [3:14 PM] doã®äžã ãš<-ãflatMapã«å€æãããã£ãŠããæ©èœãããEffã®handlerã®ã»ããããã£ãšæè»ãªæ°ãããã
[3:17] @koher ããœã¯cpså€æã§ãå€æãããã¯ããŒãžã£èªäœã¯çŽ çŽãªå€æã£ãœããããEffèªäœãåæã«å朰ããšãããããã®ã¯ç¡ããã (edited)
koher [3:19 PM] @omochimetaru: ãããªã®ããä»åºŠ Eff å匷ããŠã¿ãŸãã
daybysay [3:47 PM] joined #discussion. Also, @kishikawakatsumi joined, @rizumita joined, @niwatako joined, @hoshi-takanori joined, @chocoyama joined, @hiroraba joined, @yashigani joined, @roworks joined along with some others.