I have a scala class taking implicit execution-context parameter, in play-framework based application. At runtime of this play application, is there a way to see list of implicits(along with names) used by a class? Appreciate any input.
Asked
Active
Viewed 185 times
0
-
1Hello and welcome to SO! Please read the [tour](https://stackoverflow.com/tour), and [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). Please also read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – Tomer Shetah Dec 13 '20 at 16:58
-
1Implicit scope is only a compile time concern – cchantep Dec 13 '20 at 22:44
-
https://stackoverflow.com/questions/64308467/is-there-anyway-in-scala-to-get-the-singleton-type-of-something-from-the-more https://stackoverflow.com/questions/59348301/in-scala-2-or-3-is-it-possible-to-debug-implicit-resolution-process-in-runtime – Dmytro Mitin Dec 14 '20 at 03:10
1 Answers
0
At runtime, you can summon an implicit via implicitly[T]
, e.g.
println(implicitly[ExecutionContext])
This probably won't give you the name that context has been bound to. As for a list, well, at runtime there's at most one instance of any given type in the implicit scope at a point in time (and the same is true at compile time for a given location in the code), so a list wouldn't be much value.

Levi Ramsey
- 18,884
- 1
- 16
- 30