loading...

Discussion on: Programming without a programming language

Collapse
paddy3118 profile image
Paddy3118

Hi,JavaScript and PHP are limited to the web domain of programming, and so not normally classified as general purpose.

Collapse
ihusnja4 profile image
Ivan

I have to correct you there.

Though both JS and PHP were designed to work in web environment (one on client other on server respectively) that changed over the years.

Nowadays you can use JS to build CLI, mobile or even desktop apps...

PHP did not traverse into client side (not directly anyway), but is used as cli scripting language. It is possible to do many other kinds of apps but there are far better tools.

What makes a GPL not being the DSL anymore is its (potential) usefulness in other area and evolution. Almost every GPL started as someone's pet project or DSL... people made it GPL

Collapse
paddy3118 profile image
Paddy3118

It's not a matter of what you can do; it's what most people actualy do with the languages. Read the online articles and blogs and the overwhelming javascript and PHP texts have been, and remain web related. The web is a large domain, and they often used within it, but very few people write about using them in areas unrelated to the web.

If GP is what a language could be used for then you need to work harder to distinguish the domain specific - if they are turing complete then there is nothing stopping them from being used outside of their domain.

Thread Thread
gtanyware profile image
Graham Trott Author

Although I think it's incorrect to state that PHP and JavaScript are limited to the web domain (Qt bindings are available for both, for example) I accept that's where both are most commonly found. Overwhelmingly so, in fact. However, it seems the more I look at the term general purpose the more ephemeral it becomes. "Turing complete" - that is, the language has conditional execution and the ability to read and write data - covers any of the languages listed, including my own, so as you say, something else is needed to make a distinction.

One of the biggest challenges in designing a language (as the authors of JS have discovered) is in ensuring it remains unambiguous as it develops. Human languages are notoriously prone to ambiguity, which limits how close we can get to that "gold standard" when designing machine languages.

Even the term "Turing complete" might be less than exact. For example, how about a language that has no read/write commands of its own but which supports network sockets that allow a local REST server to do I/O jobs for it? JavaScript in its browser sandbox seems to fit in that category.

Perhaps any attempts to classify languages should start by restricting themselves to the core language and ignoring all the associated libraries and frameworks.

Thread Thread
paddy3118 profile image
Paddy3118

Nicely put😊

Collapse
gtanyware profile image
Graham Trott Author

Good points, Ivan. When I cited HTML and SQL I was aware that although both are domain-specific they are also de facto standards the whole world uses. The conclusion being that although most DSLs start off as "pet projects" - or are born out of necessity as in the case of the one in my article - some have the good fortune to go on and become established. PHP and Python could probably be classed as former pet projects, whereas JavaScript - along with VBScript - was conceived to serve a particular need at the time. However, the distinction is rather arbitrary, as most projects come from someone's perceived need, rather than "I think I'll write a new language just for the hell of it".

A question implicitly raised by Paddy3118 is "what defines a web language?" Although PHP and JavaScript are both supported by huge amounts of code that targets web applications, neither of the languages themselves are heavily slanted to web use and both are quite capable of doing many of the jobs you might use Python or Java for. The two DSLs I'm currently developing are internally very similar, but the JavaScript one is definitely web-oriented and the Python one is definitely not. (The Python one is somewhat better written; it benefits from the experience I gained doing it in JavaScript, but both are in fact derived from an original I wrote in Java 20 years ago. This old dog has been chewing the same bone all that time.)