views:

341

answers:

12

What I mean is, virtually every language I know of are basically variations on a theme. You create variables, functions and manipulate them using conditionals and other constructs. I understand Functional Programming and the like are somewhat different from 'traditional' languages, but underneath they are almost the same. You are still working with variables (somewhat, even though they are immutable and such), and creating functions.

Is there any language or system that completely does away with what we use now and has a completely different approach? I may be way off and nothing like this exists, if so, feel free to say that and even vote to close if you don't think this is relevant.

+2  A: 

Read through http://en.wikipedia.org/wiki/Programming_paradigm and all the pages linked in the link box on the right. Depending on how you look at it, some are quite different or they are all basically the same.

ysth
+3  A: 

Well, there's Piet. That's pretty different. (Below is Hello World in Piet.) Although even then, you might argue that you're dealing with a data structure (in this case a stack) containing some number of integers and then you're adding and removing things from the stack, manipulating the values, etc. so really it's still kind of the same.

alt text

MatrixFrog
this looks pretty cool...
pop850
+1  A: 

Check out Forth, it is a rather different system where pretty much everything is about manipulating a stack. It's almost like a small very primitive VM.

harald
+7  A: 

There have been several attempts at graphical languages. The LabVIEW system from National Instruments is probably the most successful. It uses a graph of the data flow with components that act on data.

Another attempt at a graphical language is UML. I'd guess that the jury is out on this one. It was probably a good idea before a standards committee got involved and turned it into something for everyone.

A huge amount of electro-mechanical systems are controlled by PLCs, which are programmed with ladder logic. It is essentially a discipline for creating highly reliable finite state machines, but bears very little resemblance to procedural languages.

Then there are the esoteric, obscure, and alternative languages which largely serve no practical purpose other than to remind people that Turing-complete doesn't require that the language be sensible. Some might put a Turing machine itself in this category, but BrainF*ck, and Piet really stand out for me in this crowd.

The esoteric language whenever is also an interesting exercise in that it has no flow control at all.

Edit: I almost forgot about Befunge. Its source text is a grid of ASCII characters, where each cell is an opcode. Execution runs in any of four directions, and so it is possible to flow through a single opcode in four different sequences. It is another esoteric language, and was designed to be as difficult as possible (in 1993) to write a compiler for. Not that that has actually stopped someone from doing it.

Several of the languages I've pointed out have been esoteric languages. These are generally languages with small (often only one or two) user communities. They are created for a variety of reasons, and exploring the boundaries of what it means to be Turing complete and how one might represent a program are the more serious reasons cited.

The granddaddy of all esoteric languages is INTERCAL which was created in 1972. It is a language which superficially resembles COBOL, but which among its many quirks requires that the program be sufficiently polite (but not too polite) in order to continue executing. In support of politeness, PLEASE DO is a polite form of DO. A notable extension is the COME FROM statement, which can cause control to flow to here from the named location.

RBerteig
+1 for mentioning Piet
hydrogen
@hydrogen, while it certainly isn't a language I'd write code in, it sure is pretty.
RBerteig
Great answer, thanks. Ladder logic certainly looks interesting.
bennybdbc
Thank you for this post. I was looking for a language like "Whenever" for months, and at last I found something at least relatively close to what I need.
Pavel Shved
UML was never a good idea.
JUST MY correct OPINION
Oh, and the modern version of `COME FROM` is called "Aspect-Oriented Programming". ;)
JUST MY correct OPINION
I've actually written some complicated control systems in ladder logic and it definately takes a new way of thinking. @RBerteig.. imagine how colourful an entire OS written in Piet would be :o)
hydrogen
I have to give a contrarian view here. An an electrical engineer who have programmed a few PLCs before, it struck me how _similar_ ladder logic is to procedural languages. It is just that typical PLC applications make way more use of logical operators than typical software applications.
Muhammad Alkarouri
The most attractive thing about Intercal is that the manual is one of the funniest computer-related things I've read.
David Thornley
+6  A: 

Not a language per se, but analog computers are in some ways quite different from the more popular digital computers.

Martin Liversage
This answer is the nearest to being out of the poster's "variation on a theme" definition.
Muhammad Alkarouri
+8  A: 

