Thanks for the proposal! I am honestly a bit torn. The current implementation is definitely more idiomatic and while there is a cost associated with it, the cost is extremely low. :) I am worried making it a macro will signal to developers they need to worry about these kinds of low-level optimizations, which is not generally true!
On Thu, Jan 14, 2021 at 12:59 AM [email protected] <[email protected]> wrote: > Hi all! > > I saw the recent additions of tap/2 and then/2 to the Kernel and I was > wondering, would it make sense to make them macros rather than functions? > > Since this is pure syntactic sugar for control flow, like `if` or the pipe > operator itself, I thought it could be nice to just generate the desired > AST instead of adding the runtime overhead of a function call. > But maybe I missed some implication of such a change, and a function is > better in this case? > > I created a branch to try it out, for the discussion: > https://github.com/elixir-lang/elixir/compare/master...sabiwara:macro_tap_then?expand=1 > > Looking forward to hearing your thoughts! > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/39ffaaed-e880-4ead-87a9-83a210639969n%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/39ffaaed-e880-4ead-87a9-83a210639969n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LL--xxD%2BaUtcH%2BkfJgHjhVCwe%3DL_yJmesBiCX69zoiOA%40mail.gmail.com.
