Hacker News new | past | comments | ask | show | jobs | submit login

Isn't "It depends" part of the problem?

For instance my professor when explaining to the other students why we use context-free grammars for parser he said "we always want a language to work how we tell it to. An if doesn't mean something different depending on where it is"

While I do agree that he is incorrect and that is a very close minded, and out dated, view of language design he is accidentally correct in another sense.

I'd like to ask "why" C++ chooses int i is different based on the location. I know the answer myself, but my peers don't and probably wont until years of pain in industry while parroting the same nonsense that C++ is the best language same as all of the other loons who think that there is a "best language".

Why is it ok for struct packing, for aligning data, and for initial memory state to decide how the program behaves?

In C++ it does, in C it's more sane but it sill happens.

> RAII helps in the situation where instead of having to do tedious code such as.

How is:

   string s = "";
and

   int i = 0;
Tedious? That seems like the sane alternative as it puts the behavior in the hand of the programmer. In nearly every language this is decided as the preferred way of allocating variables. Define AND assign to create something useful.

I don't think I understand how adding more case-specific behavior that doesn't apply to everything should be considered sane. It's more edge cases that aren't needed.

It's much simpler to say "we are just going to hold a slot in memory for any object, you need to initialize it" or to say "we are going to have default initialization for EVERY object even primitives" but it's horrible to say "we're going to do a combination of both and you have to figure it out"




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: