Captain Segfault wrote:C# does have pointers, but you have to declare sections of your code "unsafe" to use them.
Wow, that made me laugh. Really? I'd love to hear their definition of safe in this context.
A: Oh my god, it's a pointer that points to REAL PHYSICAL MEMORY!!! We cannot be having this in our abstracted HLL world! And besides, it is bound to create a number of problems for unexperienced programmers with memory access violations and such things.
B: So what are we going to do about it chief?
A: Well stop people using it of course.
C: But, I am quite sure that there are a lot of reasons why professional programmers would want direct access to the memory to optimize their programs.
A: True. Ok another plan. How about making it so difficult to use, that no one will try to use it except those who know what they are doing, and they will be forced to find other, more acceptable, high level ways to accomplish their goals.
C: Wait, if you make it too difficult I don't think they will be able to take the language seriously for any low level tasks.
A: Ok, rather than making really complicated, we can make it just plain annoying and use any other kind of deterrents that will prevent usage by the casual user and make sure C# can be regarded as a truly high level language.
D: Umm, sounds ok... I don't think making it annoying will help much. But what could possibly deter a hardcore programmer from going down to the low levels of computing?
B: I know, if we can make it so that this low level coding will look 'dangerous' in some way!
A: Brilliant idea, but how?
D: I suppose it would be ok to just encapsulate or prefix this code using some keyword. Not sure what though.
B: Couldn't we just use 'dangerous'?
C: Nah, no point in having it so long. That's just inconvenient.
B: What about just 'unsafe'?
A: I like your thinking there. 'unsafe' it is.
D: OK, isn't there going to be a lot of extra work involved in making the compiler able to check all these special pieces of 'unsafe' code that I thought this language wasn't intended to use?
A: Yes, but if you think about it, the people who will be using this stuff are much less likely to make mistakes! What's the point in checking it at all. We can just compile it like in C++ and just let it be.
C: But obviously, people of less experience will be able to use it by just copying code from better people. This isn't going to stop or deter them using it at all! And then they will wonder what has gone wrong when their programs crash through unexpectedly through no fault of their own.
B: I know! All we need is to stop this code being compiled by default and bring up an error on it right away. So if their programs don't work it is because they have allowed this potentially unsafe code to be compiled, therefore it is their own fault, and that covers the integrity of our language too.
A: So how are we going to make it so that the code will be compiled when needs to be?
D: Oh that's easy, we just need to add a compiler option, like... '/unsafe'
A: Oh yes, of course. Well, all this stuff is gold. This language is going to be the best ever! Now we just need to make sure we have solved all the problems that exist in other languages and C# will be supreme.
C: You absolutely sure about this?
A: How dare...
D: I think I speak for everybody here: can we go and get coffee now?
A: A grand idea. We've got through a lot right now. Well done. We deserve a break.
C: But I hate coffee.
A: Really? Shocking. It's ok though, we have tea.
C: Umm... sigh...
Wow 'unsafe' is #1 in Google as in the C# definition from the MSDN, rather than the English word itself from Answers.com. That must mean people use it A LOT. (#3 was an episode from Smallville. This has got to be one of the worst google searches I have ever done...) This for me is solid evidence that people do in fact want to have low level access at least sometimes for software running specifically on one OS, whatever suitable language they may be programming in.
Now onto other matters:
memory management is a huge source of mistakes and complexity and I'd just as soon avoid doing it as much as possible...
Well, I could just call you lazy, but that would be far too silly. It's not like people have time to fuss themselves with unnecessary details about memory locations, and how much data a program uses. Why do that when your language can do it all for you?
But you are missing many vital points. With complete control over your memory, you can access your data in any way you like and stop your compiler from wasting time doing stupid things behind your back. You don't need to think about how your language handles data or how much it uses. You already know that.
And you are also missing out on a whole lot of fun using HLLs. For example, self-modifying code. Imagine how efficient, adaptable, cool or hilarious programs could be if you were able to modify the code while it was in memory, and how easy it would be to totally confuse hackers who are trying to understand your disassembled code! This stuff is all possible, but not with HLLs. This is what makes low-level programming so great.
In a horribly twisted quote: 'I need assembly codes. They are the only thing that keep me insane."
</rant>