News for hackers. Stuff that matters.
Re:Do I Really Need a Programming Language? by nostrademons on Sunday December 29, 2013 @02:59AM (#6978822)
This is why everyone should study compilers and machine architecture in college.

Anyway, it's interesting that he chose to label what he ended up with as "Lisp". I would've stopped at assembly, eg. in LLVM IR:

  %result = icmp gt i8 %price, 100
  br i1 %result, label %Discount1, label %Discount2
  Discount1:
    ret i8 10
  Discount2:
    ret i8 5
The key idea here is that underneath everything you tell the computer to do is boolean logic and transistor circuits. Yes, even Lisp S-exprs; it's not really correct to say "Lisp has no syntax", it has a very simple syntax that is trivially parseable. Even LLVM assembly is a translation layer, as is LLVM itself; underneath it on my computer is an i86 processor, and underneath it in my phone is an ARM-architecture Snapdragon.

Once you understand that, you realize that all of these languages and frameworks and libraries and databases are just tools, and they exist for your convenience. They're there to let computers handle things that humans are really bad at. For example, memorizing memory layouts really sucks; let a computer map out your structs onto memory. Managing heap memory really sucks; let a garbage collector do it. Managing register allocation really sucks; let a compiler do it. Managing syntax kind of sucks; let a parser slap something more friendly on top of it, or don't and use Lisp. Managing vtables kind of sucks; let C++ or Java hide it behind a class, or don't and continue to use C.

Once you've gotten into this mindset, you're free from the religious wars that surround technologies, because you realize it's all just tools that compile down to machine code at the end. And you understand when a tool might be useful, and when you could just as easily implement it yourself, and when it once was useful but has since ceased to be.

Re:Do I Really Need a Programming Language? by tikhonj on Sunday December 29, 2013 @03:14AM (#6978867)
That's one philosophy. Your code exists to be run by your computer.

Personally, I take a different one: the computer exists to run my code. LLVM, x86, ARM... all just implementation details. Sometimes they're unavoidable, but c'est la vie.

Ultimately, what I care about is semantics. I care about what my program means--the logic it represents. After all, that's the whole point, the end goal. The fact that it's running on a physical computer is just a detail, albeit an important one.

A programming language is more about shaping my thoughts and forming my logic than actually running. Choosing a programming language is incredibly important--it affects what I can say, how I can say it and even how I think. And that's the most important part.

Re:Do I Really Need a Programming Language? by ZoFreX on Sunday December 29, 2013 @02:48PM (#6980960)
You reminded me of this:

> What is a program? Several answers are possible. We can view the program as what turns the general-purpose computer into a special-purpose symbol manipulator, and does so without the need to change a single wire (This was an enormous improvement over machines with problem-dependent wiring panels.) I prefer to describe it the other way round: the program is an abstract symbol manipulator, which can be turned into a concrete one by supplying a computer to it. After all, it is no longer the purpose of programs to instruct our machines; these days, it is the purpose of machines to execute our programs.

EWD1036

Re:Do I Really Need a Programming Language? by millstone on Sunday December 29, 2013 @04:02AM (#6978944)
The end goal of the web browser in which I'm typing this is not to represent some piece of abstract logic, but to drive the physical hardware: to change the color of pixels on my screen, to sense and react to my input. Attempt to distill it to some piece of logic or mathematics, and you end up with something useless, an absurdity.

The original task was "apply a seasonal rebate to our products," but none of the programs actually accomplished this feat. They contained some logic which might be useful in such a program, but none of them applied anything. Logic on its own is sterile.

Re:Do I Really Need a Programming Language? by theaeolist on Sunday December 29, 2013 @04:10AM (#6978957)
I thought the end goal is to display the page. I would say that "to change the color of pixels on my screen, to sense and react to my input" is a means to an end, not "the end goal".
Re:Do I Really Need a Programming Language? by Tyr42 on Sunday December 29, 2013 @08:57AM (#6979524)
This was a really neat discussion to watch. Devotional vs Observational semantics.

When I'm in my algorithms class and we have a code snippet to find a minimum spanning tree, we don't even have some machine to compile it down to, but because we have denoted some meaning to bit of the program, we can even prove that the meaning of the entire program is to output the MST.

Re:Do I Really Need a Programming Language? by andrewflnr on Sunday December 29, 2013 @12:39PM (#6980373)
Changing pixels on the screen (usually?) only matters because it let's us get at the results of the program. Even if the program is a video decoder + video, I don't care about pixels, I care about the picture. Pixels are just more implementation details.
Re:Do I Really Need a Programming Language? by chongli on Sunday December 29, 2013 @03:05AM (#6978841)
Once you've gotten into this mindset, you're free from the religious wars that surround technologies

That seems all fine and well, but you're ignoring the elephant in the room: compatibility. You aren't free to choose your tools as you please if compatibility is one of your requirements. This little bit of impurity combines with network effects to create big problems. Compatibility along with all its attendant problems is the single most valid reason for engaging in a religious war over technology.

Re:Do I Really Need a Programming Language? by Someone on Sunday December 29, 2013 @09:42AM (#6979646)
"This is why everyone should study compilers and machine architecture in college."

Everyone? For starters, I would exclude those studying law, medicine, most of the 'soft' sciences, and probably chemistry and physics, too.

Yes, most of these might be better of having some knowledge of programming, but I doubt they really need to know what a parse tree is. Hand-waving "3+2x6" is three plus (two times six), just as in normal life" probably is sufficient for most of them. Even math majors need not know about compilers and machine architecture.

That leaves a tiny fragment of 'everyone in college': just the computer science students and, to a lesser degree, the software engineering ones. I would present the latter to parse trees, but I would not go in any depth there. Really, for most people doing software engineering, compilers can be black boxes.

Re:Do I Really Need a Programming Language? by shurcooL on Sunday December 29, 2013 @03:14AM (#6978869)
This is so, but why are our language A <-> language B translation tools so bad, that people end up having to manually convert code from one language to another (e.g. if some code exists in language A, but you need its functionality in language B)?
Re:Do I Really Need a Programming Language? by etherealG on Sunday December 29, 2013 @04:20AM (#6978976)
because some of the essence of what you wanted to express is lost when you compile. it's not a one to one mapping.

otherwise we would just compile and decompile into each form. intermediates like lvm come close to trying to do this i think? not sure if they allow going back to the original form from the IL though.

oh, and lastly, think of trying to express a feature in 1 high level language with another that doesn't support that feature. it's quite hard to gain expression when it's not idiomatic in that language.

kind of similar to spoken language actually. some concepts in some languages form as single words or phrases that never really translate well to other spoken languages because the place that other language formed never had that concept.

Re:Do I Really Need a Programming Language? by userbinator on Sunday December 29, 2013 @07:14AM (#6979345)
Compilers have gotten better, but in comparison to a human, they are still not particularly good at the edge cases. Things like instruction selection and register allocation in particular, sometimes I wish I had the time to write my own more intelligent algorithms for them.
Re:Do I Really Need a Programming Language? by sklivvz1971 on Sunday December 29, 2013 @07:47AM (#6979399)
I agree.

The point of a programming language is making complex stuff readable. One can certainly hand-assemble and write software as a series of byte values and I have done so in the past because of necessity. It's very boring and difficult.

In this respect, I don't find Lisp readable or intuitive at all, but that's just me, I'm probably not smart enough:-)

Re:Do I Really Need a Programming Language? by m0skit0 on Sunday December 29, 2013 @09:07AM (#6979543)
It's not about being smart or not, it's simply getting used to it. Probably chinese doesn't seem readable or intuitive to you, but a chinese also don't find english readable or intuitive.