What does (promote (until-clean)) mean?

Quoting Stanza Reference — Dune documentation

are the same as for the rule promote mode. Adding (promote (until-clean)) to an executable stanza will cause Dune to copy the .exe files to the source tree and use dune clean to delete them.

I get it is useful from copying from _build/… to the main directory. What I don’t get is: what does (until-clean) mean ?

See the modes section.

  • (until-clean) means that dune clean will remove the promoted files from the source tree.

Sorry for being pedantic, but this makes about as much sense as (dune (ninja-turtle)) to me right now. Here are the things that do not make sense:

  1. until X, generally means to me while !X { ... }; there’s no such loop / iteration going on here right ?

  2. For make clean, we generally have something of the form:

.PHONY: clean
clean:
  rm ...

There’s also none of that going on here right?

  1. Instead, from the docs you linked, it sounds like (until-clean) means the following:

  2. dune auto defines a command clean

  3. the current target file is added to the list of files dune clean removes ?

===

What does the ‘until’ here mean ?

Not to be pedantic, would it be more intuitive if it was named (promote (hook remove-on-clean)) :slight_smile: ?

I think you basically understood it. What do you think of calling that mode (promote (cleanable))?

I’m not sure, but I think (promote (until-clean)) is not instructive, as I want to parse it as “promote until clean” or while !clean { promote }, which is completely wrong.

Oh, I think I get it now.

The way I should read it:

PROMOTE this file UNTIL CLEAN is called

I.e.if we view it from the perspective of the lifetime of the file, it gets PROMOTED … and stays alive … UNTIL … some future point, when we call CLEAN … and then it gets deleted

Sounds like the naming is fine, and I’m just reading it poorly.

I think it’s a valid misunderstanding, at first glance it does look like an instruction that would cause a loop.