4 ms·
>Note that these are tactics for metaprogramming - the tactics are themselves for programming, not for use in programs. I don't understand what this is suppose
by ImprobableTruth 6y ago
>Note that these are tactics for metaprogramming - the tactics are themselves for programming, not for use in programs.
I don't understand what this is supposed to mean. How are e.g. coq tactics not the exact same?
>The commands to the LSP tell it how to generate the code, and the code sticks around for editing afterwards.
Not having the metaprogram which generated the code around just strikes me more as an anti-feature.
>What is "normal" metaprogramming?
Arbitrary, "non-sequential" code transformations.
>The particular benefit of using tactics would be that they're designed for small steps of in-flight editing, rather than generating something all at once
Well, for me tactics definitely invokes more serious proof automation than just what you could also do using Agda's emacs commands. This is also the impression I get from the article, the image presented uses some form of auto tactic to generate an entire term in one go. Certainly not what I'd call "small steps of in-flight editing".
- remexre 6y ago> I don't understand what this is supposed to mean. How are e.g. coq tactics not the exact same? Well, I've never gotten `induction' to generate anything close to a readable program -- hopefully this is better?
- ImprobableTruth 6y agoI'm not sure what you mean? The induction tactic uses the induction principle (dependent eliminator) of the corresponding type. If you unfold the dependent eliminator, it boils down to a combination of fix and match. I don't see how you could get a term simpler than that, unless you mean something else by readable?
- remexre 6y agoIIRC, the match it generates often ends up being a dependent match using the convoy pattern once nontrivial functions start being written, which quickly gets really really hard to read. Maybe this is partly the fault of Coq's matching requiring the convoy pattern (unlike Agda's or Idris's), but I find it extremely difficult to read these terms, versus hand-written ones.
- ivanbakel 6y ago>I don't understand what this is supposed to mean. How are e.g. coq tactics not the exact same? Coq tactics are code - you write terms using tactics, and you edit the term by editing the tactics. Save and load the file, and only the tactics stick around. In this version, tactics write code - you use tactics to generate a term (Haskell code), and then you can edit the term itself. Save and load the file, and all you get is the Haskell code: the tactics only existed for codegen. >Not having the metaprogram which generated the code around just strikes me more as an anti-feature. Why? The trouble with metaprogramming is that you basically never want to have the power to simultaneously edit the program and the metaprogram. As you yourself pointed out, tactics would be terrible as an opaque metaprogram - they only work if you don't care about the particular term they generate. Tactic metaprogramming lets you write terms quickly - it fulfills a need that lots of Haskell programmers have, which is that certain type signatures have "obvious" inhabitants and actually expressing those inhabitants can itself feel like a lot of boilerplate. But since you need to edit the Haskell code itself, the metaprogram must disappear. You won't miss it, since you won't need to regenerate the program from the metaprogram. >the image presented uses some form of auto tactic to generate an entire term in one go Because it's built out of several tactic steps, which the article goes into the construction of. You could still (presumably) have built it piece by piece, by applying each tactic one at a time - and each step only modifies the term slightly, leaving a hole for later steps.
- ImprobableTruth 6y ago>In this version, tactics write code - you use tactics to generate a term (Haskell code), and then you can edit the term itself. Save and load the file, and all you get is the Haskell code: the tactics only existed for codegen. There's nothing preventing you from already doing this. You can use Isabelle's hammer/CoqHammer to generate a proof, dump the proof term and then replace your usage of the hammer tactic with the term. It's just, why would you want to edit the proof term manually? I'm pretty sure you can do this with Haskell's normal metaprogramming facilities too, it's just really not the intended way. >Why? Because it's a lot harder to maintain. Not only do you lose out on information about the generation (Why/How was it generated?), if you change the code it was generated from, you'll have to either manually edit the generated code (especially troublesome because the information of how it was generated was thrown away!) or you'll have to figure out how to do it using tactics again (in that case, why not just keep the tactics as documentation?). >As you yourself pointed out, tactics would be terrible as an opaque metaprogram - they only work if you don't care about the particular term they generate. Tactics aren't 'opaque', it's just a pain to manually look at the generated code and I don't see how the same doesn't apply here. >Because it's built out of several tactic steps, which the article goes into the construction of. You could still (presumably) have built it piece by piece, by applying each tactic one at a time - and each step only modifies the term slightly, leaving a hole for later steps. You could, but it seems pretty clear to me that this is not the intention. If you just want some form of 'quick actions' you don't need a tactics system. Having an option to 'try filling this hole' heavily indicates that this is to be used for more heavy automation.