Live data from Hacker News

WinRT demystified

tirania.org

11–20 of 48 posts

Re: WinRT demystified

#11
Completely unrelated, but if the article didn't overwhelm you, the linked video session really is worth checking out.

http://channel9.msdn.com/Events/BUILD/BUILD2011/BPS-1004

It shows just how much attention to detail Microsoft has put into the UX design of Metro and Windows 8. Can't wait to see the finished product.

Re: WinRT demystified

#13

Earlier quoted context omitted.

Um, it sounds like 'mobile' is driving the industry. Apple is a player too, just like everybody else.

Don't forget that Apple invented the new 'mobile' as we now know it - hardware, UX, app store etc. Everybody else is following.

Apple is also following. See iOS5 notifications copying Android notifications as an example.

Re: WinRT demystified

#14
post #10

Does anyone know if it will have a Sound API? .NET still doesn't. Neither does it have usable Direct{3D,Sound,X} binding.

I'm not a DirectX developer, but it looks to me like I've got huge swaths of DirectSound directly available from C#. I can check something specific, if you'd like.

Re: WinRT demystified

#16
The following is the full source code for a component that adds 2:

  public sealed class AddTwo {
    public int Add (int a, int b)
    {
       return a + b;
    }
  
    public async IAsyncOperation SubAsync (int a, int b)
    {
       return a - await (CountEveryBitByHand (b));
    }
  }
Sorry for being an idiot here, but.. does this example make any sense to anyone else? There's a method that adds two numbers, but the async operation is SubAsync which subtracts something passed through CountEveryBitByHand from a... passed through something called await? Is this obvious to other people? Does he mean that any sealed class automatically becomes a component, so the AddTwo part is just the Add method? What does "a component that adds 2" mean anyway?

Is it a joke and I'm not getting it?

Re: WinRT demystified

#17
post #16

The following is the full source code for a component that adds 2: public sealed class AddTwo { public int Add (int a, int b) { return a + b; } public async IAsyncOperation SubAsync (int a, int b) { return a - await (CountEveryBitByHand (b)); } } Sorry for being an idiot here, but.. does this example make any sense to anyone else? There's a method that adds two numbers, but the async operation is SubAsync which subtr…

I suspect the second method is just an example of how you could make an asynchronous operation that performs a subtracting of two numbers, after a method (CountEveryBitByHand) is completed.

To keep it simple they should have left out the second method.

Unless I'm incredibly wrong!

Re: WinRT demystified

#18
post #16

The following is the full source code for a component that adds 2: public sealed class AddTwo { public int Add (int a, int b) { return a + b; } public async IAsyncOperation SubAsync (int a, int b) { return a - await (CountEveryBitByHand (b)); } } Sorry for being an idiot here, but.. does this example make any sense to anyone else? There's a method that adds two numbers, but the async operation is SubAsync which subtr…

Miguel is a pretty l33t developer, so he glosses over a lot of the details.

I suspect that code is contained in a class library project. Aka, generates a DLL. So no, not all sealed classes will be components.

The second method is there to illustrate what asynchronous programming will look like in C# 5. Native support for async is THE big feature in C# 5. The "await" allows you to call slow blocking code without a thorny nest of callbacks. There's some magic behind await. You can find out more on Google. Miguel could've definitely left out the SubAsync method in this example for clarity.

A component that adds 2 means a DLL that exposes the methods Add and SubAsync. In WinRT, you can code libraries in C# and use them in C++. Or Javascript.

Re: WinRT demystified

#19
post #16

The following is the full source code for a component that adds 2: public sealed class AddTwo { public int Add (int a, int b) { return a + b; } public async IAsyncOperation SubAsync (int a, int b) { return a - await (CountEveryBitByHand (b)); } } Sorry for being an idiot here, but.. does this example make any sense to anyone else? There's a method that adds two numbers, but the async operation is SubAsync which subtr…

CountEveryBitByHand() is a function which returns a promise. (I don't know if that's what they call it in C# 5.)

The await keyword is a new one in C# 5 which halts execution until the promise is fulfilled. Then execution is resumed from that point, and the expression can be evaluated and the function returns.

It's similar to how inlineCallbacks in Twisted work, if you're familiar with those.

Re: WinRT demystified

#20
post #4

When you use C# and VB, you are using the full .NET framework. But they have chosen to expose a smaller subset of the API to developers to push the new vision for Windows 8. For me, this is a really interesting point that this article doesn't fully get. When you use WinRT you might be using the C# compiler, CLR runtime and .NET string & collection classes, but there are huge sections of the .NET BCL that now look lik…

This is a really interesting question. I did some quick skimming over the docs there and even where there is conceptual overlap, the BCL wins in terms of feature breadth. It would be challenging to replace it, I think.

My suspicion is that .NET 5 will merge the two.

Post reply on HN