Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Often there are programming languages that are specialized for specific tasks. Some programming languages are excellent at array arithmetic (such as matrices and the use of multidimensional arrays), yet some are much better at higher-level mathematics that is hard to reproduce in other languages (yet still possible all the same).

What about a language makes it better for a specific task or end-goal than other languages, given that most simply compile down to assembly anyways?

I am talking about Turing complete languages, ones that are Turing equivalent.

share|cite|improve this question
1  
This is an encyclopedic question. I suggest that you break it down in some way, make it more specific. – André Souza Lemos 21 hours ago
4  
Would it be wrong to say "marketing"? – corsiKa 18 hours ago
1  
@corsiKa Yes, I think it is more than an issue of marketing. – Jeremy West 16 hours ago

There's a few things to consider:

  • Abstraction: what does the language treat as "special?" Are matricies first-class values, like in Matlab, or do you encode them using simpler types like arrays, as in C. C makes you think about how matricies are implemented, Matlab doesn't.

    Likewise, if you've got a complicated system of asynchronous communications, you probably want first-class functions so that you can do callbacks.

    The more features that are added, the more complex the language gets. So while there are some "multi-paradigm" languages like C++ and D, most languages pick a niche, choose the things that are important to that niche, and prioritize those as their main abstractions.

  • Performance: all abstraction comes with a cost, whether it be compile-time or run-time. Some languages limit themselves in a way that makes them less abstract but more performant.

    Early Fortran didn't allow for pointers or recursion, so it's great at number crunching, faster than a language like C, where you were running lots of loops. But it was terrible at encoding large data structures, like trees, where you needed pointers for indirection. (Note that I don't know much about modern Fortran).

Essentially, there are always tradeoffs. More abstract means either slower runtime or more complexity at compile-time. More features means a more complex language. Some features make certain things fast and others slow, like pointers and recursion. There's no perfect language, so each language will reach a sort of local maxima in the space of language qualities.

share|cite|improve this answer

Some languages by specification are not Turing complete e.g. C isn't, and some are not by design like Coq, Agda or System F.

The constraints of some languages makes it easier to implement faster code (e.g. Fortran vs C and the pointers aliasing) which is a tradeoff between out-of-the-box performance and possibilities).

The language is not "optimized" for specific tasks, but the implementation, compilers and constraints that make it easier to understand the code by compiler makes so. The real deal is about specific libraries, algorithms implemented to speed up the process with switches depending on the problem length makes it optimal.

For example the multiplication uses various cases (see GMP multiplication.

When the language specifies the higher level mathematic operations it's implementation is optimal (efficient in this case), but that is not the part of language specification.

Please take a look at matrix rank computation in Matlab, Mathematica and Maple (I cannot perform all the tests myself right now, but these are consistent with my tests). All these languages (environments) implement the same higher level operation but the implementation details differ which gives various times.

When some domain specific task (here also domain specific language) is oriented at particular calculations they get improved and optimized (over the years) for the target audience. But being optimal is not always the case. For example Perl has a long history of handling strings, but the PCRE (here simply Perl's regular expressions) are not the fastest existing ones (and use a lot of memory), but are extremely expressive and powerful.

The constraints of the language makes a difference in the compilation process, the mentioned pointer aliasing prevents the possibility of the code reordering and enforces reloading of variables.

share|cite|improve this answer
5  
Most languages are Turing complete by specification, as not all of them specify fixed address sizes in their spec. And it's pretty limiting to lose the distinction between things like C, which are Turing Complete modulo address size, and things like Coq, Agda or System F, which are not Turing Complete at all. – jmite 20 hours ago
1  
@jmite thank you. I hope this is no longer shadowing the differences – Evil 18 hours ago

The other answers miss the point of optimising a language for a specific task - it isn't just about what makes code run faster on given hardware; it's about how clearly and succinctly a particular language allows you to express the solution to a problem. That very much depends on the problem domain, and (along with marketing hype, ignorance of existing solutions, and the ego trip of writing a new language) is why we have multiple languages - the goal is for the programmer to write less code, which is both less error prone and easier for the next programmer to read/understand/fix/enhance.

For example, both C and C++ can be used for object orientated programming - and indeed, the GObject library is a good example of OO C. A C struct containing function pointers can serve the same purpose as virtual methods on a C++ class, and can perform better; the development penalty is glue code to allocate memory, initialise the function pointers, and choosing a strategy for calling 'parent' methods. Most of the time it's clearer/safer to type Class klass * = new class() than struct class *klass = malloc(sizeof(struct class));klass->fn1 = ...;klass->fnN = ....

share|cite|improve this answer
    
Well, the jmite's answer provides with a bullet points the things you wrote are missing. I wrote about domain specific tasks that are optimized for this matter. I like C, I know things like OCC, but it does not make C Object Oriented (the compiler does not help with this and many optimizations get prevented, there is no garbage collector, etc.). You cannot overload C functions like in C++, but of course you can emulate any behaviour (jmite wrote about this also). I do not see how this answers the question stated. – Evil 15 hours ago
1  
@Evil: Object oriented programming and Object oriented programming language are two different concepts. Object oriented programming do not require an object oriented language. Arguably it just requires the existence of paper or whiteboards so you can do your UML design. – slebetman 11 hours ago
    
@slebetman I didn't see that coming. Arguably you do not need the paper and the whiteboard, you can just imagine objects, and according to some people this is how we think, but this doesn't get any closer to the language support of OOP concepts. I am sorry, but this is dispute I do not want to pick. – Evil 10 hours ago
    
@Evil: I'm not so sure about being able to keep track of it all mentally without some abstraction to help you. My first job was being given a large piece of C code that looked like all arrays with function pointers (took me a while to figure what the weird syntax meant - no google back then) and I was struggling with it until I started seeing a pattern and realised that those arrays were objects and those function pointers were methods. Bought myself a small whiteboard and used up a lot of A4 paper but finally I managed to understand the code – slebetman 9 hours ago
    
@Evil: Oh, and the guy who wrote the code quit a week before I arrived.. – slebetman 9 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.