Yeah the slow startup is because this is using Datasette Lite, which loads an entire Python runtime compiled to WebAssembly into your browser every turn you load the page! Server-side Datasette starts a whole lot quicker than that, eg https://scotrail.datasette.io/scotrail/random_apology
The editor has syntax highlighting in server-side Datasette - I've not got that working in Datasette Lite yet.
is about line comments. C gets credit for the // comments, starting in 1972, but that's not really accurate. BCPL -- which begat B which begat C -- had // comments but they were not included in C until C99. C++ (which isn't included in their top 30 languages) brought back // comments from BCPL sometime between 1979 and 1985 (the first public release of cfront). Many C compilers included // comments as an extension prior to C99 but those were inspired by C++.
This brought back a vivid memory. Sometime in the late 1980s there was a C standards committee meeting in the San Jose area, leading up to the C89 standard.
I was acquainted with one of the committee members and called him to ask if // comments would be included in the standard.
He told me there was no plan for this, but if it was something I felt strongly about, I would be welcome to visit the committee meeting and lobby for it.
I thought about doing this, but didn't bother since all the C compilers I was using already supported // comments.
I also wasn't sure how I would lobby for it.
In hindsight, it would have been a lot of fun to just show up wearing a "sandwich board" with a big // printed on front and back.
Memory is a funny thing. I don't remember the committee member's name or exactly when I called him, but I could tell you exactly where I was sitting and which direction I was facing when we talked. I also think it was before I got married, so that would put the call perhaps sometime in 1987.
Any old-timers here happen to know when that meeting was?
(For anyone wondering what we're talking about, Lua is written in a very portable subset of C including pre-C99, so no // comments.)
I got curious and downloaded the Lua 5.4.4 source and ran this:
$ cat * | grep -c ' */'
6386
(If there is a better or more correct way to do this, anyone feel free to correct me, as my grep-fu is muy pobre.)
So this is 6386 * 3 = 19,158 characters wasted in this version of the Lua source.
And that's just one Lua version.
Let's assume there are ten million copies of various versions of the Lua source on developer machines and repos around the world. That would make this something on the order of 200 gigabytes. We'd better multiply that by 5 to account for backups and datacenter redundancy.
So my selfish and lazy decision to go to the beach instead of the committee meeting that day has cost the world a terabyte of storage, maybe much more.
And that's the least of it. I didn't account for the extra typing that /* comment */ takes, and how it's just not fun to type all that. So I have annoyed every developer who's had to do this for compatibility reasons. Including myself.
If there is a better or more correct way to do this, anyone feel free to correct me, as my grep-fu is muy pobre.
$ cat * | grep -c ' */'
6386
Doesn't that * in your regular expression mean "greedily match as many of the preceding SPACE character as possible including zero, followed by the /" ?
So, what you've done is counted all the slashes in the code. Let's imagine that there are not many divide /, and there are not that many pathname /, so you're double counting the comments and should at least divide your 6386 in half
you want
$ cat * | grep -c ' \*/'
the backslash is protected by the single quotes, so it will get passed to grep where it will mean "literally *" rather than the regular expression operator * (now I'm thinking my \ is going to get swallowed up by HN so I'd better double them? ed: nope, didn't have to double, but I did have to backslash escape the asterisk after literally)
This site reminds me of http://rigaux.org/language-study/ which includes studies of where language concepts originated, lineage of languages, wide ranging syntax comparison (although missing some newer languages) and other interesting things
Does anyone here remember a website, active about ten years ago, that had languages ranked according to statements like, "I feel like I'm not smart enough to program in this language," and, "This language has good support for concurrency?" There was another ranking for different martial arts, IIRC. I don't remember the name of the site and can't find any references to it anywhere.
It sounds like you are referring to a website called "The Hammer Principle" formerly hosted at hammerprinciple.com. The website went down shortly after the owner had collected all the data they wanted.
I collected a bunch of the data in a spreadsheet in March 2014 before the website went down. It covered 51 programming languages and 15 statements about them such as:
It doesn't match exact description and I also have vague memory of something similar, but not able to find it right now. Drew's post does a reasonably snarky job though :)
I'll have to read that. I seem to remember the page having orange elements like HN's, and the language rankings were displayed in tables. I thought it was a really good idea, although I have no idea when or how the initial survey was conducted. The ranking was pretty comprehensive both in the range of questions and the number of languages (although you'd have to wonder how many respondents had any experience with languages like Io or Oz.)
PostScript is both a general-purpose and domain-specific programming language. Can you make that consideration?
Some programming languages that have semantic indentation allow to turn off that feature, such as Haskell. Other more complex considerations than only has or not has, also is relevant for other features of other programming languages, too.
Some programming languages are domain-specific and might only be used in specific programs because it is a narrow enough use, e.g. ZZT, MegaZeux, and Free Hero Mesh; do any of those count? (ZZT is rather limited, but the other two aren't so limited.)
Other features of programming languages to be considered:
- Character encodings
- GOSUB
- Byte arrays
- Generalized algebraic data types
- Sigils
There is also consideration of variants of programming languages.
> PostScript is both a general-purpose and domain-specific programming language. Can you make that consideration?
Ah you are right, the current categorization as a textMarkup isn't quite a great fit and the ontology in PLDB can be improved. I'm linking your comment to a related issue that I hope to address this week. https://github.com/breck7/pldb/issues/39
I don't know enough Prolog to know why you'd want that (please share), but SWI prolog has a SQL interface to run prolog over SQL data, and the author has released it as CSV and JSON, I know SQLite lets you import CSV data, probably other databases do.
JSON to s-expr's should be convertable with simple search-and-replace, or you could just load the file with a json library with reader macros so it loads the data into the appropriate data structures, I'm fairly sure both common lisp and clojure let you read jsons directly like that.
The PLDB documents "over 4000 programming languages". I suspect this is well short of the true number.
"... today... 1,700 special programming languages used to 'communicate' in over 700 application areas." -- Computer Software Issues, an American Mathematical Association Prospectus, July 1965.
Sorry about that. On this page (https://pldb.com/lists/features.html), you'll only see percentage if we have that information for at least 100 languages (https://pldb.com/lists/features.html). I should add an "under construction" or something for the others, to indicate that certain columns are currently very sparse.
The features section is a big part of my focus the next few weeks and hope to fill out that part of the dataset.
While this is a great resource, I was wondering is there any programming language comparison repo where we can find strengths and weaknesses of each language.
> JSON is the only popular language in the PLDB without comments.
Some folks actually tried addressing that limitation (and some others) with JSON5: https://json5.org/
Though sadly it never really caught on outside of a few niche projects. At the same time, however, I've seen some projects out there also use JSONC or another non-standard version that adds comments, since clearly people want them: https://komkom.github.io/jsonc/
Or perhaps it might be better to add it via a group/tag/paradigm/industry or something like that (created an issue to track this: https://github.com/breck7/pldb/issues/39)
This is not only a list of programming languages, but a list of "technologies". To get only programming languages you have to filter on type=pl [1]. JSON is marked with type=dataNotation [2] - so it is a "data notation" language...
PLDB is a comprehensive database of programming languages and their features. The focus is on programming languages, but the database also includes other languages and entities one degree away--from popular high level plain text formats to binary specifications and beyond.
So is this none of one those 'increasingly ill-named' type of things. I guess it's easier to include everything then to try and define what is and isn't a programming language.
You can't have any programming language that is more powerful than that. So technically speaking (HTML + CSS) is a "proper programming language". Just a very awkward one where the user has to "operate the crank on the machine" to execute it.
Turing completeness is a separate axis. There are programming languages that are famously not Turing-complete (for guaranteed halting) and there are (actually, surprisingly many) “things” that are Turing complete, but are not programming languages at all. The latter includes Game of Life, many boardgames and PowerPoint.
As most human things, programming languages don’t have a specific definition, but as a point of reference we should probably have a look at whether that “thing” was ever intended to be used as that. Sure, there is a program that can encode loops into html tags, but it is generally used as a markup language for describing the DOM. Not for programming it.
It's turing complete "so long as you consider user interactions to be part of the “execution” of CSS". So no, it cannot be used to write computer programs.
> The formal definition (simplest) of Turing Machine is simply a tuple of states set, symbol set, initial state, accepting states set and a transition function. There is no crank in it. By computation we mean somebody needs to apply the transition function faithfully on the tape which is exactly like the clicking in this case. More formally, a model of computation can be viewed as a set of rules somebody needs to follow to do the computation. In that sense, I think CSS is Turing-Complete. – Shuhao Tan Jun 11, 2018 at 21:32
The definition of a programming language is a language that can be used to write computer programs. A turing machine is not necessarily a computer program, and a programming language isn't necessarily turing complete.
Yes, but how is this relevant to the question whether (HTML + CSS) is a "programming language"?
There is no restriction on the "device" executing a program.¹
Steam devices like in the case of power looms are for example just fine. As the human brain is in case of say abstractly but formally expressed algorithms (think Ada Lovelace).
Also programmable machines that were in fact run by spinning a crank by a human are considered some kind of archaic "computers" (think for example antique mechanical music devices which could "load" a peace form a kind of card or tape).
(HTML + CSS) can be used to formulate executable algorithms to compute anything computable. You can't be more of a programming language than that! Only that the executing device is a little bit awkward as you need in fact "spin a crank" manually.
___
¹ For example there was this nice Lego Turing machine:
If I would replace the electrical motors by a hand crank would anything fundamentally change?
No, of course not! The machine would be still a universal computer. Only one that needs to be operated "semi-manually"—exactly like a "computer" build in (HTML + CSS).
JSON can be used to write an abstract syntax tree of a program, but the specific grammar used and the way of converting it into a program would be the programming language, not JSON itself.
Any arbitrary string of Unicode characters would be a programming language given that above definition. Which makes of course no sense.
A syntax without predefined runtime semantics is not a programming language!
Without the interpretation semantics no (or every, depending on standpoint) computation can be described by any syntax. The definition of runtime semantics for some syntax is what creates a programming language in the first place.
Pure syntax OTOH can be given arbitrary interpretations. So it's therefore not a programming language on its own. The runtime semantic of some code is what allows us to write and execute programs.
One can't write even the most trivial programs in JSON. No "Hello World" as JSON does not offer any I/O facility. No "fizzbuz" as there are no control structures or any loops in JSON. No "Fibonacci numbers" as there are no function abstractions in JSON…
JSON is just not a programming language.
(Still a valid candidate to include in computer language collection, of course, as JSON has its merits regardless the fact there is no canonical way do write in it anything that resembles computer programs).
For me, and I think for most, the more restricted https://en.wikipedia.org/wiki/Programming_language#Definitio... (“A programming language is a notation for writing programs, which are specifications of a computation or algorithm”) is closer to what makes a formal language a programming language.
I understand whis is pretty much WIP, but still, it's too unorganized to be anything useful. I thought the most interesting to be features page[1], which is nearly empty, and this effort in taxonomy is rather too complicated to be crowd-sourced without supervision. For example, let's take a look at traits[2] and mixins[3]. There are a couple of issues here. First off, why it's 2 different pages? There's no real difference between a trait in PHP, and mixin in… well, no languages except for Racket actually have a syntactic construct called "mixin", but I guess modules in Ruby or Julia are close enough. Scala also has something that's called "traits", and it's also basically the same thing, but with caveats.
On the other hand, D has both "mixins" and "traits", but these are completely different features, and these "traits" have nothing to do with traits in Scala or PHP. So if somebody were to make a comprehensive list of features of D in this DB, should these "traits" appear on the same page as PHP and Scala traits (which are mixins)?
Furthermore, unlike PHP, Scala, Ruby or Julia — Python's "mixins" aren't just mixins with a different name. It's not even clear if it has mixins at all. There's something people call a "mixin" in Python, but these are just classes, so you cannot really say "yes". However, Python has multiple inheritance, which makes "mixins" borderline pointless: classes are (or can be used as) mixins, if you have multiple inheritance! Templates in some languages can be used this way as well.
Which brings us to the next issue — it's not clear, if a language should be marked as having a feature if it comes built-in, explicitly, or if a feature can be implemented in it. Does every language have a semaphore? I cannot remember any where it couldn't be implemented (that would be weird), but I cannot remember any where it's an explicit feature construct either (well, arguably, maybe some SQL-extensions?).
All this isn't to say that the current list is bad. All the questions above can be answered in any way, and it's up to a "researcher" which definition to use in order to actually get a useful taxonomy. It's a non-trivial job.
This is pretty cool! I've thought about making something similar myself. Nice to know I can contribute to something instead of creating it from scratch.
https://lite.datasette.io/?csv=https://pldb.com/pldb.csv#/da...
Here's a more interesting query: https://lite.datasette.io/?csv=https://pldb.com/pldb.csv#/da...