From 96e5fab77f20d12c3c160646092eeb4ddc489152 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Thu, 17 Sep 2026 22:12:54 +0700 Subject: [PATCH] flan run does not offer --dev, and says so rather than building one --dev builds a program whose call sites go through indirection cells so something can attach and redefine through them. Nothing can attach to a process this command builds, execs, waits for and deletes, so the flag had no meaning here -- and an --x86 --dev route through run would have falsified Build's own statement that flan dev never reaches that fork because --x86 is read only by flan build. It falls into the refusal arm with a sentence instead. --- bin/main.ml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/main.ml b/bin/main.ml index 5801d72..4f8455c 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -704,8 +704,18 @@ let () = one's own that wants [-v] has [--] to ask for it. Plain arguments need no ceremony: they were never ambiguous and they still go straight through, so [flan run calc-me.flan "1+2"] is unchanged. *) - let run_flags = [ no_checks_flag; dev_flag; debug_flag; sanitize_flag; - x86_flag ] @ opt_levels in + (* --dev is deliberately not on this list, and its absence is the point: + a dev build's indirection cells exist so that something can attach and + redefine through them, and nothing can attach to a process this command + builds, execs, waits for and deletes. Leaving it off means it lands in + the refusal below with a sentence, rather than quietly producing a + spelling [Build] says does not exist — [flan build]'s --x86 arm records + that `flan dev` never reaches its fork because --x86 is read only by + [flan build], and an --x86 --dev route through here would have made that + sentence false. *) + let run_flags = + [ no_checks_flag; debug_flag; sanitize_flag; x86_flag ] @ opt_levels + in let build_args, prog_args = let rec split acc = function | "--" :: rest -> (List.rev acc, rest) @@ -727,7 +737,6 @@ let () = split [] args in let checks = not (List.mem no_checks_flag build_args) in - let dev = List.mem dev_flag build_args in let debug = List.mem debug_flag build_args in let sanitize = List.mem sanitize_flag build_args in let x86 = List.mem x86_flag build_args in @@ -740,9 +749,9 @@ let () = in let l = load path in let p = Flan.Check.program_all l.decls in - let p, csrcs, lflags = Flan.Reach.link ~dev l p in + let p, csrcs, lflags = Flan.Reach.link l p in ignore (Flan.Build.executable - ~opts:{ Flan.Build.default with checks; dev; debug; sanitize; + ~opts:{ Flan.Build.default with checks; debug; sanitize; x86; opt = Option.value opt ~default:Flan.Build.default.Flan.Build.opt }