I thought I’d try out
Core_kernel, but those extras aren’t relevant here). In the process of porting my small codebase, I encountered labels for the first time, and perhaps some of their pitfalls. e.g.:
─( 11:48:57 )─< command 0 >─────────────────────────── utop # open Base;; ─( 11:48:57 )─< command 1 >─────────────────────────── utop # let x = List.fold [1;2;3] 0 (+);; val x : init:(int -> (int -> int -> int) -> '_weak1) -> f:((int -> (int -> int -> int) -> '_weak1) -> int -> int -> (int -> int -> int) -> '_weak1) -> '_weak1 = <fun>
I’m now aware that fully labeling the arguments there will yield the desired behaviour (
List.fold [1;2;3] ~init:0 ~f:(+)), and I’ve read some on why this apparently total function call actually isn’t.
Based on my hour-long experience adding labels everywhere and eliminating many uses of
|>, I’m not particularly keen on them, at least as an unavoidable part of a standard library replacement.
However, I’m willing to be persuaded that there are benefits I’m not seeing yet (obviously, a lot of people use Base/Core/etc), so I thought I’d ask: how does the use of labels work out in practice given the above?