← Back to context

Comment by the_mitsuhiko

5 days ago

> If you use context.Context for this you give up a lot of type safety and generally make your data passing opaque.

The data passing maybe, not sure how you lose type safety. The value comes from the context with the right type just fine. The stuff that I'm attaching to the context are effectively globals just that this way you can enable proper isolation in tests and else.

From my limited experience with echo, the context there is not at all the same thing.

Context.Value's signature is Value(any) any - you have to use type conversion or reflection to determine the value's type at runtime, instead of a compile-time check.