New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds missing functions to *Labels modules #875
Conversation
In principle I agree that keeping the *Labels module on par is a good thing. Now the nitpicking details. Would we want to have labels on some of the several-arguments function? Here are some potential ideas (but I'm not saying they should absolutely be applied):
|
Thank you very much for these additions. I agree with @gasche on the labelling of |
2bb1ea8
to
8e8e6b1
Compare
@gasche, @garrigue I've added labels to these two functions. By the way, I couldn't find any tests checking compatibility of labeled and non-labeled modules. We could miss to add new functions again in the future without them. Should we add tests for that? The easiest way I could think of would be comparing |
It should be easy with a |
module L : module type of List = ListLabels for each module, compiled with |
8e8e6b1
to
ff47da8
Compare
@Drup great! used your idea to add simple tests. |
include module type of Hashtbl | ||
with type statistics := Indirection.t | ||
end | ||
module H : HS = MoreLabels.Hashtbl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module type of struct include Hashtbl end
if you want to preserve type equalities. Not sure if that's going to be enough since the fields are not re-exported in MoreLabels.Hashtbl
... but they probably should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried this, same error ...Their kinds differ.
.
@damiendoligez do we want this in 4.04? I'm ready to release a new version of Batteries with 4.04 compatibility, but if we decide to take this one in I would wait for it first. |
I'm against changing the stdlib a few hours/days before a release. People are supposed to start adapting their libraries when we issue release candidates, and if we start changing things (which can break code in the wild) after release candidates and just before the release, it will reduce people's incentive to play with release candidates in the future. (Of course, this is a bit rhetorical here, since you are also a maintainer of Batteries.) Not being able to use the most recent additions of stdlib in the *Labels versions is certainly not a critical bug that cannot wait until the next release (which should be out in about 3 months, right?). |
I think that's a fair argument. |
What? |
I thought 4.05 should be frozen in January 2017. So it would be a bit more than 3 months for the release, but hopefully not much more (I know, I'm dreaming...). |
February, so it'll be frozen, not out, in 3 months. |
Please Damien let me dream a bit about the delay between freeze and release going down at some point... |
Coming back to the topic of this PR. Would it be a good opportunity to change the doc strings in *Labels modules to refer to the real module names? (e.g. refer to [EDIT] I see that these modules are supposed to be used through |
ff47da8
to
7e71523
Compare
This fix make it possible to use labeled modules as drop-in replacement with `open StdLabels`. Added signatures: ```ocaml (* arrayLabels.mli *) val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array (* bytesLabels.mli *) val extend : bytes -> left:int -> right:int -> bytes val blit_string : val cat : bytes -> bytes -> bytes val uppercase_ascii : bytes -> bytes val lowercase_ascii : bytes -> bytes val capitalize_ascii : bytes -> bytes val uncapitalize_ascii : bytes -> bytes val equal: t -> t -> bool (* listLabels.mli *) val compare_lengths : 'a list -> 'b list -> int val compare_length_with : 'a list -> len:int -> int val cons : 'a -> 'a list -> 'a list (* moreLabels.Hashtbl *) val is_randomized : unit -> bool (* stringLabels.mli *) val uppercase_ascii : string -> string val lowercase_ascii : string -> string val capitalize_ascii : string -> string val uncapitalize_ascii : string -> string val equal: t -> t -> bool val split_on_char: sep:char -> string -> string list ```
7e71523
to
c59f49a
Compare
As per @alainfrisch suggestions, fixed all docs and deprecation warnings in *Labels. |
Is everything OK with this patch now, or there are some other suggestions to improve it? |
Thanks for the reminder and the nice contribution. |
This fix makes it possible to use labeled modules as drop-in replacement with `open StdLabels`. Added signatures: ```ocaml (* arrayLabels.mli *) val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array (* bytesLabels.mli *) val extend : bytes -> left:int -> right:int -> bytes val blit_string : val cat : bytes -> bytes -> bytes val uppercase_ascii : bytes -> bytes val lowercase_ascii : bytes -> bytes val capitalize_ascii : bytes -> bytes val uncapitalize_ascii : bytes -> bytes val equal: t -> t -> bool (* listLabels.mli *) val compare_lengths : 'a list -> 'b list -> int val compare_length_with : 'a list -> len:int -> int val cons : 'a -> 'a list -> 'a list (* moreLabels.Hashtbl *) val is_randomized : unit -> bool (* stringLabels.mli *) val uppercase_ascii : string -> string val lowercase_ascii : string -> string val capitalize_ascii : string -> string val uncapitalize_ascii : string -> string val equal: t -> t -> bool val split_on_char: sep:char -> string -> string list ```
* Add link to API in /releases * Use same wording as in docs navbar --------- Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
This fix make it possible to use labeled modules as drop-in replacement with
open StdLabels
.Added signatures: