Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Decoupling dependencies and unholy tie-ups</strong> is one singular thing that makes it great. Everything else one can debate and claim to be doable in some home-grown way.</p> <p>I've been refactoring slightly more complex system with an old and heavy lib and got blocked on not being able to break compile time dependency - because of the named delegate lurking on "the other side". All assembly loading and reflection didn't help - compiler would refuse to just cast a delegate() {...} to object and whatever you do to pacify it would fail on the other side.</p> <p><strong>Delegate type comparison which is structural at compile time turns nominal after that</strong> (loading, invoking). That may seem OK while you are thinking in terms of "my darling lib is going to be used forever and by everyone" but it doesn't scale to even slightly more complex systems. Fun&lt;> templates bring a degree of structural equivalence back into the world of nominal typing . That's the aspect you can't achieve by rolling out your own.</p> <p>Example - converting:</p> <pre><code>class Session ( public delegate string CleanBody(); // tying you up and you don't see it :-) public static void Execute(string name, string q, CleanBody body) ... </code></pre> <p>to:</p> <pre><code> public static void Execute(string name, string q, Func&lt;string&gt; body) </code></pre> <p>Allows completely independent code to do reflection invocation like:</p> <pre><code>Type type = Type.GetType("Bla.Session, FooSessionDll", true); MethodInfo methodInfo = type.GetMethod("Execute"); Func&lt;string&gt; d = delegate() { .....} // see Ma - no tie-ups :-) Object [] params = { "foo", "bar", d}; methodInfo.Invoke("Trial Execution :-)", params); </code></pre> <p>Existing code doesn't notice the difference, new code doesn't get dependence - peace on Earth :-)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload