You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the file os_db.ml, there is this chunk of code:
let transaction_block db f =
Lwt_PGOCaml.begin_work db >>= fun _ ->
try_lwt
lwt r = f () in (*****A*****)
lwt () = Lwt_PGOCaml.commit db in
Lwt.return r
with e ->
lwt () = Lwt_PGOCaml.rollback db in
Lwt.fail e
let full_transaction_block f = (*****B*****)
Lwt_pool.use !pool (fun db -> transaction_block db (fun () -> f db)) (*****C*****)
I'm little confused, why the f at B gets wrapped to a fun () -> f db at C and passed to A?, couldn’t we just pass f at C and replace A with let r = f db?
If it's just careless writing, I think it should be corrected, it confuses beginners such as me and prevents refactoring (you know, those cases you think a chunk of code is useless, but you don't have the gut to remove them).
The text was updated successfully, but these errors were encountered:
In the file os_db.ml, there is this chunk of code:
I'm little confused, why the
f
at B gets wrapped to afun () -> f db
at C and passed to A?, couldn’t we just passf
at C and replace A withlet r = f db
?If it's just careless writing, I think it should be corrected, it confuses beginners such as me and prevents refactoring (you know, those cases you think a chunk of code is useless, but you don't have the gut to remove them).
The text was updated successfully, but these errors were encountered: