We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Sebastian Wain • 2 years ago

I think Z3 is a much better declarative programming language for your Sudoku example.

Jan Jablonski • 2 years ago

How about LabVIEW as an example of graphical programming?

Christian Palmstierna • 2 years ago

Capability-based object models are a pretty interesting approach to securing concurrent programs. Might deserve a mention? See e.g. E, Pony, Emily.

habedi • 4 years ago

Very good article!

Arthur Bugorski • 11 months ago

Should have listed "Factor" for concatenative as it's the friendliest Forth-dialect and still actively developed.

Koen Cornelis • 2 years ago

For declarative i also like to use LINQ (C#) as an example. Nice and interesting list!

Ima Pseudonym • 2 years ago

Also check out APL & LISP for fun 😀

axebox • 2 years ago

Great article!

jonkleiser • 2 years ago

In the concatenative you should also include Factor, http://www.factorcode.org.

Gord Brown • 2 years ago

Just FYI, PostScript is also a concatenative language, like Forth. Though it's normally only used to describe documents, it is in fact a full-featured programming language under the covers. The nice thing about languages like Forth and PS is that they're *very* efficient to execute (which is why they were created).

PaulTopping • 2 years ago

They are reasonably efficient but not as efficient as a compiled language with good code optimization. In fact, Forth implementations include an assembly language when it is necessary to get down to processor level. For example, the 'add' or '+' "word" is defined in terms of assembly language instructions. Where languages like Forth really shine is minimizing memory usage. When I worked for Forth, Inc. around 1980 or so, I always remember Chuck Moore, the inventor of Forth, programming a simulation of the Battle of Midway which drove an early raster display. It included little ships with American and Japanese flags on them. The whole thing fit in 32k bytes of memory on an LSI-11, DEC's single-board version of its PDP-11 architecture.

write my essay • 3 years ago

Good to know about those tools. Thus, many developers and those who are still students in programming will be going to like this thing that they can be able to change their ideas on how are they going to apply this to their works in coding.

Susan Feerman • 3 years ago

Good one!

AlexH • 4 years ago

Nice ;)

Tygre Chingu • 11 months ago

Another (famous?) example of constructive PL: BibTeX Style Files (http://ctan.mirror.rafal.ca...

TL;DR This is incorrect: "no dependent type system can catch all errors due to to ineherent limitations from the halting problem". They can and do.

Totality (see http://wiki.portal.chalmers... ) ensures that a computation produces a result in finite time. Dependent languages are usually also total (Coq and Agda are total, Idris is optionally total). Effectively, infinite loops are compile-time errors. The halting problem does not prevent provably safe, terminating programs. The now solvable problem becomes that our program has to include a (mostly implicit) proof that it terminates. Even in the rare cases where this is difficult to do directly, a kind of timeout can be used, much like fuel in Ether.
In Idris, totality and friends can ensure correct resource usage (IO) as well as deadlock-free concurrency by turning protocol violations into compile time errors, like the following: forgetting to close a file, sending a wrong response to a network request, and even threads that could deadlock. See https://pdfs.semanticschola...

andres • 2 years ago

What about hardware description languages and logic synthesis tools?

still_dreaming_1 • 2 years ago

Cool article. I'm close to getting a logic/constraint/declarative style of programming working in PHP via my PurposefulPhp library. I didn't know what I was making when I first started it, but now I know that is what I was making. The difference between this and other ways of doing those styles of programming is this makes it feel very natural for people who are used to object oriented programming on more "normal" languages. It is actually a way of taking those paradigms and applying them to object oriented programming in a way that makes object oriented programming easier than it normally would be, it is just a way of programming on a higher level. It should also enable your code to be tested automatically. By keeping it as a library/framework in a familiar language, this also allows you to weave in and out of that style where it makes sense. It doesn't quite work yet, but I'm getting close to an alpha release: https://github.com/still-dr...

Fabrizio Cucci • 2 years ago

Minor repetition: "ANI and Plaid offer a fresh a fresh..."
Minor typo: "Formal verification methods have been around for a long type..."

Yevgeniy Brikman • 2 years ago

Good catch. Fixed now, thanks!

PaulTopping • 2 years ago

Another strange language feature I could imagine seeing here: Constraint Logic Programming

maksav5 • 2 years ago

Actually back in the days quite some software was created in a stack based language that one can think of as a mixture between LISP and Forth - https://en.wikipedia.org/wi...

Programming was a bit cumbersome on a calculator keyboard, but it was still fun and I remember it dearly.

Peter • 2 years ago

I agree with others here that an advantage of concatenative (stack-based) languages is potentially extreme performance, and this is not mentioned

alcides • 2 years ago

The superset of Plaid that is concurrent by default is Æminium. Besides the linked position paper, you can find more details here: http://dl.acm.org/citation....

Ron Aaron • 2 years ago

Nice to see Forth listed; you can add '8th' to that list: http://8th-dev.com/

Bill Landreth • 2 years ago

I remember spending days starting a war game project... I believe I had 512k and 2 360k floppies. My first attempt was to be a huge 2D "map" that would consist of a few bits for ownership of the square, bits for the unit type and strength... terrain type, altitude, dig-in counter... one thing I was musing at that time is it would be easier to do the battle calculations somehow this way. Every square being a record like that.
The next stage after destroying this false start was to realize that these "records" just need to be items with lots of links to other records...
Certainly you.would not see a Quake game with 3D spaces sitting there waiting for a missile to occupy their space. Each projectile each weapon each "object" only needs its attributes (velocity, heading, mass, location....) and links to other "objects" it is interacting with. Each car in rollercoaster tycoon is a seperate little object that hooks up to itself to make a coaster. Each track segment has properties as well as do all the peeps. Processing things in order of mass, speed, location or any other order is a choice you make in order to accomplish your task properly.

Skydda Barnen • 2 years ago

The problem with a lot of items on the stack is psychological. Forth programs (words) should be short and popping/pushing a few items from/to the stack. The rest of the stack is like undefined when writing/running a Forth word.

Else, use local variables to name stack items.

PaulTopping • 2 years ago

Yes, but languages like Forth still tend to be "write-only languages" because they are so hard to read.

Alex Blakemore • 2 years ago

Which makes them great for applications that generate commands so send to a machine - such as sending print instructions to a PostScript printer or tracking instructions to a telescope driver. Having a simple Turing complete language on your device is very flexible - even if the command programs are not intended for human editing

PaulTopping • 2 years ago

However, both Forth and PostScript were arguably designed to be written by programmers. In fact, even in the applications you mention, someone had to write the code. In fact, I had to write quite a bit of PS code in my time. It is a bit of a pain to keep track of the stack even with practice and applying all the hints that Forth and PS programmers tell you.

On the other hand, my 3 months working for Forth, Inc. were really enlightening. I learned a lot about the programming language space and the relationship of languages to computation. I would encourage any young programmer to learn Forth just to get their minds out of the cage imposed by most programming languages.

Lewis Cowles • 2 years ago

Anyone that has used a third-party API or written a parser understands all they need to about declarative languages...

David Hilton • 2 years ago

Your explanation of the concatenative code could be improved - in step 2, 10 is pushed to the stack, then the top two values are compared using the < operator, with the result pushed to the stack.

mcreenan • 2 years ago

Perl 6 has a very interesting type system which does "dependent types" as you describe them and may be easier to understand: https://docs.perl6.org/lang...

Christopher Henry • 3 years ago

Interesting article, thank you. A couple of things: I thought SQL was a 'specification language' and a 'declarative language' a more expressive form of functional programming. This from a novice programmer reading Concepts, Techniques, and Models of Computer Programming (Van Roy / Haridi) and likely still possessing a limited and somewhat garbled understanding of such things. Wondering what your thoughts would be.

Thanks!

Alex Blakemore • 2 years ago

Elm is a practical functional language with similarity to Aurora concepts