Talk

Fun with type erasure + dispatching data from abstract structure to function parameters

  • In Russian
Presentation https

Sometimes we want some kind of magic that would call the appropriate handler for a request, and put appropriate request fields into function parameters, e.g.:

{
  "request": "baz",
  "count": 1,
  "id": "two",
  "payload": { "three": 3 }
}

public class Program
{
  public static void foo()
  { }
  public static void bar([Name("count")] int i)
  { }
  public static void baz([Name("count")] int i,
                         [Name("id")] string s,
                         [Name("payload")] JsonElement p)
  { }
} 

We want this magic more when the number of handlers with many parameters grows significantly.

In this talk, we will concentrate on type erasure to make a convenient and user-friendly way of organizing request handlers.
We will examine several approaches, their profit, how we can make it better, and what else we can do with it. Warning: there will be a lot of code.

  • #rest
  • #templates
  • #type_erasure

Speakers

Invited experts

Talks