

Ask HN: definition of a highlevel language? - globalrev

(might not be the right forum for this but...)<p>what is the definition of a highlevel-language?<p>well there isnt one specifically and wikipedia and the like gives just a very general description obv you can say it abstracts away lowerlever operations.<p>yes but how?<p>a function like map takes a function and applies it to a list for example.
this abstracts away a common procedure like iterate through a list and for every position do a computation.
so it is a higherorderfunction. is this how higher-level-languages are built?<p>so are they fundamentally differently built or is it just a lot of lowlevel operations built on top of each other?<p>haskell is considered a very highlevellanguage but can you do systemsprogramming with it(yes maybe it is very unpractical i dont know but can you)?<p>is lambda calculus a more abstract and efficient way of modeling a compututation? meaning you start at a higher level of abstraction and can work up to even higher even faster?<p>how did lispmachines work? was the basic system programmed in LISP?
======
aaronblohowiak
In the beginning, there was machine code. this is essentially inputting what
the computer actually executed, without any translation or compilation (
[http://en.wikipedia.org/wiki/First-
generation_programming_la...](http://en.wikipedia.org/wiki/First-
generation_programming_language) )

Then there was assembler/assembly. This is similar to the aforementioned,
except easier to read. Assembly is a 1:1 mapping between symbols and their
machine-understandable counterparts. This is the first step in the abstracting
of programming code from executable code (
[http://en.wikipedia.org/wiki/Second-
generation_programming_l...](http://en.wikipedia.org/wiki/Second-
generation_programming_language) )

Then, there are so-called 3GL. These let you do fancy things like having named
variables, symbolic manipulation, function calls, abstract (arbitrary) syntax.
This encompasses many of the languages people use at work today (c/c++/java) (
[http://en.wikipedia.org/wiki/Third-
generation_programming_la...](http://en.wikipedia.org/wiki/Third-
generation_programming_language) ) It is important to note that the purpose of
3GL, like assembly before it, was to create a separation between what the
programmer typed and what the machine ran. The latter being derived from the
former according to its rules.

( [http://en.wikipedia.org/wiki/Fourth-
generation_programming_l...](http://en.wikipedia.org/wiki/Fourth-
generation_programming_language) ) 4GL are the next step along this line. The
focus of 4GL is to make it that the code entered is as focused on the domain
logic as possible, hiding the implementation details.

The phrase "further from the machine and closer to the domain"in the wikipedia
4GL page sums it up nicely.

To a chip designer, machine code is a high level language (it is an
abstraction of the machine itself.) To an assembly programmer (nobody programs
in machine code AFAIK,) c is a high-level language. To a c programmer, java is
a high-level language. To a java programer, ruby is a high-level language. To
a ruby programmer, RSpec is a high-level language.

Essentially, the further you get from the machine, the higher the level.

As far as the implementation of languages, well that depends. You can very
well implement any language in assembly or machine code (given enough time,
patience, and self-loathing.)

Usual strategies for the development of high-level languages are to either a)
translate to a lower-level language that then gets compiled to machine code b)
translate to a lower-level language that targets a virtual machine that
eventually translates these lower-level instructions to machine code or c)
some combination of a & b until enough of your new language has been written
so that it can translate itself to machine-code or vm bytecode (known as self-
hosting.) high-level languages can sometimes be seen as collections of cool
libraries that translate your code into lower-level languages, on and on until
you eventually get to machine code. of course, people who write these
translators are smart folk, and sometimes manipulate what you have written to
make it run faster.

but yes, eventually, almost all languages become machine code in order to be
executed (or are converted into control flags that configure the operation of
existing machine code / configure an fpga or other type of bendy silicon.)

now, were lisp machines self-hosted? i dunno.

the implementation of Ruby is open-source, and mostly-readable C. watch a
movie about ruby from the inside (some knowledge of c is useful)

<http://mtnwestrubyconf2008.confreaks.com/11farley.html>

read more about the same:

<http://eigenclass.org/hiki.rb?ruby+internals+guide>

\---

5GLs are even more abstract. instead of solving the problem in the domain
space, you merely specify the constraints on the possible solutions and the
computer provides you with solutions that satisfy all constraints. this
offloads the work of figuring out how to solve the problem to a bit of
problem-solving code. Programming a generic problem-solver that finishes in an
acceptable amount of time on existing hardware in most cases is EXTREMELY
difficult to do, so you need to let the consumer of the 5gl specify some
control logic and provide hints to the problem solver. How to make this all
work right, fast and make it more palatable than having a nice 4GL is not a
solved problem.

Rumor has it that there are members of the cult of Logic Programming planning
a re-emergence from the shadows and sewers. (
[http://www.cs.kuleuven.ac.be/~dtai/projects/ALP/newsletter/f...](http://www.cs.kuleuven.ac.be/~dtai/projects/ALP/newsletter/feb04/nav/van_emden/van_emden.pdf)
)

------
gills
Most abstractions are a little leaky, and we usually need to consider the
'how' when specifying the 'what'. For example, adding numbers in C can be
accomplished with the abstraction '+', but the programmer must consider
whether the operation will overflow the register on the underlying machine.
Some even-higher-level languages plug that leak by providing a numerical
hierarchy that will not overflow due to constraints imposed by the underlying
hardware.

So I would say "higher-level languages" provide less-leaky abstractions. One
can specify 'what' without specifying 'how', and one can make assumptions
about the way exceptional cases are handled. The ideal language would provide
leak-free abstractions but still allow the programmer to dive into any level.

There is probably a lot more to say than that.

------
ken
"A programming language is low level when its programs require attention to
the irrelevant." --Alan Perlis

------
msg
[http://steve-yegge.blogspot.com/2008/05/dynamic-languages-
st...](http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-
back.html)

So one way to say it is that high-level languages are like porno, "I know it
when I see it." Another way to say it is that there's machine language... and
everything else. Or fill in the blank for machine language, "C is the last
low-level language, everything more abstract is a high-level language".

It's tempting to think of memory-managed languages as high-level languages,
but then there's Java...

Ratio of code size to payload is of course another metric.

<http://paulgraham.com/power.html>

Maybe it's the functional languages.

Why do you ask?

------
bayareaguy
One language is higher level than another one for a given problem when it
allows a solution to a given problem to be specified in a way that introduces
a minimum of concepts and issues external to the domain of the problem.

For example if your problem is to allow a doctor to find the best treatment
for a patient with a given disease, you would say an expert system that allows
said doctor to express the medical facts and reason about them is higher level
than something like Lisp and a raw REPL because the last thing the doctor
presumably wants to worry about is something like how a given data structure
is implemented.

------
yan
I think asking what a high level language is akin to asking "What is tall?" If
you're talking about buildings, tall can mean one thing, if you're talking
about toddlers, tall can mean another. Haskell can seem like a low-level
language to, say, English.

A "level" of a language is a very relative concept, but you can approximately
define a hierarchy of languages relating the level of one language to another
using some arbitrary comparison.

Since my background is in operating systems and some compilers, I'd say
anything C and anything higher level is "high level," but then again, that can
mean anything :)

------
jws
I think a high level language is anything other than assembly language. That
is from the perspective of someone that started with machine code and assembly
language.

I don't think anyone ever set out to create a "low level" language. There was
simply "coding the machine directly" and then "high level language".

Now it is tempting to draw a multidimensional line in the features of
languages and partition it into "high" and "low", but I don't think that is
where the term originates. It is a one hand clapping sort of adjective.

~~~
aaronblohowiak
i think if there were some way to codify distance between language as typed by
programmer and machine code executed, we'd have a handy function to determine
how high-level a language is.

further, aren't all lines multidimensional? ;P

------
anamax
> how did lispmachines work? was the basic system programmed in LISP?

Yes. However, I'm not sure why that's relevant.

------
presty
high level languages are languages that are close to natural language

~~~
Jesin
No, that's absurd. It's about the level of abstraction, not how close it is to
natural languages. Yes, most natural languages support high levels of
abstraction, but that does not mean that languages that support high levels of
abstraction are close to natural languages. They can still be quite far apart
in other ways.

Basically, low levels of abstraction are closer to the underlying mechanics.
Higher levels of abstraction allow you to think about what happens without
having to worry about the fiddly little details. It's like the difference
between neurology (comparatively low-level) and psychology (higher level).