Despite your high-handed dismissal of Functional Programming, I think you need to look at it again only this time reading for comprehension and learning instead of using confirmation bias to dismiss it as "more of the same". Writing code in a functional style is profoundly different than writing code in an imperative style. If it isn't different enough for you, however, why not take a look at any of these?:

Basically, just look at any of the dozens of programming paradigms available and read the descriptions for comprehension and enlightenment instead of dismissal through confirmation bias. Learn one language for each that appears sufficiently different for the vague definition of "different" you're using and have fun.

JUST MY correct OPINION
+1 Good answer. Just for the record, I wasn't putting down functional programming in my question, I just wanted to get other answers.
bennybdbc
I didn't think you were putting it down. I thought you were dismissing it on invalid grounds. ;)
JUST MY correct OPINION
+1  A: 

It depends on what you are asking about, but the answer is probably no.

The reason is that all the current computer languages that are Turing Complete are, well, Turing complete. This means that any of these languages can be simulated by any of the others in this group. Then any programming language can have a compiler or interpreter that can run on our current computers (approximation). These architecturally do have the concept of code and data.

So, if you think that functional programming and imperative ('traditional') programming are the same because underneath they run on a computer, then there are no other options.

Code and data translate into functions and data structures (variables). They do allow variations:

  1. Immutability is the main factor for functional programming.
  2. The difference between code and data can be blurred. For example homoiconicity means that a function can be used as data structure. See the Lisp languages.
  3. Related to this is self-modifying code.

On the other hand, how to express the program may be also written a bit differently. Using function composition as a basis may lead you in the direction of concatenative programming, though dataflow programming (including many graphical languages) and functional programming also similarly support it.

The last group of ways to express a language are those modelled as an optimisation or search process over a data structure:

  1. Logic Programming like Prolog.
  2. Evolutionary Computation outputs the program in a standard programming language. But presumably a descriptive language can be written that can be "executed" to find the resulting program and execute it. This can also be used for many machine learning methods.

This is all somewhat academic. My advice is that try to identify what you mean by different. Likely, functional programming is different enough for your purposes.

Edit: I have just noticed your use of the expression "manipulate them using conditionals and other constructs". Control flow constructs need not be different constructs to code and data. For example, a conditional if can be expressed as a filter or a loop can be expressed as a map. Given higher order functions and lazy evaluation you can do without an explicit if or for, using only functions and data structures. That doesn't mean you actually lost the ability to do that. You might be interested in Haskell if you want to see something like that.

Also, see the other answers for languages that look different, such as graphical languages and esortic languages, while still using the functions applied to data structures with control structs approach.

Muhammad Alkarouri
A remark on your second paragraph: Turing completeness characterises *sequential* computing. But we don't have any such universal model for concurrency: concurrent languages (especially those that model distribution) do have different expressiveness.
Gilles
@Giles: Can you give an example of a concurrent language that is _more_ powerful that Turing complete? Or if I misunderstood you, what do you mean by _expressiveness_? There are models for concurrent programming such as Pi calculus.
Muhammad Alkarouri
A: 

deleted by author

zzapper
A: 

It's not about the language, it's what you do with it that makes the most difference. Many languages will push you in a certain direction, pure functional languages like Haskell will make it pretty much impossible to program imperatively for example but as long as you don't take the time to learn the paradigms most languages will look the same as the machine language that's actually running, evaluating conditionals and assigning values to memory spaces.

The paradigms give you the abstractions you're looking for. Good object oriented or functional code will look nothing like what you describe. And you don't need languages to do this. I've seen great object oriented code written in plain C and functional code in C++. Although using the right language for the right job helps a lot. Unfortunately things work the other way around too. If you dont take the time to understand the paradigms you will still write imperative code in Scheme or Smalltalk.

Mendelt
+1  A: 

Good question. Let's take a step back. In my first aswer, I'll try to explein, that what you're looking for is not a new language, but a new architecture, and I'm sure, you know at least the important ones.

20 years ago, computer programs were built using "serial" logic, like a Basic program:

10 INPUT "PASSWORD: ";A$
20 IF A$="PASSWORD" THEN GOTO 40
30 PRINT "TRY AGAIN" : GOTO 10
40 PRINT "WELCOME"

MS-DOS programs are the same: they run for a wile, then waiting for user input, then run again. On Unix systems, even it's a multitasking system, the game is very similar, more than one user can run programs that way.

