No NDA on PDC bits

PDC '03 Comments

Robert Scoble says:

NDA-centric culture. There are no NDAs at the PDC over the PDC content. Enough said. But, we still are far too NDA-oriented. So, I'll give us a "B" on that score. Improvement still needed.

AFAIK the first time Microsoft gives away early bits without any NDA OMG

Where are const parameters?

Development Comments

I'm programming in C# for about 18 month by now, and I really like it. However, what I'm missing about C# are constant parameters.

In C++ you can declare parameters as const, so the called method cannot change it. It's kind of a contract. If the method signature says, a parameter is constant, it won't change it.

AFAIK that's not possible in C#. Whenever you call a method with a parameter which is a reference-type, that method is capable to change it.

One possible solution is shown in following sample:

public interface IFoo
    int Param {get; }

public class Foo : IFoo
    private int param;
    public int Param
        get { return param; }
        set { param = value; }

public class MainClass
    private static void Bar(IFoo foo)
        foo.Param = 42;
    public static void Main()
        Foo foo = new Foo();

Our object we want to forward to our method as const is of type Foo. However, this class implements the IFoo interface. This interface just defines getter functions, so it is somewhat read-only. The method Bar just takes a parameter of the interface type. Therefore, it is not able to change the concrete Foo object.

Aynway, forget what I've said. That's just a nasty work-around. I don't want to implement a special interface for each of my classes soleley because I need a const parameter. Do you?

Finally, I will return to the opening question: Why does C# do not support const parameters? I hope Brad Abrams or someone else will read and answer this question. (BTW, does the MSIL? At least it supports default parameters, which C# doesn't)

Moving this site

Site news Comments

I know I'm a geek. These pages are hosted on my server at home. It's a recycled Athlon XP 1800+ running Windows Server 2003 incl IIS 6.0, MS SQL 2000 and MS Exchange 2003. It's connected via T-DSL (768/128 KBit/s).

Though this is a geekish set-up, I'm thinking about changed that for several reasons:

  1. Economics Because this machine is hosting my pages and running the mail server, it is running 24/7. How much am I at home at my machine? Well, about 3 hours in average. Plus it's a machine I cannot use for anything else.
  2. Noise The server is the loudest of all my machines. Of course I could tweak it by exchanging the fans etc, but I'm too lazy... Blushing
  3. My girl friend needs a PC She moved in two month ago, and she only has my old Celeron w/400 MHz I gave her some time ago. SHe needs her own machine, but since she just started in her job, she doesn't have the money.
  4. Bandwidth While 768KBit/s downstream is fully sufficient for browsing and downloading some MSDN packages every now and then, 128KBit/s upstream is quite restrictive for serving pages.

Therefore, I decided to move my site to a dedicated hosting service. I've already chosen WebHost4Life cause of the many credits I've read about them. However, what is left is a decent domain name... Expressionless