Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by haiku2077

5 days ago

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.

2 comments

haiku2077

Reply

the_mitsuhiko  5 days ago

But I have methods such as MustRateLimiterFromContext(ctx) which returns the right type :)

  • haiku2077  5 days ago

    By crashing your program at runtime if any wrong type is added!

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities