Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: tactic vs option


Damiano Testa (Jun 13 2022 at 04:44):

Dear All,

Sometimes, I have the choice of making a meta def with values in tactic _ or in option _. I have an instinctive preference for option.

Are there reasons for preferring tactic instead? Or to prefer it systematically?

Thanks!

Eric Wieser (Jun 13 2022 at 11:09):

If you use tactic you can set an error message

Eric Wieser (Jun 13 2022 at 11:09):

Usually your hand is forced by needing to call an API that is itself a tactic _

Damiano Testa (Jun 13 2022 at 15:25):

Eric Wieser said:

If you use tactic you can set an error message

Thanks, Eric! Yes, I am slowly understanding how to use errors more extensively and it helps in making changes to the tactic.

Eric Wieser said:

Usually your hand is forced by needing to call an API that is itself a tactic _

Yes, it is not often that I have the choice. Maybe this is the reason why, when I can, then I feel that I should take advantage of it! :smile:

Yakov Pechersky (Jun 13 2022 at 23:55):

But as soon as you make something tactic, that means anything that uses it needs the be at least as powerful as tactic itself.

Damiano Testa (Jun 14 2022 at 09:22):

While we are in this discussion, is there any speed optimization that is achieved by using or avoiding tactic? My instinct says that it might be slower to go via tactic, but maybe I am wrong and maybe it is largely irrelevant. :shrug:

Eric Wieser (Jun 14 2022 at 09:36):

I would assume it's largely irrelevant


Last updated: Dec 20 2023 at 11:08 UTC