Search code examples
c#.net.net-4.0dynamic-language-runtime

Call-site explanation?


scaning the internet , im having trouble understanding in a simple manner - the term call-site (@dlr). ive been reading here that CallSite is :

one site says

The location in which the method is called.

one book say :

call site . This is the sort of atom of the DLR - the smallest piece of codewhich can be considered as a single unit. One expression may contain a lot of call sites, but the behavioris built up in the natural way, evaluating one call site at a time. For the rest of the discussion, we'll onlyconsider a single call site at a time. It's going to be useful to have a small example of a call site to refer to,so here's a very simple one, where d is of course a variable of type dynamic

d.Foo(10); The call site is represented in code as a System.Runtime.CompilerServices.CallSite.

another book says :

the compiler emits code that eventually results in an expression tree that describes the operation, managed by a call site that the DLR will bind at runtime. The call site essentially acts as an intermediary between caller and callee.

sorry , I cant see where those 3 explanations are combining into one simple explanation.

i'll be happy to get a simple explanation :

HOw can I explain my wife -what are call-sites ?


Solution

  • The first explanation has nothing to do with the dlr or the dynamic type: simply speaking, a call site is a location (or site) in the source code where a method is called.

    In implementing the dynamic type, it is necessary to store information about the dynamic method calls contained in your code, so they can be invoked at runtime (the dlr needs to look up the method, resolve overloads, etc.). It seems natural that the object representing this information should also be called a ”call site”.