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
I'm curious about it. We have to add Ppx_deriving_json_runtime.Primitives for every usage; can we have it internally?
Like (Code just as a sample, not tested or something):
let is_primitive = (* ... *)
let prefix = if (is_primitive) then ("Ppx_deriving_json_runtime.Primitives." ^ prefix) else prefix
let gen_name n = sprintf "%s_%s" prefix n in
Is it to avoid depending on Ppx_deriving_json_runtime.Primitives name, as it can break if the name changes?
What is the motivation?
The text was updated successfully, but these errors were encountered:
pedrobslisboa
changed the title
Can have Ppx_deriving_json_runtime.Primitives working in
Can have Ppx_deriving_json_runtime.Primitives working internally?
Sep 19, 2024
The only reason I can think of not doing this is to override the primitives such as string/int/..., so I propose to make things rare a bit harder for those use-cases and provide a section on the docs explaining how to do it:
module Ppx_deriving_json_runtime = struct
include Ppx_deriving_json_runtime
module Primitives = struct
include Ppx_deriving_json_runtime.Primitives
let string = (* ... *)
end
end
and keep the inlining inside the ppx, as @pedrobslisboa suggests.
I don't think this is a good idea for the reasons stated in the linked ppx_deriving_router issue. Better to stay consistent. If the local open in a module is too annoying, or needs to be spread in multiple modules, can always add -open ... arguments via dune's (flags ...) stanza.
Description
I'm curious about it. We have to add
Ppx_deriving_json_runtime.Primitives
for every usage; can we have it internally?Like (Code just as a sample, not tested or something):
Is it to avoid depending on
Ppx_deriving_json_runtime.Primitives
name, as it can break if the name changes?What is the motivation?
The text was updated successfully, but these errors were encountered: