9 ms·
The Lisp Curse (2017)
- Flankk 4y ago> Real Hackers have also known, for a while, that C and C++ are not appropriate for most programs that don't need to do arbitrary bit-fiddling. Strongly disagree with this statement. I've read it so many places now that it has to be a meme. I actually wish I could use C++ on the web instead of this JS nightmare ecosystem. I don't understand where the idea comes from. I'm never "bit-fiddling" in C++ and almost never need to use pointers.
- vaylian 4y agoWebassembly might be the solution to your problem
- Flankk 4y agoOn the frontend. In a number of years. It's in its infancy. Instead of hacking a webpage to behave like software it actually will be software. So I'm pretty excited about the idea.
- mtreis86 4y agoOn the opposite end, Common Lisp is actually pretty decent for bit twiddling. It has the operators from the PDP instruction set, LDB and DPB, which load and deposit bytes of varying length from and into other numbers.
- deleted 4y ago[deleted]
- bayesian_horse 4y agoWhoever says things like that probably means "appropriate" in the sense that you can get your stuff done with another language using a fraction of the implementation time. And whoever wishes to use C++ on websites... who is stopping you since Webassembly? Speaking about ecosystems... I also don't think the package management ecosystem in C++ is that much better, right? And there are enough horror stories about illegibility and foot-guns even in modern C++ code, rivaling the worst YOLO frontend style... C++ requires you to be a lot more verbose and precise for almost everything. That translates to more work, and the benefit isn't automatically worth anything.
- Flankk 4y agoWasm is bleeding edge. AFAIK the only compatible UI library is Qt and support is not production ready. I have never needed package management in C++. There are gotchas with all languages, Lisp is not a panacea. Language verbosity is not bad it's a tradeoff, functional languages are usually hard to read. The language requiring you to be precise is a good thing. There's a reason the web industry has moved to TypeScript.
- bayesian_horse 4y agoWasm is not just bleeding edge, it is supported by all major browsers and being used in all sorts of real-world websites. No, "Qt" is not the only way to do UI in C++/wasm. This is a basic misunderstanding of the technology. Wasm lives inside the Javascript vm and can manipulate DOM objects all day long. It's just not very practical to do so. There are plenty of Rust projects going in that direction, though... C++ doesn't only require you to be precise, it requires you to be verbose. JS is quite precise, and a lot more expressive because of the runtime. TypeScript is all of this and also allows you to be more explicit in order for the compiler to check your work, much like a proof checker. The C++ type system is relatively stupid compared to that of TypeScript and F#, for example. In TS and F#, you can use types to help you, in C++ you already need the types because otherwise the compiler doesn't have a clue what to do.
- scns 4y agoYou can: https://github.com/scylladb/seastar https://github.com/scylladb/seastar
- klibertp 4y agoIn my experience the best for "bit-fiddling" is Erlang (and, by extension, Elixir) which offers bit-string literals[1], along with pattern matching on them. It's trivial to implement any binary protocol or parse any binary file format with these. It makes bit-fiddling pleasant and fun, but nobody ever mentions Erlang in these discussions. That's because most programmers are incapable of making any informed decision about the language they use (and, even more so, about languages they don't use). There's a strong tribal mentality, a lot of cargo-cults, and the very narrow perspective on what's possible and (more importantly) what's desirable is prevalent. [1] https://www.erlang.org/doc/programming_examples/bit_syntax.html https://www.erlang.org/doc/programming_examples/bit_syntax.h...
- lisper 4y agoCommon Lisp has bit string literals: Welcome to Clozure Common Lisp Version 1.11-r16812M (DarwinX8664)! ? #*010010010101001 #*010010010101001 ? (type-of *) (SIMPLE-BIT-VECTOR 15)
- klibertp 4y agoI think it's not unusual to have base-x number literals (even Python got `0b01101` literals at some point), but not many languages support pattern matching on bitstrings. In Erlang, it looks like this: 1> A = 2#0010010010101001. 9385 2> << _:2, B:4, _/bitstring >> = << A:16 >>, B. 9 3> io:format("~.2B~n", [B]). 1001 I put your number into 16-bit bitstring[1], then ignored first 2 bits, extracted the next 4 bits, and ignored the rest. CL doesn't have pattern matching in the standard, IIRC, but there are libraries implementing it, so I wouldn't be surprised if one of them also offered bitstring matching, but that's beside the point: I'm comparing Erlang and C++ here, not Erlang and CL. [1] It could be 14 or 15 bits, but I wanted to have a bit of a leading padding to ignore in the pattern. EDIT: I missed the fact that the #*01... literal in CL is not a number, my bad. The equivalent literal would be << 2#01...:N >> in Erlang, but you need to give the N (number of bits) yourself, so it's a bit less convenient.
- dkersten 4y agoI like working in C++, after a decade of working in Java, Python, Javascript and Clojure, I find working in C++ (which I learned before these other languages) to be quite fun and pleasant, at least with relatively modern C++. I've been, on and off, working on a little toy game engine, for a few years. Its a mix of keeping up with C++ advancements, learning various concepts like physically based rendering, and just the fun of crafting a big project, with no constraints other than my time and ability, no deadlines, no expectation of releasing anything. Its cathartic and enjoyable. I really do enjoy it. Last September, I got frustrated with something I was working on in a more serious capacity. It was some server software, it responded to HTTP requests, it accessed third party services over HTTP and Websockets, it talked to a Postgres database. Overall it was an event driven system that transformed data and generated actions that would be applied by talking to third party services. The "real" version was written in Clojure and it worked pretty well. I really like Clojure, so all good. But because I was frustrated with some things about how it ran and the resources it took up, I wondered what it would be like if I developed a little lean-and-mean version in C++. So I gave it a try as a side project for a few weeks. I used doctest[1] for testing, immer[2] for Clojure-like immutable data structures, [3] lager for Elm-like application state and logic management, Crow[4] for my HTTP server, ASIO[5] and websocketpp[6] for Websockets, cpp-httplib[7] as a HTTP client and PGFE[8] for Postgres, amongst some other little utility libraries. I also wrote it in a Literate Programming style using Entangled[9], which helped me keep everything well documented and explained. For the most part, it worked pretty well. Using immer and lager helped keep the logic safe and to the point. The application started and ran very quickly and used very little cpu or memory. However, as the complexity grew, especially when using template heavy libraries like lager, or dealing with complex things like ASIO, it became very frustrating to deal with errors. Template errors even on clang became incomprehensible and segmentation faults when something wasn't quite right became pretty hard to diagnose. I had neither of these problems working on my game engine, but both became issues on this experiment. After a few weeks, I gave up on it. I do think I could have made it work and definitely could go back and simplify some of the decisions I made to make it more manageable, but ultimately, it was more work than I had free time to dedicate to it. So my experience was that, yes, you can write high level application logic for HTTP web backends in C++. You can even use tools like immer or lager to make it feel very functional-programming in style and make the application logic really clean. Its not hard to make it run efficiently both in terms of running time and memory usage, certainly when comparing to Clojure or Python. However, I found that over all, it just wasn't as easy or productive as either of those languages and I spent more time fighting the language deficiencies, even with modern C++, than I do when using Clojure or Python. I think I would think very long and hard before seriously considering writing a web backend in C++. If I had the time, I'd love to retry the experiment but using Rust, to see how it compares. [1] https://github.com/doctest/doctest https://github.com/doctest/doctest [2] https://github.com/arximboldi/immer https://github.com/arximboldi/immer [3] https://github.com/arximboldi/lager https://github.com/arximboldi/lager [4] https://github.com/CrowCpp/crow https://github.com/CrowCpp/crow [5] https://think-async.com/Asio/ https://think-async.com/Asio/ [6] https://www.zaphoyd.com/projects/websocketpp/ https://www.zaphoyd.com/projects/websocketpp/ [7] https://github.com/yhirose/cpp-httplib https://github.com/yhirose/cpp-httplib [8] https://github.com/dmitigr/pgfe https://github.com/dmitigr/pgfe [9] https://entangled.github.io/ https://entangled.github.io/
- deleted 4y ago[deleted]
- adregan 4y agoOP posted despite the opening paragraph! > Update on October 6, 2017. N.B.: Please stop submitting this to Hacker News! Look at the Hacker News search results for this essay. Check out the note for the first entry: Come on, everyone! Let's beat the dead horse one more time! Past discussions https://hn.algolia.com/?query=The%20Lisp%20Curse&type=story&dateRange=all&sort=byDate&storyText=false&prefix&page=0 https://hn.algolia.com/?query=The%20Lisp%20Curse&type=story&...
- coldtea 4y agoThat's a plea from 5 years ago. People resubmit stories all the time, new and better (or different) discussions form around each resubmission, and new people get to read it.
- badsectoracula 4y agoAFAIK it is common to repost a story here if there has been enough time since the last post since there can be new voices, opinions, etc since the last time it was posted. Dang sometimes posts a comment with links to previous discussions too. Perhaps the author is confusing the norms with Reddit where in many subreddits reposts are often frowned upon.
- usefulcat 4y agoshrug. The way things work is people upvote things because they find them interesting. If enough people hadn't upvoted it, it would never have showed up on the front page, and most people probably wouldn't have seen it. Anyway, I'm not sure why they care that it gets resubmitted..
- _hcuq 4y agoIf Lisp is do efficient for development, why are there essentially no commercial products that use it?
- davidgrenier 4y agoThe answer is always that popularity doesn't correlate with merit.
- tharne 4y ago> The answer is always that popularity doesn't correlate with merit. Exactly. If we used popularity and usage rates as the measure of merit, we'd have to conclude that the highest quality restaurant in the world is MacDonald's.
- scns 4y agoHigh quality ingridients are costly too.
- eimrine 4y ago> the highest quality restaurant in the world is MacDonald's. Isn't it so? The meal is enough healthy (for hard-workers only, not for calories-gathers), calorage as I have mentioned is excellent, waiting is minimum, non-meal payings (keeping the restaurant attractive) are the lowest possible, the most important thing is that in poor countries (my is in the bottom of bigmac index) the prices are lower than anything else available in big cities.
- BeetleB 4y agoI'm one of those who actually likes McDonald's burgers. However, in the last year I decided to stop going there because of multiple experiences with restaurants near me where I ordered to go, and parts of the burger were cold. As in fridge cold. As for price - not sure what you mean by "poor" countries. In the ones I've traveled to, McDonald's is considered a high end restaurant and is not cheap by the local standards.
- davidgrenier 4y agoI just wish more people understood that something being Turing Complete isn't a feature, it's a flaw.
- tharne 4y agoHow so?
- eimrine 4y agoMaybe the previous speaker means the "tragedy of Common Lisp", where (in my understanding of the problem) it was happened to became too much of clever developers which decided to add too much of clever things in main library which are required to be known for keep writing the compiler in same code style (I am not a real programmer but have a sympathy to that answer, please correct me for creating more precise answer).
- mvaliente2001 4y agoIf your type system or log formatter is turing-complete, it can be exploited to do arbitrary unintended things.
- gnulinux 4y agoE.g. you can require all programs to halt, which makes the language non-TC since the language has a trivial solution to its halting problem. There are other ways too, but this is approach e.g. Agda takes. Note that you can still build useful programs this way since such languages can still allow certain forms of recursion such as primitive recursion, structural recursion etc... You can also use sized types [1] to allow even a larger set of (halting) programs. [1] This is a way of compiler statically analyzing the size of each type (i.e. how many recursive constructors necessary) which puts an upper bound on the number of recursions need to be performed.
- davidgrenier 4y agoAlso, Turing Completeness is almost always accidental while non-TC is obtained by design. Hence, just about anything has Turing Completness which doesn't make it a feature. Now if you want to gain the ability to make serious proofs about your programs, one can make the argument you need non-TC.
- arethuza 4y ago"The hardest problem in computer science is not being an opinionated jerk about everything." From the author's home page. Edit: Potentially ignoring that quote - I can't help observing that although I used Common Lisp as my main development language for 6 years in an academic research environment and really enjoyed it I've never wanted to use it since then...
- badsectoracula 4y ago> Making Scheme object-oriented is a sophomore homework assignment. On the other hand, adding object orientation to C requires the programming chops of Bjarne Stroustrup. C++ added a ton of additional stuff to C. The original Objective-C is a much simpler approach on adding object orientation to C and at its core it'd all be about finding expressions like [foo bar:baz boo:hoo] and replacing them with something like obj_send(foo, msg_foobarboo, baz, hoo); and linking with an underlying runtime that handles message passing of course. An alternative would be Turbo Pascal 5.5-style OOP where struct foo : base { foo(); ~foo(); void blah(); } foo::foo(){ base(); } foo::~foo(){ ~base(); } void foo::blah(){} would be accepted but aside from the C++-like syntax for constructors, destructors (which handle the hidden VMT field) and methods nothing is done automatically and instead you are expected to explicitly construct and destroy the objects (if needed), e.g. struct foo foo; foo.foo(); /* call constructor chain */ foo.~foo(); /* call destructor chain */ or struct foo* foo = malloc(sizeof(struct foo)); foo->foo(); /* call constructor chain */ foo->~foo(); /* call destructor chain */ free(foo); Note that Objective-C handles (or handled at the past, not sure how things changed nowadays) allocation and construction in separate steps too. Of course unlike a language with Lisp-like macros you'd need to modify a compiler or write a preprocessor to do the above, which makes it a bit harder, but in any case adding object orientation to C does not mean you have to make it as complex as C++.
- xscott 4y agoYeah, I agree. If you're willing to use a garbage collection library [0], you can even have a pleasant syntax for ObjectiveC style OOP in C: var result = call(foo, "bar: %s boo: %f", baz, hoo); The garbage collector will pick up the stray memory and release other resources (files) as needed, and all the standard compilers will check the varargs format string for you. Dynamic typing, arbitrary messages, and no memory leaks. Just like Lisp. It's not perfect (string message could have typos, and might use %p for objects), but it's not too bad. [0] https://en.wikipedia.org/wiki/Boehm_garbage_collector https://en.wikipedia.org/wiki/Boehm_garbage_collector
- lisper 4y ago
- at_a_remove 4y agoThe results (many many packages doing fifty to eighty percent of what you need) are what drove me from Perl and what makes me very uncomfortable with the growing disdain for the standard library in Python. I really don't want to write my own XML libraries or whatever, I would rather just import whatever the standard solution is. I also do not want to have to do a roundup of the available solutions and try to figure out which is most applicable, then hope that it will actually do the job. A lot of people are very into whatever the language is, but for me, I want a huge standard library.
- rileyphone 4y agoI would argue that rather than some curse of expressiveness, the lackluster showing from the community in recent years has been the results of a premature standards process. Common Lisp hasn't changed since before I was born, and while to some people that denotes stability, it also leaves new features to be done in the manner the author describes, as 80% projects by lone hackers. The language is more than capable of supporting modern development, but simply requires learning too much context and historical baggage to be appealing to any but the most devoted. This has little to do with expressivity, but more with history and economics. Most successful languages have one or more companies devoting resources to the language and libraries. Lisp has multiple implementations of the language but no blessed one, which means the fossilized standards are the point of departure for each of them, many remnants of the era of software you can buy. There are still a lot of interesting things happening with Lisp, but I can't see how Common Lisp will be the path forward. Of course, there have been many challengers seeking to upset it as King Lisp, including this site's very own Arc. Clojure has seen the most commercial success in recent years, though the extent that it's actually a Lisp is debatable. I'm a fan of Kernel [0], which makes macros first class members of the language, like everything else. Who knows, but saying it's power will necessarily lead to its downfall is a kind of fatalistic mentality that I have little patience for. [0] https://web.cs.wpi.edu/%7Ejshutt/kernel.html https://web.cs.wpi.edu/%7Ejshutt/kernel.html
- substation13 4y agoI'm curious; what is Clojure missing a Lisp?
- rileyphone 4y agohttps://news.ycombinator.com/item?id=30802479 https://news.ycombinator.com/item?id=30802479 touched on it, though I would add that the immutability is a stark departure from previous Lisps. I still think of it as a Lisp, but on an island, similar to Scheme though even more different from mainline Lisp.
- agumonkey 4y agoI've seen people report lack of deeply capable repl, slime a few times. People don't like immutable first too (maybe they prefer metaobject update protocols).
- toolslive 4y ago> Employers much prefer that workers be fungible, rather than maximally productive.
- lisper 4y agoThis. A maximally productive non-fungible employee has leverage, and employers hate that more than just about anything.
- nanochad 4y ago
- ashton314 4y agoMathematicians and physicists would rather use another's toothbrush than another's notation. Perhaps The Curse is because Lisp programmers are generally of the same ilk as mathematicians and physicists?
- johnisgood 4y ago> Dr. Mark Tarver — twice-quoted, above — wrote a dialect of Lisp called Qi. It is less than ten thousand lines of macros running atop Clisp. It implements most of the unique features of Haskell and OCaml. In some respects, Qi surpasses them. For instance, Qi's type inferencing engine is Turing complete. In a world where teams of talented academics were needed to write Haskell, one man, Dr. Tarver wrote Qi all by his lonesome. Check out https://github.com/factor/factor https://github.com/factor/factor. Check out how much stuff they have implemented early on, just 2-4 guys tops. I found it really impressive.
- rurban 4y agonit: it's (2011) not (2017) otherwise, he speaks from my heart. social issues only