The FAQ of comp.lang.prolog is maintained as a Prolog source file
metalevel.at
metalevel.at
But for some reason, every f* new task is always first solved with some interpreted weakly typed scripting language, shell script or batch file, config file, xml programming, open source tool or web service. Unversioned, and with the weakest tool and team support imaginable. Probably a separate git repository with separate login credentials is created somewhere along the way as well.
But, Swi has my back on that, too:
https://www.swi-prolog.org/FAQ/PrologLAMP.txt
Can I replace a LAMP stack with SWI-Prolog?
Yes, you can, and you'll be happier for it.
LAMP is short for the following open source components to realise a web
server:
Linux
Apache
MySQL
PHP
In this picture, Linux provides the OS, Apache the web server, MySQL the
database and PHP server-side scripting facilities. In fact, most of these
components can be replaced. One can replace Linux with almost any other OS,
Apache with Nginx, MySQL with PostgreSQL. PHP is similar to ASP.
There are also larger replacements of this stack, such as Tomcat, which
replaces both Apache and PHP. Similar architectures are available for Python
(django), Ruby (Ruby on Rails) etc. As we will see below, this is the picture
into which SWI-Prolog fits.
The SWI-Prolog web framework
The SWI-Prolog web framework (obviously) does not replace the OS. It does
replace Apache, PHP and to some extent MySQL. We could refer to the stack as
LP (Linux Prolog). Below, we point at the various libraries that make up the
stack and relate them to the LAMP components they replace.
You can't quite replace html/css/js of course, since the browsers depend on them- but they can be embedded in Prolog easily. I believe the http library in my other comment here has facilities to do this.Also- if you ever need to write a parser for some topsy-turvy ad-hoc markup language some third-party is using that you are forced to process, Prolog is probably the best language to do this, thanks to its Definite Clause Grammars notation that's basically BNF, except that it's not restricted to context-free grammars:
Nice pun (not sure if intended).
Maybe it's a bug on your phone or the HN codebase?
Also, I hope I'm not rude to point out that I expect people interested in an article on Prolog to have a non-phone computer that they can read this more comfortably on.
I do have a laptop, of course, but I’m not always near it. Mobile web is not a niche use case in 2020.
Code blocks, in some cases, are just the simplest way to quote things. Random people on Internet forums should not have to compensate for other people not being on devices that make sense for an Internet forum.
Sure- but is it that urgent for you to read my comment right now? Can't you wait to get to your laptop?
Would you post a comment here in a language only you speak? No, because the point of commenting is communication, and that comment wouldn't be communicating, right?
† Many people only view HN on mobile. It's a time-killing social news app; I don't want it anywhere near my workstation!
-- Alan Kay
Direct your complaints to the source of your problem, namely the shitty browsers on mobile. Even suggesting to let HN fix their abysmal stylesheet would be wrong. Go to the source -- and if it turns out they don't care about requests to provide actual tools, tell them off.
Folks should not underestimate the benefits of having a single primary common language everywhere.
Indeed, that's why I'm getting past my static HTML comfort zone and trying out the SAFE template for F# development on both client and server via .NET Core. Super new at it, but excited to learn.
Apparently there is this thing out there called Fable that lets you use the same domain types on both client and server, now THAT sounds like fun to me.
I read a wonderful article some time ago (here maybe?) arguing exactly this, and positing that any language unsuitable for replacing every other language in a company is insufficiently powerful. As I recall, by 'language' the author meant every single computer language: shells, interpreted scripting languages, compiled languages, perhaps even markup languages.
IIRC, the author came from a Lisp background, which shouldn't really be surprising: so far as I am aware only Lisp and maybe Forth would do a decent job at all those tasks.
I don't care about extending most of my tooling, I just want it to work. I'm not going to spend years rewriting Terraform in Rust just because I don't use Go in my company.
Fair point in that case, though.
Language purity is great as an intellectual pursuit but it shouldn't distract you from picking the best tool for the job.
I have no issue with people picking tools written in their preferred language if that is the differentiator between two competing solutions. However picking the wrong tool because it's written in the right language is a fools move. Which is the point I'm making. Language purity is great just so long as it doesn't lure you into using shit tools.
> You can debug it
That's your strongest counterargument and I agree it is easier if it's written in a language (or at least ecosystem) that you're already skilled in. But you have to be careful not to overstate the importance of this feature ie is it a tool that likely needs to be debugged using your preferred language tools (eg is it a simple tool, or stable and mature. Does it already have a suite of debugging tools available thus not requiring engineers to debug the executable itself? Are other tools like strace better suited for debugging instead of language-specific tools, etc).
There's very few tools I use daily that I've needed to debug. Even fewer that I've needed to resort to source code and language debugging tools.
> and it probably provides an API in your main language
That's a huge assumption to make. However if it does and it's an API you're likely to use then that is a differentiating feature which makes it the best choice tool and plus the tool is no longer something you're not using to develop in house.
So your point actually aligns with the point I was making.
> Bonuses: It integrates with your other tools
Again, that becomes a feature and thus you're not picking a tool for language purity reasons thus not violating the point I was making.
> You can fork it if necessary.
It's almost never necessary to fork a tool your using outside of your development framework (and if it is part of your development framework then it's something you are expecting to maintain so that point was covered in my previous post).
Or to put things another way, how many people here have forked Terraform to run their own distinct version of it?
If it's a tool you think you might like to fork or maintain then again, that's not violating my previous post since you picked that tool with the plan to maintain.
> You talk the language of their support forums
This is your weakest argument. :)
I've never typed a line of TypeScript in my life yet can talk in depth about it with the TS developers when issues arise. Why? Because I've programmed in well over a dozen other languages and the way we communicate different concepts doesn't generally change that radically from one language to another.
> And you don't know in advance whether you will need to submit patches.
You can make a reasoned guess though. A bug in the Linux kernel: I think I'll raise a bug report and leave that to others to fix. A bug in Terraform: then maybe I might submit a PR but odds are I wouldn't have the time to learn the code, devise a fix, write tests, etc. Again, I'd probably end up raising an issue on Github and working around the problem at work. Anything higher level than that then perhaps I'd raise a PR but choices often get more diverse and the impact of picking "the wrong tool" becomes less significant.
API: Like patches, you might not need it now, or the API might not even exist yet. Fork: Agreed, that was not a realistic scenario. Maybe a better argument would have been the ability to write plugins or extensions (even if you do not need them now). Forum: Yeah not really important. Patches: Agreed, who has time for patches. Like forking, probably not going to happen. Additional (weak) argument: Better paradigm / metaphor match between tool and your system.
But yes, other factors are probably even more important, like will the tool still be actively maintained in 10 years? How big and active is the company / community behind the tool. How mature is it. How big is the existing user base. Cost, support options...
Their point is software you actually develop in house. So that might be HCL code used by Terraform (in which case you might still need to use another tool or SDK in place of Terraform) but it wouldn't be Terraform itself (ie the Go code used to compile the Terraform executable).
Well, I'd say that one must start at the highest level and work one's way down. Clearly there're neither time nor resources to write an amd64 OS in Lisp when one is trying to get one's AirBnB-for-pools app out the door. But maybe one can give a little love to Hunchentoot. Maybe one can spend some time replacing Makefiles with ASDF. Maybe at some point one might even replace some uses of the shell itself. Maybe someday one might spend some time on SBCL.
And sure, someday, if one's firm really lucks out and achieves Google scale then maybe one will have the resources to build a new compiler or even a new OS.
So I guess I am somewhere between the two positions, at least if I wear the hat of the original article's author. I think it could make sense to write everything in one language, and I think maybe someday it might make sense to go a level deeper — and maybe someday further still a level yet deeper.
Because it would be nice, someday, to get something better than Unix-like OSes!
Also, I am a man, not a group: 'he,' not 'they' please grin
At least with your Makefile example, you'd need to edit and maintain those Makefiles, so there is logic in rewriting them in $LANG_PREFERENCE.
But if you're rewriting services you wouldn't otherwise need to maintain just for the sake of language purity then you have to ask yourself if what you're doing is a smart use of your time or if you're actually just "shaving a yak".
> Also, I am a man, not a group: 'he,' not 'they' please grin
It's often impossible to know the gender of someone, let alone their preferred pronoun, from their post alone. So you're going to run into a lot of people saying "they" when referring to you.
edit: getting a lot of downvotes on this so it's clearly an unpopular opinion. I probably should point out I've ran several development teams over the years and it's very easy to go down the rabbit hole of NIH. There's a saying about "standing on the shoulders of giants" which I think applies here; and there's no shame in sacrificing language purity if it gives you increase productivity without any side effects (aside selling off a little of your soul). The key is being able to balance need from want. eg does that orchestration tool need to be written in $LANG_PREFERENCE or does this one on Go actually work pretty well? The ironic thing is as we get more accustomed to using cloud tools, we're becoming more reliant on stuff written which we have no visibility of. So in a way, the language purity war has already been lost.
I'm a systems guy in a Java shop. Ignoring obvious nonstarters like trying to shove Java into early Linux boot, this still implies I should be hiring Java programmers for systems engineers. Which, no, not only don't I care, doing that would select for a very small subset of available candidates.
A nice thought experiment, but not practical.
There are multiple reasons, but the big one is there is almost no overlap between the engineering team's reason for existing (writing and maintaining line-of-business applications) and ours (keep systems up, compliant, performant and safe).
But if it makes you happier, one tool we use is Puppet. That runs in JRuby in a JVM to execute their own weird DSL. So to use it in a nontrivial environment, you need to be able to tune Java and write both Ruby and Puppetese.
Yes, you should use a relatively small toolset and use it well. Whether that toolset is prolog or JS or bash or whatever depends entirely on your needs and requirements and will vary from team to team.
If bash scripting meets your needs, then use bash scripting! There's nothing wrong with it. Likewise for clojure or C# or any other tool.
For small one-off tasks or simple services, your company should have a template for writing those in a good scripting language: Python, Ruby .. something you can write tests/specs for if it grows, that has a good amount of programmers you can hire, etc.
Your core service apps might be written in something different, that can scale up, whether that's a JVM lang (Java/Scala/Clojure/Kotlin) or a .NET (C#/VB.Net) or Elixir or Rust or whatever depends on a lot of things. You want to have something your core programmers enjoy writing in, but also something you can find new people for as your company expands. It can be a delicate balance. You can have multiple core languages (my current company is Node/React for most front end, React Native for apps, Clojure for almost all backend, some .NET and Python/Go/Terraform for all devops).
It's best to have a core tech stack with some choice than just let every team do anything in whatever. But of course, it's dependent on your company and market. Your mileage will vary.
Also, junior people will translate "code I will never be able to check in anyway" to "perfect opportunity to play around with that new language I want to learn" and then you've got them making the usual mistakes as noobs in that language.
Assuming you’re a C/Java shop, why not? You get to leverage all of your coworkers code to make that little CLI app. The whole thing will probably be “parse args and then call an existing method.”
Then that little tool is part of your app, callable wherever your app is, stored in Git, testable with your existing tools, etc.
And that's another big issue with Java. If you start out writing plain Java, people feel like they're missing out on all the "help" they'd get from a framework, and pretty soon you can't figure out how to make your code run at all except inside the framework. So you have to either write your scripts using the framework's CLI helper, which is probably some enormous abstract class that has its own argument parser you have to integrate with, or you start reverse engineering the framework's CLI helper to figure out which parts you need and end up running out of time and falling back to Python and swearing to figure it out someday. That's my experience, anyway.
Why not in Java?
For some weird value of 'It'. People went way overboard, but early Java really was as expressive as a stone mask.
But also, a developer may not even write it if he or she feels pressured to do this.
Here's a thought experiment: say you're seeding data into your local database server using the `mysql` CLI.
- Would you write and check in shell script to do this, so coworkers can use it? Probably yes.
- Would you write a Python script to do this? Probably no.
- Would you write a Java or C program to do this? No way.
But they are time-consuming to write in mainstream languages, so developers often won't do it if that's their only choice.
https://www.swi-prolog.org/pldoc/doc_for?object=section(%27p...
And of course, a lot of support for the semantic web:
https://www.swi-prolog.org/web/index.txt
The entire Swi-Prolog website at https://www.swi-prolog.org/ runs on the Swi-Prolog web libraries - they call it "eating your own dog food":
https://en.wikipedia.org/wiki/Eating_your_own_dog_food
The first alternative phrase is hilarious to my German ears.
Seems to be Microsoft internal comms, 1988.
Swi-Prolog really is an amazing ecosystem.
Accept: text/plain
Would be nice if it could provide either based on the Accept header.Michael Hendrick's "Production Prolog" talk gives a demo of this (at 12:17) https://www.youtube.com/watch?v=G_eYTctGZw8
https://github.com/sumdog/assignments/tree/master/csc4240-pr...