So... I want to like Lisp, and every time I read stories like these I understand why people enjoy it.
But then I see a code snippet, something like this manual datetime string parser. Apparently the programmer needed to roll their own, and I wonder: how on earth am I going to convince my corpo overlords that this language belongs anywhere near a production system?
(let ((year (parse-integer string :start 0 :end 4))
(month (parse-integer string :start 6 :end 7))
(day (parse-integer string :start 9 :end 10)))
(- (+ (\* year 31556926) ;; no. of seconds in a year
(\* month 2629743) ;; no. of seconds in a month
(\* day 86400)) ;; no. of seconds in a day
(\* 1900 31556926)))) ;; lisp timestamps start at 1900
I inherited an enterprise-critical application in, I kid you not, Autohotkey. 5000 actual lines of it, none of them containing any sanity whatsoever. Apparently, some random end user decided to automate a job, other people liked, and it grew all kinds of unholy features. So after one very visible crash too many, the corporate overlords decided it was critical enough for IT to take over.
By the time I got it, most of it was calls to Win32 functions, and almost nothing was using any functionality Autohotkey was any good at. I didn't even dare talk about it on the Autohotkey fora at the time, because I was sure the developers themselves would consider me an insane idiot and/or hit me with an axe. I migrated it to another language the day I understood it well enough.
One of the great truths of ICT is: Anything can survive production if someone decides to bless it with insane amounts of time and money.
One of my first jobs was converting this crazy web-first language (HTML/OS) into PHP and/or ASP.NET. The language was like BASIC for the web, and there was so much superstition based on how things actually worked (things like having an empty ELSE on an IF statement because one time something broke and that might be why). I also drastically reduced memory and CPU usage, even taking some multi-hour jobs down to seconds. Luckily this was around 2007 and I have since intentionally forgotten most of that language.
Common Lisp has a decent (but not amazing) number of well supported libraries. It's usually not a problem, except for perhaps really enterprise-y stuff.
But Common Lisp is not the language to use in production (at least in a larger commercial
context!) if your primary need is CRUD or glue. It does fine at those things, but Lisp is better wielded at problems that require "power in the large", like building a new compiler, solver, simulator, or "engine" of some sort, for instance. For those, the programming language matters a lot more than the libraries, in my opinion.
I've had no issue using Common Lisp in production and employing teams to write and maintain it.
Well, let's clarify something - is it the syntax or the self-algorithm?
To compare, this is what a psuedo-popular-lang might look like:
let year = parse-integer(string, start=0, end=4)
let month = parse-integer(string, start=7, end=7)
let day = parse-integer(string, start=9, end=10)
return ((year * 31556926 + ;; no. of seconds in a year
month * 2629743 + ;; no. of seconds in a month
day * 86400) - ;; no. of seconds in a day
1900 * 31556926) ;; lisp timestamps start at 1900
Honestly that looks pretty run-of-the-mill to me.
Having said that, rolling your own date logic is insanity, as the problem is difficult[1] yet solved[2].
>how on earth am I going to convince my corpo overlords that this language belongs anywhere near a production system?
Well, I don't see any difference with any other language you could use, from SQL, to C ,CSS or JSON.
The fact is that the higher your corpo overlord, the less is he going to understand your scrawl.
Instead of them understanding your language, it is you who need to speak theirs. You will need to understand MBA talk in order to communicate in simple terms(elevator pitch) why you using this weird language is important for the company.
Then they will leave you alone if what you promised is true, or just fire you if it is not.
This is true. Usually you have to convince your own colleagues, not management. (Obviously everywhere is different though.)
Your senior software engineering colleague who is a huge "Python is the second best at everything" fan will be more of a hindrance than your boss, typically. It's not wholly invalid, but it can easily become a social/political issue rather than a technical one. If someone else is proposing a popular approach (like building a backend in Python), and you're proposing an oddball one (like using Lisp), be prepared for their solution to start off with 50 points of consensus and yours zero.
Given that so much of building anything new and delivering it in a timeframe that is useful is risk management, I think that's the right place to start. Especially at a company where the risks of Python are mostly known and the risks of lisp are mostly not.
Well, yes, the Common Lisp standard library is showing its age in some respects. I think if you're aiming to use CL in production, you have to plan to paper over some of the standard library deficiencies with third party libraries or custom implementations. And then your concern is already accounted for.
(This goes for many other languages too. C, JavaScript, Java, Haskell, R, Perl -- they all have their "holes" in the standard library that need to be filled in.)
Except we just brought the JVM onboard, with its own headaches. The JVM is arguably as much of an obstacle to developing solutions as boilerplate in Java. You end up having to debug obscure JVM errors in production instead of sticking to Clojure. It’s also not doing any of the compiler tricks CL and schemes are noted for.
What obscure JVM errors do you talk about? I’ve never ever had a JVM bug and while I don’t have decades of experience, I didn’t start today either. The JVM is hands down the easiest to debug platform, where you can connect to a prod instance remotely and see basically everything. Clojure does have a few not too readable errors, but I think that’s on Clojure’s semantics, has nothing to do with the JVM.
The idea that “a month” has a constant number of seconds (edit: exactly 1/12th of a year) seems peculiar, so I’d argue the function needs to be more complicated.
Pretending that something like that doesn't already exist in production, feels like a lie. As a fun example, I was looking to store durations in iso format, and saw how our analysts would have to parse that out in our data warehouse.
There's certainly a widely-used library for this (local-time). But there's also a widespread practice in CL to avoid unnecessary dependencies, partly because it's often so easy to write just the functionality you need. That's probably the case here.
Yea it’s tough. No matter how many times people say, you get the parenthesis eventually, it still is off putting for people when they see it the first time. I'm a big Lisp fan and the parenthesis don't bother me at all. But it's always going to be a sticking point with some people.
This is a big reason for the Rhombus project in Racket[1] one of it’s main goals is to be a Lisp like language which combines the extensibility of a parens based language, with infix notation and a different surface syntax
But then I see a code snippet, something like this manual datetime string parser. Apparently the programmer needed to roll their own, and I wonder: how on earth am I going to convince my corpo overlords that this language belongs anywhere near a production system?