thrifty icon indicating copy to clipboard operation
thrifty copied to clipboard

Static state in SPI could lead to staleness issues

Open ZacSweers opened this issue 7 years ago • 5 comments

If you have a TypeProcessor that does stateful things, you could run into issues with that state remaining. Not sure if the static approach was intentional, but just mentioning.

ZacSweers avatar May 04 '17 00:05 ZacSweers

Very true! I never considered stateful processors.

What do you have in mind?

benjamin-bader avatar May 04 '17 17:05 benjamin-bader

It might be worthwhile to look at alternatives to the simple SPI model we've been using. Internally we've butted up against its limitations in a few ways:

  • not possible to have more than one processor, so the ones we use end up becoming quite complicated
  • the one-type-at-a-time model is nice for streaming, but in practice we often want to look at other generated type definitions at the same time.

Both problems are solvable, of course - just takes some thought beforehand.

benjamin-bader avatar Jun 03 '18 02:06 benjamin-bader

Selfpromotion, but could look at Crumb :)

ZacSweers avatar Jun 03 '18 03:06 ZacSweers

Also just saw your previous comment - what we do internally is processors are reused across modules (so we have a warm JIT cache. Buck build optimizations and whatnot). So when we invoke the lookup, we just look them up again for the current classpath

ZacSweers avatar Jun 03 '18 03:06 ZacSweers

(testing whether I still have maintainer access by closing an old issue and re-opening it. sorry zac)

benjamin-bader avatar Feb 09 '21 17:02 benjamin-bader