Collision probability computation for conjunction assessment
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-merlin: E351 only flags top-level mutable values, not function types

E351 ("Exposed Global Mutable State") was firing on any [val] whose typed
signature contained [Stdlib.array] or [Stdlib.ref] anywhere — including as
a function argument or return type. The rule's intent is "no top-level
mutable singleton in the interface", which only applies to non-function
[val x : <mutable>] declarations; functions that take or return mutable
values are fine because the caller controls the cell, not the module.

Fix: [find_outer_type_constr] in ocaml-merlin's [Dump] now returns [None]
when it sees [Ttyp_arrow] / [Ptyp_arrow] before any [Type_constr],
matching its docstring ("Returns [None] if the next interesting token
isn't a [Type_constr]"). Add three regression cases to good.mli covering
[arr -> int], [int -> arr], and [int ref -> unit].

Also rename [Collision.tca] (the type) to [closest_approach] so it no
longer shadows the function name [Collision.tca]. Public API unchanged
beyond the type name; downstream callers refer only to the function.

+7 -3
+5 -1
lib/collision.ml
··· 392 392 393 393 (* {1 TCA refinement} *) 394 394 395 - type tca = { time : float; miss_distance : float; relative_velocity : float } 395 + type closest_approach = { 396 + time : float; 397 + miss_distance : float; 398 + relative_velocity : float; 399 + } 396 400 397 401 let tca_at_index times vel1 vel2 i d2 = 398 402 let d = sqrt d2 in
+2 -2
lib/collision.mli
··· 55 55 56 56 (** {1 TCA refinement} *) 57 57 58 - type tca = { 58 + type closest_approach = { 59 59 time : float; (** Time of closest approach (Unix timestamp). *) 60 60 miss_distance : float; (** Miss distance at TCA (km). *) 61 61 relative_velocity : float; (** Relative velocity at TCA (km/s). *) ··· 70 70 pos2:vec3 array -> 71 71 vel1:vec3 array -> 72 72 vel2:vec3 array -> 73 - tca option 73 + closest_approach option 74 74 (** [tca ~times ~pos1 ~pos2 ~vel1 ~vel2] finds the time of closest approach 75 75 between two objects using quadratic refinement. Arrays must be the same 76 76 length (synchronized time steps). Returns [None] if fewer than 3 points. *)