Question

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 ?

Was it helpful?

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”.

OTHER TIPS

Ok this is how I see it.

For this example call is simply like a method or function that executes some code and returns.

For a static language runtime program (C, or CLR etc) a call site is essentially where a function call takes place. It's the location that the call will return to in a normal (non exceptional) flow. Since this is a static program the call site is simply a memory location, pushed on the stack.

For a dynamic language program (Ruby, Python, etc) , the code you are calling is not worked out until runtime. This means that some form of logic is needed to manage the process of making the correct function call and then cleaning up after the call (if needed). If the dynamic language program is on .NET 4 this is done using dlr (dynamic language runtime) objects of type System.Runtime.CompilerServices.CallSite. So the call will return to a method within the CallSite object and then on to location of the original call.

So the answer is that it depends upon how you doing the call and thus what platform you are using.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top