Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Channel Live at BUILD: Q&A with Anders Hejlsberg

Download

Right click “Save as…”

Anders Hejlsberg takes questions from #Ch9Live at the BUILD conference.

Follow the Discussion

  • Thats me thats me! i'm live on tv! Well.. At least my twitter profile in the background..

  • JedrekJedrek

    Let's say that I have 1 000 000 definitions of the same function f in the form of strings

    (e.g. deffun[0]= "int f(int x){return 1*x*x};",
    deffun[1]= "int f(int x){return 2*x*x};",
    deffun[2]= "int f(int x){return 3*x*x};" etc.)

    then I would like to dynamically test all these definitions

    ScriptEngine engine = new ScriptEngine();
    Session session = Session.Create();
    for(int i=0;i<1 000 000;i++)
    {
    engine.Execute("using System;");
    engine.Execute( deffun[i] , session );
    engine.Execute("Console.WriteLine( f(2) )",session);
    }

    Is it possible to run this code?
    I suspect no but if yes then what will happen
    to the size of the program?

    Is it possible to redefine the function at runtime?

    I am using 1 000 000 different definitions of the function f.
    Is the memory released after the new definition of f was applied?

    If I solve that problem by using dynamic compilation, then as far as I know, I can compile 1000 000 definitions of the function f, then I can call that function by using reflection but the assembly which contain the definition of the function will stay in the program and it cannot be unloaded. Then after I will do that 1000 000 times the program will be much bigger than the original and there is no way (except unload appdomain) to reduce the size of the program.

    Do I have similar problems in the "Roslin" compiler? What will happen to the size of the program if I compile 1000 000 definitions of the same function (if that is possible ... maybe I need to rewrite the code)?

    Let's say that I would like to write some command line app which compile dynamically c# code and test it. If the memory is not released, then the application will crash due to the lack of system resources after some time (Am I right?).

  • Richard Anthony HeinRichard.Hein Stay on Target

    @Jedrek: "Is it possible to redefine the function at runtime?"

    With CLR re-JITing, I think so.

     

  • JedrekJedrek

    @Richard.Hein: Thnk you very much for your answer. However according to this presentation

    http://channel9.msdn.com/Shows/Going+Deep/CLR-45-David-Broman-Inside-Re-JIT

    old definition of the function will stay in the memory. So after I will do that 1000 000 times that may be a problem. So writing some testing program for c# code in this way may not be not very practical.

  • Richard Anthony HeinRichard.Hein Stay on Target

    @Jedrek:  I see.  Thanks.

  • Mikael NMikael N

    The guy interviewing Anders is really bothering me. He looks like he wants to be somewhere Else, and he doesnt even listen to Anders answers.

    Did not watch the whole video because of that guy!

  • CharlesCharles Welcome Change

    @Mikael N: Not really the case, though I can see how you've come this conclusion... As a moderator, or host or anchor, for a live broadcast there are always at least 3 things to keep track of simultaneously... These aren't interviews like I do with my camera. These are first and foremost for YOU the audience to ask questions over twitter and drive the conversation - otherwise doing this stuff is pointless. It's live for a reason. In my defense, I have to monitor the questions coming in on the monitor you can't see. That takes focus. I have somebody occasionally talking in the earpiece you may or may not have noticed and further and of course I have to carry a conversation with the guest.

    It's hard being an anchor or host in a live broadcast environment. You should try it sometime...

    I absolutely wanted to be there. It's great to talk to Anders (and with all the guests I host on C9 Live). This C9 Live broadcast - at BUILD - was the hardest one yet for some reason. Not sure what was so distracting or different than usual, but it was.

    C

  • It would help me if the language had a "factory" facility. Where you have a hierarchical structure of abstract base classes and derived classes. I write a static method in each derived class that is used to determine if the derived class is the one to be newed up from the input. And then a 2nd static method that actually news up the object.  The hassle comes in having to write the code that iterates thru the collection of classes, calling the static "Is this the class to new up" method. And then calling the static "create yourself" method.  I use reflection  for this. Which is OK. But a language feature would be nice.

     

  • I don't follow how having a feature in C# where an event is signalled or a method is called when a property is changed would tie the language to the windows platform.

  • k anenk anen

    Hi Mr Heljsberg.
    can you create Artificial intelligence programming language or syntax in c# programming environments.
    prolog syntax and compilers is hard for programming.

    thanks.
    bye.

  • JedrekJedrek

    I just downloaded Roslin CTP.
    I see that it is possible to redefine the function at runtime.

    This is amazing!

  • Something's wrong:

    High Quality WMV <-> 253MB
    Mid Quality WMV <-> 290MB

    ?!

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.