There were two berakthrough wave:

  • event-driven systems: the program flow has changed radically (event handlers, callback, listener);
  • web systems, especially AJAX: the program is running on different machines (distributed processing, client-server architecture, service).

Meanwhile, the compiling and program construction is changed, but I think some less:

  • metaprogramming (IDE-based code generator, preprocessor),
  • pluging thecnique,
  • dynamic libraries.

Also, programming target environments changed lot:

  • virtual machines (Java),
  • interpreter platforms (PHP),
  • system services,
  • frameworks,
  • portal systems (Drupal).

Some big, fat programs became platform:

  • Lotus Notes (own language, and now: Java),
  • MS Excel (Visual Basic).

I did not mention any new laguage, but it can be so different programming even in the same language, say, writing a J2ME game for mobile phone and writing stored procedures for Oracle SQL, both in JAVA.

Maybe what you're looking for is not programming languages. Say, the task is to display a list of data, some kinda table in a browser. The web app should look:

  • A PHP script performs the SQL query, and a templating system inserts the gained data into a prepared HTML template.
  • A PHP script puts the data gained from SQL to an XML, and the browser converts it to final HTML using XSLT transformation.
  • A JavaScript app requests the data frm the PHP script, which sends the SQL result back in JSON format, then the JS app renders the final HTML.

Is HTML+XSLT a programming language? Not. Do they do the same task which the PHP does server-side, or JS does on client-side? Absolutelly. Is it a common platform? Yep, all the browser supports it.

I think, there are far enough low-level programming languages, I mean procedural, OOP or other Turing-complete languages. The goal of new (less-than-programming) languages is to be more effective: faster code generation, more flexible apps, community work support, scalability, easier maintanence, reusability etc.

(I split my answer here; in the next part, I'll show you one, which I'm playing with for a while.)

ern0
A: 

Study up on the Turing Machine. The Wikipedia article lists some simulators you can run programs on. It will be at least aesthetically different.

David Thornley
+1  A: 

As I said, there are lot of platforms or environments today, which can be programmed. In case of some platform, you can choose from a long list of languages, e.g. Microsoft .NET, which can be programmed in VisualBasic, C# etc.; other cases, very different platforms use the same language, e.g. JAVA, which is used in Android, Oracle SQL server stored procedures and so on.

Also, there are non-programming languages, which covers a domain or they articulate some kind of configuration, which is far simple as a real programming language, but can be used better than a programming language. An example: PLCs' ladder logic programming.

The Dataflow Programming is one of this kind of programming. Let's see Wikipedia, what is Dataflow Programming (also called Flow-Based Programming):

In computer science, flow-based programming (FBP) is a programming paradigm that defines applications as networks of "black box" processes, which exchange data across predefined connections by message passing, where the connections are specified externally to the processes. These black box processes can be reconnected endlessly to form different applications without having to be changed internally. FBP is thus naturally component-oriented.

from: http://en.wikipedia.org/wiki/Flow-based_programming, see also http://en.wikipedia.org/wiki/Dataflow_programming

The Wikipedia articles are great, and I've answered some other questions, so I don't want to repeat myself. Instead, I'm describing the language which I'm using for my Asynchronous Dataflow Server.

There are 3 language elements.

  • Component declaration

    cmp: Compare

This refers a component instance, named "cmp", which is a type of Compare.

  • Message definition

    src.out >> cmp.value cmp.gt >> dst1.in cmp.lt >> dst2.in cmp.eq >> dst3.in

The words before the points are the names of component instances, the words after the point are port names, the left component-port pair is the source, the right is the destination. (Ports are the pin points of components for sending or receiving messages. See Wkikpedia articles.)

  • Properties

    cmp.base = 8

This defines the value of a port of the component instance.

(Putting these lines together, we get a short dataflow program, which means: a valus comes from src, cmp checks its value, and passes it to dst1, if it's more than 8, dst2, if it's less than 8, and dst3 if it's exactly 8.)

I think, this language meets your criteria, it's not procedural, there're no traditional variables, no subroutine, no cycle.

It's funny that there are some serious projects, which implements dataflow programming, but they don't even mention it:

(I have no web page for my dataflow project yet, it's under construction.)

Dataflow programs can be displayed, or can be edited as graph (see SynthEdit).

ern0
+1 Thanks for the great answer, and thanks for going to all that effort. Please add the link to your project in when the web page is done, it sounds very interesting.
bennybdbc