tuxbear tuxbear

Niner since 2006

Norwegian Computer Science Student


  • Expert to Expert - Joe Duffy: Perspectives on Concurrent Programming and Parallelism

    I second Cyonix. I just ordered Joe's book Smiley
  • Inside C# 4.0: dynamic typing, optional parameters, covariance and ​contravaria​nce

    In the example for overload resolution this example was given:

    M( int x, int y);
    M( string x, sting y);

    Then it was explained how the resoulution worked. It was said that the very first thing to be checked is if all the names are in the method's parameters. I found it strange that it does not do a simple argument type check before matching names in the paramters list. If you know you are getting two integers in the call, you know that the overload must accept at least two integers.
    So if you have:

    M( int x = 0, int y = 22, int z = 10, string text = "no");
    M( string x = "20", sting y = "90", int data = 200 );

    Suppose I  call M( y = 300, x = 200); The complier knows that I am giving the M two ints. If I now was to "check if all the names are there", that would yield both Ms. On the other hand by simply counting the number of parameters of each type in the call and comparing the counts with the overloads you will find the right one. There is only one M that accepts two ints or more. This will enables you to discard all overloads that does not have any chance at matching the signature, and focus on the ones that does in the later steps that involves name matching etc.

    I may just be plain wrong, and this may be inefficent for reasons I don't know. Maybe this even happens behind the scenes and just wasn't metioned in the interview. Just my thoughts after watching Smiley

    Great stuff btw Smiley
  • Expert to Expert: Erik Meijer and Jeffrey Snover - Inside PowerShell

    I have two more bug-reports for you:

    1. The powershell window won't resize like a normal window. The stone-aged buffer-aproach is a bug in 2008.
    2. If I pipe some long output to the more function, and want to see the output line by line,, it clutters the output with it's own promt for every line. That would have been a bug 50 years ago Wink

    The best would be if these bugs could be worked around, or that I simply har missed something to make these things work Smiley
  • Expert to Expert: Erik Meijer and Jeffrey Snover - Inside PowerShell