[PATCH] D69625: [libTooling] Support implicit coercions in Stencil's `access` combinator.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 18:52:57 PDT 2019


ymandel added a comment.

In D69625#1729634 <https://reviews.llvm.org/D69625#1729634>, @gribozavr2 wrote:

> I fully agree about passing a Stencil to `access`. However whether to call `makeStencil` inside is an interesting question. On one hand, such implicit conversions increase the convenience. On the other, they increase the API surface (more possible argument types), and makes the API harder to read. What does `access` take? "I don't know, some T" vs. "A Stencil".
>
> I think that implicit conversions for `cat` arguments can be justified because it seems like `cat` will be used frequently; however, `access` won't be as frequently called.
>
> What do you think?


This seems reasonable, particularly the problem caused by using a template. I'd consider having three explicit overloads, but this doesn't scale in general (especially once you have a combinator with 2+ Stencil args).

Which idiom do you think we should encourage, then, for text and range-selectors -- the named combinator or the single-argument `cat`? That is

  access("object", text("field"))
  access("object", selection(member("e")))

versus

  access("object", cat("field"))
  access("object", cat(member("e")))


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69625/new/

https://reviews.llvm.org/D69625





More information about the cfe-commits mailing list