News for hackers. Stuff that matters.
Re:Lessons learned after working one year as a Common Lisp D... by isoprophlex on Friday December 10, 2021 @01:41AM (#29507078)
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
Re:Lessons learned after working one year as a Common Lisp D... by hyperman1 on Friday December 10, 2021 @05:11AM (#29508292)
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.

Re:Lessons learned after working one year as a Common Lisp D... by progmetaldev on Friday December 10, 2021 @11:30AM (#29511800)
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.
Re:Lessons learned after working one year as a Common Lisp D... by seanw444 on Friday December 10, 2021 @10:36AM (#29511094)
100% to that last paragraph.
Re:Lessons learned after working one year as a Common Lisp D... by reikonomusha on Friday December 10, 2021 @02:39AM (#29507418)
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.

Re:Lessons learned after working one year as a Common Lisp D... by martinflack on Friday December 10, 2021 @10:21AM (#29510906)
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].

[1] https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b... [2] https://common-lisp.net/project/local-time/manual.html

Re:Lessons learned after working one year as a Common Lisp D... by bidivia on Friday December 10, 2021 @04:26AM (#29508039)
>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.

Re:Lessons learned after working one year as a Common Lisp D... by reikonomusha on Friday December 10, 2021 @04:30AM (#29508070)
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.

Re:Lessons learned after working one year as a Common Lisp D... by hiptobecubic on Sunday December 12, 2021 @12:08PM (#29531315)
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.
Re:Lessons learned after working one year as a Common Lisp D... by jackdaniel on Friday December 10, 2021 @04:17AM (#29507993)
Perhaps they didn't know about a library local-time[1]? You can't blame the programming language for the programmer shortcomings.

[1] https://common-lisp.net/project/local-time/manual.html

Re:Lessons learned after working one year as a Common Lisp D... by pjmlp on Friday December 10, 2021 @05:36AM (#29508406)
I once saw someone had implemented the Calendar class from Java (when Java 6 was the latest version). Apparently reading javadoc wasn't his thing.
Re:Lessons learned after working one year as a Common Lisp D... by kqr on Friday December 10, 2021 @01:51AM (#29507157)
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.)

Re:Lessons learned after working one year as a Common Lisp D... by pjmlp on Friday December 10, 2021 @05:35AM (#29508404)
By adopting either Allegro or LispWorks, the Common Lisp environments for big corps, survivors of the Lisp Machine IDE like tooling.

Not only they are the survivors, they also come with additional libraries for all kind of stuff not covered by the standard.

Re:Lessons learned after working one year as a Common Lisp D... by simongray on Friday December 10, 2021 @01:53AM (#29507168)
> how on earth am I going to convince my corpo overlords that this language belongs anywhere near a production system?

This is part of the rationale behind Clojure, being able to lean on established platforms (Java and later JS): https://clojure.org/about/rationale

With that said, though, that parsing function doesn't seem all that complicated?

Re:Lessons learned after working one year as a Common Lisp D... by iostream23 on Friday December 10, 2021 @03:40AM (#29507772)
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.
Re:Lessons learned after working one year as a Common Lisp D... by kaba0 on Friday December 10, 2021 @05:13AM (#29508301)
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.
Re:Lessons learned after working one year as a Common Lisp D... by simongray on Friday December 10, 2021 @03:52AM (#29507840)
There is no silver bullet. Clojure is a great set of trade-offs.
Re:Lessons learned after working one year as a Common Lisp D... by darrenf on Friday December 10, 2021 @03:33AM (#29507731)
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.
Re:Lessons learned after working one year as a Common Lisp D... by dm3 on Friday December 10, 2021 @04:12AM (#29507963)
It's using a standard-year/month/day convention which might be what's required in that particular case. It's definitely not a generic solution.
Re:Lessons learned after working one year as a Common Lisp D... by hiptobecubic on Sunday December 12, 2021 @12:09PM (#29531330)
The point is that it's wrong.
Re:Lessons learned after working one year as a Common Lisp D... by taeric on Friday December 10, 2021 @01:47AM (#29507135)
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.
Re:Lessons learned after working one year as a Common Lisp D... by NoGravitas on Friday December 10, 2021 @10:37AM (#29511100)
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.
Re:Lessons learned after working one year as a Common Lisp D... by Decabytes on Friday December 10, 2021 @08:30AM (#29509586)
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

1. https://github.com/racket/rhombus-prototype