5 ms·
The better (and maybe more interesting) question would be is why people create new languages, i.e. what aspects of existing languages bugged them and/or how do
by Jun8 15y ago
The better (and maybe more interesting) question would be is why people create new languages, i.e. what aspects of existing languages bugged them and/or how do they discover deficiencies which motivate them to create a new language.
- bartwe 15y agoFor me it was a big case of Not Invented Here syndrome that caused me to make my own compilers and languages. It is a great way to learn deep stuff about how languages work, and helps me debug issues that others can't fix.
- palish 15y agoIssues such as?
- veyron 15y agofor example: C has a bunch of undefined expressions which give you different results on different compilers (as an example, j = i++ + ++i;) Now, this makes perfect sense if you understand the concept of sequence points, but you wouldnt see that explanation in most books.
- palish 15y agohmm... j = i++ + ++i; .... To me, it seems like that would be evaluated by operator precedence... ++ has a higher precedence than + So let i=1. The expression then becomes: j = i++ + ++i; j = {1}++ + ++{1}; j = 1 + 2; OR, j = 1 + 3; Aha. And that's the undefined behavior. Ew. That seems like the type of problem which shouldn't have to be debugged, because the code shouldn't have been written like that to begin with. Heck, it seems like the compiler shouldn't even allow that code to compile in the first place... But I guess there are technical problems with disallowing that? (Not the least of which is, it would break existing code.)
- veyron 15y agoThe issue comes from some vagueness in the wording from the C standard. The expression is valid from a literal interpretation of the rules, but to eliminate it would require a much more convoluted set of rules. Remember that C historically was a single-pass compiler ... And if you want to get even funkier, try this in other languages (python yields 2, bash yields 4) $ python -V Python 2.6.1 $ python -c 'x=1;y=x++ + ++x; print y' 2 $ x=1; echo $((x++ + ++x)) 4
- kingkilr 15y agoPython is not doing what you expect here, it sees that as: y = x + (+(+(+(+x))))
- MostAwesomeDude 15y agoYou appear to not understand how Python works. Python has no increment operators; your statement is equivalent to "x + ++++x" or "x + x", using the unary + operator.
- veyron 15y agoFor those that didn't understand, my point with the python example was to emphasize that the same expression (visually) can have different meanings in different languages, and that the parse rules can be different. I am aware that python doesn't parse it in the way that the expression appears to a C programmer :) Concerning python's lack of pre and post increment, the decision was made primarily because there are a lot of confusing situations, such as the aforementioned, with the increment and decrement operators. However, the decision to allow x++x to be valid, and parsed as x + (+ x) = x + x, is itself terribly confusing and germane to the original discussion
- mdaniel 15y agoAs someone who has to endure the results of NIH, I want to say that such thinking is a poison to the industry. I wish that, if someone is overcome by the vapors of the NIH disease, such a person would confine their reinvention of the wheel to their personal time and not introduce such silliness to the workplace. Of course, I wish for lots of things.
- nitrogen 15y agoI got the impression from bartwe's post that the NIH symptoms were confined to personal/learning time.
- aphistic 15y agoIt could also be that they just want to learn more about how what they work with functions. I have a hobby operating system that I'm working on (that doesn't do much of anything at the moment :), but I'm not creating it because I think other OS's are deficient or to fix something that bugs me. I just want to better understand how an OS works at the lowest levels and I learn best by experimenting.
- veyron 15y agoFor most modern languages, you can find a document or interview explaining the motivation. For example, ruby: http://linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html http://linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html (In this interview he uses the magical phrase "principle of least surprise")
- protomyth 15y agoYour looking at a new or ill developed paradigm and think you have an interesting take on it. Maybe you look at the current languages and it really does fit your mental model of how you want to solve problems.
- ChuckMcM 15y agoI think the simplest answer is that the creation of new programming languages is intrinsically thrilling to someone who is fascinated by computation. A friend once asked "Yeah, but how does a computer know that 5 + 2 is 7?" and to answer the question we built a 4 bit adder out of basic logic gates. We built it because it was exciting to do so.