7 ms·
Why Ruby is an acceptable Lisp (2005)
- steveklabnik 10y agoA classic. Should have (2005) in the title. Previously on HN: https://news.ycombinator.com/item?id=416589 https://news.ycombinator.com/item?id=416589 and https://news.ycombinator.com/item?id=825809 https://news.ycombinator.com/item?id=825809 And a follow-up: https://news.ycombinator.com/item?id=2279453 https://news.ycombinator.com/item?id=2279453
- behnamoh 10y agoI just checked your links and gotta admit, you're right. Although, still I don't see why this has been posted "three" times before! I think HN should add a URL checker in the submit page.
- miller_joe 10y agoI missed the original postings so it's nice to see this for the first time. That would be difficult if HN didn't allow reposts. Though I can understand if I had seen it already.
- behnamoh 10y agoThat's actually a good point. On a sidenote, I get a weird feeling from HN's simple UI/UX. On one hand, it feels like the old CLI machines that put the focus on "content" - kinda like "do one thing and do it right". On the other hand, reading all the comments, getting notified for replies on comments, etc. is really hard. In this day and age, one would wonder if HN really hates JS (well, except for the upvote button).
- sundarurfriend 10y agoCommunity building and maintanence is a very tough job, and the simplest of things can end up nudging people towards unproductive behaviour. HN has consistently maintained at least a decent quality audience and community by keeping the UI free of bells and whistles, and thusly being unattractive to certain kinds of low-effort users. At this point, any change would probably count as messing with a good thing, so the thinking is probably "if it ain't broke, don't fix it." They are however acknowledging some things that are broken and need fixing, and in recent days have been introducing small changes to correct those (eg. the unvote button, ability to fold). I do hear you on the notification for comment replies thing though, I was really surprised when I found that feature wasn't there, and at times end up missing out potentially good conversations because I didn't check for and notice the reply comment until too late.
- hibbelig 10y agoFor getting notified of replies, try http://www.hnreplies.com/ http://www.hnreplies.com/.
- behnamoh 10y agoThanks, will give it a shot.
- behnamoh 10y agoI agree with you that HN has maintained a quality audience and community. This is really one of the main reasons I check HN daily. Although, even top-tier programmers and professionals are eventually "human", and design rules apply to them as well. It's like saying these folks are more comfortable to use some strange user-undfiendly smartphone, while they mostly just use an iPhone instead.
- sillysaurus3 10y agoI think they've demonstrated they know what they're doing. Perhaps it's us who should learn from them.
- sotojuan 10y agoI get some weird enjoyment out of this site not having any modern features and little to no JavaScript, even though I'm a JavaScript developer by trade and open source.
- smallnamespace 10y ago"It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove."
- pmontra 10y agoThere is no need for JS on a site like this. The ajax upvote is convenient but they could (unconveniently) reload the whole page and set the location with an anchor to go back to the upvoted comment, 1994 style. Any real time notification system requires a backend infrastructure that maybe they don't want to have. They could also use a better CSS but who cares, text is king in this kind of sites. It displays quite well on mobile too, especially with Opera which reflows text after zoom (the very reason for using Opera).
- qwertyuiop924 10y agoI find notifications on replies annoying. The one feature I do want is better understanding of where upvotes are coming from: when I suddenly get a surge of upvotes that didn't seem to come from any comment of late, I just kind of want to know where it's coming from, as it annoys me to no end. I wish I could somehow see which of my comments were upvoted recently.
- sillysaurus3 10y agoI don't see why this has been posted "three" times before Posts that are over a year old can be reposted. It's a way to get a fresh perspective on ideas.
- cardiffspaceman 10y agoMaybe an URL checker would implicitly discourage reposts by warning about them. If the URL checker were to present itself as a helpful aid for reposts ("You might want to use this title like the other 3 posters have used: X") it might avoid that result.
- qwertyuiop924 10y agoI don't think this article is as great as a lot of people do. Most of this should be obvious to anyone using ruby, nowadays. It might have been great at the time, but I don't think so much now. But then again I thought "The Meme Hustler" was rubbish (well, actually, I think the reasoning would have been okay, but I thought the premise was totally, utterly, removed from reality), so I think it's safe to say me and Steve have a different taste in articles.
- steveklabnik 10y agoI don't actually know how I feel about the contents of this article, but it _did_ generate a lot of lively discussion and made a lot of people think. So in that regard, I feel that it's a success.
- qwertyuiop924 10y agoFair 'nuff. That is a major benefit. Steve Yegge's response is way more interesting than the article itself.
- cwyers 10y agoSteve Yegge's response: http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptable-lisp.html?m=1 http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptab...
- StreamBright 10y agoThanks for this, I nearly fell of from the couch reading it. Yegge's writings are extremely entertaining.
- atombender 10y agoYegge's predictions don't always come through, but he basically predicted Clojure. (The "someone will Thorvalds Arc" bit.)
- kevin_thibedeau 10y agoTcl is a better lisp than Ruby. Homoiconic. Yield and tailcall make it easy to implement FP idioms. Macros available if needed.
- mroll 10y agoWish more people understood this about tcl
- pjmlp 10y agoTcl was what made possible one of the best startups I had the privilege to be part of. They had a Rails like stack in the first .com wave, but implemented in a mix of Tcl, Apache and C.
- mroll 10y agoCan I get your email? Would love to hear about that stack
- pjmlp 10y agoIt had an architecture similar to AOL Server, just that the founders did their own thing instead. Tcl was used for almost everything, C for performance critical modules and DB FFI. The interpreter was loaded as an Apache module. We supported Informix, MS SQL Server, Sybase SQL Server and Oracle. All major UNIX variants from late 99's and Windows NT/2000.
- pmontra 10y agoMaybe this is meta (the wish) :-) I remember tcl in the early 90s then it disappeared from my radar, mostly web and mobile apps. Honest question: is it still relevant in some application area?
- qwertyuiop924 10y agoIt's still great at what it was always great at: embedding, acting as a CLI, and doing random grunt work. It's Lua's main competitor, but it can also go toe-to-toe with python and ruby in terms of libraries in some areas (although by no means all of them). In particular, the ease of construction for graphical applications is arguably unmatched (IUP is probably the closest), SQLite was built to work with it, metakit is handy as well in the DB area, it has a great event loop, several OO models, solid unix integration, sold FFI and excellent embedding (as you'd expect), Starkits, which means you can distribute your whole TCL sourcetree as a single file, and a ton of other stuff. So while it's not as popular, relevancy isn't an issue.
- RangerScience 10y agoThe poingant guide link (implimentation of the "belongs_to" class function) is a string of redirects. Anyone have a copy of the original?
- pdkl95 10y agohttp://poignant.guide/book/chapter-6.html#section3 http://poignant.guide/book/chapter-6.html#section3 edit: While I love _why's guide, which can be very useful for learning ruby metaprogramming (and ruby in general), the technique presented there is a bit outdated. Modern ruby doesn't require such an "ugly" style because we now have Object#define_singleton_method[1] as a way of defining class level methods. There shouldn't be a need to use #instance_eval to define methods in the metaclass. [1] https://ruby-doc.org/core-2.2.2/Object.html#method-i-define_singleton_method https://ruby-doc.org/core-2.2.2/Object.html#method-i-define_...
- Dangeranger 10y agoEric did a very good job predicting the direction of Ruby and Rails back in 2005, as well as the reasons why people chose them as tools over what existed at the time.
- Iispm 10y agoRuby is the lispification of Perl, according to its creator.
- pjmlp 10y agoI fail to see how it can be an acceptable Lisp when it lacks the AOT/JIT compilation as part of the standard toolchain and the development productivity of Common Lisp environments.
- qwertyuiop924 10y agoI don't have the love of CL development environments you do, but yeah, as a schemer, ruby's perf is kind of awful. We've got AOT, JIT, bytecode, and literally decades of research spend making these languages fast, and Ruby doesn't have that, or the hot code loading and quick iteration cycle that makes Lisp/Scheme realtime development so deliciously sweet. To say nothing of our macro superpowers. But then, CLers still insist on on keeping the shotgun hovering over their foot, and insisting it's the only way to go about writing macros. Syntactic Closures and Implicit Renaming are both pretty cool. You guys should check them out.
- pjmlp 10y agoI hardly have used Lisp besides Emacs Lisp and Clojure, but as a language geek I do have my collection of Lisp related stuff, mainly Xerox PARC, Lisp Machines and commercial CL environments. Scheme also has environments like DrRaket, even if the language now has moved beyond its Scheme origins.
- qwertyuiop924 10y agoI don't know how you got a lispm, but nice for you :-). I was confusing you with Rainer (who, by coincedence, goes by the username lispm on HN), who actually loves CL environments. As for me, I set my store by Geiser. Integrated documentation from all the implmentations it supports, repl (as well as the capability to connect to a remote one), support for all three big Schemes, is an emacs extension, and has excellent docs? Consider me sold.
- pjmlp 10y agoI wish. I meant in what concerns papers, videos and magazines articles back from those days.
- ufmace 10y agoI'm glad to see this, and even more interested that it was written in 2005. I've read lots of rants about how awesome Lisp is supposed to be from Paul Graham and Steve Yegge and all. But I never see anything significant being written in it or using it, so I haven't felt all that tempted to try learning it. Meanwhile, I've been using Ruby for a while, and the metaprogramming capabilities are pretty cool. It sounds a lot like what all of the Lisp enthusiasts are saying is so awesome about Lisp to me. So I've always wondered what it is that's so awesome about Lisp that Ruby doesn't already have.
- peruvian 10y agoFWIW Elixir has first class macros that go way beyond Ruby's metaprogramming, so you may want to try that.
- pjmlp 10y agoThe software done by these guys is pretty significant and manages a few of the European train systems. http://www.siscog.com http://www.siscog.com
- mnemonicsloth 10y agoI don't know ruby, so I can't answer your question directly. But I can ask you one: why not just learn a lisp? You don't have to learn a whole language to know what makes people like it. Working at it for a week or two, in you free time, would probably be enough for you to settle the question permanently. Lisp doesn't have to be a search for nirvana.
- ufmace 10y agoMaybe one of these days... I've been spending what time I have for learning completely different languages on Haskell, and I haven't messed with that in a while either.
- billsix 10y agoI couldn't have written a unit test framework which evaluates at compile-time in Ruby, but I did in Gambit Scheme. (If any test fails, the compiler exits in error, and no library or executable is produced.) https://github.com/billsix/bug https://github.com/billsix/bug
- ekidd 10y agoAuthor here. Let me explain where this article came from, since people keep digging it up every few years to discuss it. :-) I spent some time during the late 90s learning all kinds of cool ways to use Lisp, courtesy of a couple Boston startups, including IS Robotics (now better known as iRobot). And I'd helped introduce Scheme to another employer. Scheme made it ridiculously easy to create domain-specific languages, but it was obviously a niche technology. Around the same time, I'd heard Matz speak to a room full of Lisp hackers at the Lightweight Languages conference. He'd elegantly explained why Ruby was cool several years before Rails became widespread. But I don't think many of us understood what he was saying until later. When I finally realized—thanks to Rails—that Ruby could mimic many of the most common Lisp metaprogramming tricks, I mentally kicked myself and wrote this blog post. There were a lot of great responses from other bloggers, too. My goal was to help make other people aware of some fun new possibilities. Anyway, if anybody has any questions, I'll try to answer them later this evening when I'm back online. It's fun to remember when this stuff was so new.
- CCing 10y agoOFF-TOPIC: Why Lisp was so popular in Boston ?
- contingencies 10y agoInteresting article and thanks for chiming back in. I also discovered and enjoyed the metaprogramming features of ruby perhaps 5+ years ago. As I've been learning it recently, can I ask if you have any particular take on lua? To me, it feels a bit paired back, more purist, smaller core/libraries than ruby, but also drawing from the same tradition - ie. lua's tables/functions equate well to lisp's lists/S-expressions (though practically largely equivalent and including metaprogramming support) - despite not being directly derived from a lisp.
- lispm 10y ago> The most common use of LISP macros is to avoid typing lambda quite so much LispWorks CL-USER 1 > (let ((n-macros 0) (n-with-macros 0) (with-macros nil)) (do-all-symbols (s (values n-macros n-with-macros)) (when (macro-function s) (incf n-macros) (let ((name (symbol-name s))) (when (and name (> (length name) 4) (string-equal name "WITH" :start1 0 :end1 4)) (incf n-with-macros) (push s with-macros)))))) 1186 ; macros 182 ; with- macros Note also that (with-slots (a b) foo (+ a b)) is not the same as: (call-with-slots foo '(a b) (lambda (a b) (+ a b)))
- KeatonDunsford 10y agoFor a 2005 article, this is totally awesome, as well as that Steve Yegge response. But in 2016, it's hard for me not to get excited about what's seeming like Clojure's upward trajectory into the mainstream and want to jump on board 100%. To paraphrase Rich Hickey, Lisp and immutable functional programming totally rock, and the JVM and Javascript just reach (ClojureScript). As our systems get bigger and more quality is demanded from our software, it'd be so cool if we could get behind this as a standard, in all the growing technology fields -- web and mobile (Om.next for React and React Native), big data, AI/machine learning, Dockerization/containerization and even decentralized stuff (Pelle Braendgaard's Cloth library for Ethereum is a start, and I was just talking with some awesome people in the Clojure Slack channel working on Boot tasks for IPFS, and soon the Golem Network project will be launched which will be super dope). Hell, even designers can start designing in Clojure now. It's just Simple, and as the community grows, rallying behind it is only going to get Easier. People were raving with React Native about how JavaScript developers could now all the sudden start coding mobile apps. How cool would it be if there was just one awesome language, the one true immutable functional Lisp, where everybody in tech could understand each other and collaborate? I genuinely think this is Lisp's revenge (shoutout David Nolen!). It's been tough for me as a new developer to learn this stuff without nearly as many resources as there are in the Python and Ruby communities for beginners, but there's no question this is the (near-term) future. Plus, a lot of that stuff just complects everything anyways and doesn't have to apply anymore (read: mutable state, no Value on Values). Let's keep it Lispy. ;)
- wyager 10y agoOn the other functional JavaScript side of things, there are also Elm and Purescript. They are both pure functional, and both are ML-inspired (strongly typed, equational, ADTs with pattern matching, etc.). Elm is a fair bit easier to get started with, but has a substantially weaker type system and fewer useful functional features. Purescript is a fair bit more difficult to get started with, but has a substantially more powerful type system and lots of useful features like effect types. Personally, I greatly prefer ML style languages to lisp style languages. I get fed up with all the parentheses in lisps.
- 10y ago
- Grue3 10y agoThis is a pretty bad article. The part that makes Lisp unique is hardly lambdas (every language has them, even Javascript), or being functional, but rather stuff like homoiconicity (and therefore macros). And once one scrolls down to that part, it's full of ignorant statements like "the most common use of LISP macros is to avoid typing lambda quite so much". It demonstrates a fundamental misunderstanding of macros, because they're executed at the compilation step, before the program is run. It's a zero-cost abstraction (wrt performance). Not that anyone writing in Ruby cares about that. Look at this example from the article: (defmacro with-each-natural-number (n expr) `(each-natural-number (lambda (,n) ,expr))) It assumes that the programmer already wrote a function each-natural-number that does the required functionality when another function is passed into it. That's the Ruby way, because it only has functions, not macros. A good Lisp programmer would never write such inefficient code. Why create a local function here when you can easily write a macro that expands into a loop with expr as its body? So, indeed, if you write in Lisp as if it were Ruby, then Ruby is an acceptable Lisp. If you write in Lisp as it's supposed to be written, then Ruby is ridiculously restrictive, and slow.
- qwertyuiop924 10y agoThat's a bit needlessly insulting, but the line in the article about Lisp being functional is telling: Most lisps are emphatically not functional, by any definition. Some of it was kind of right, though: Markabye, in particular, looks like the classic lisp HTML generator macro. And hey, most of my Scheme code barely has any macros (so call my idioms a decade out of date, we have a macro system equivalent to CL's, and I've never felt much need to use it. And yes, most Schemes do have a CL-equivalent macro system, it's just nonstandard), and I still love lisp. Lisp has many, many, many, cool advantages, but I still think never having to worry about syntax or indenting style is the greatest one: people underestimate just how much the little things matter. :-)
- fiddlerwoaroof 10y agoActually, that example is fairly idiomatic, it's called the "call-with" style. From Google's Common Lisp style guide ( https://google.github.io/styleguide/lispguide.xml#Macros https://google.github.io/styleguide/lispguide.xml#Macros ): You should follow the so-called CALL-WITH style when it applies. This style is explained at length in http://random-state.net/log/3390120648.html. The general principle is that the macro is strictly limited to processing the syntax, and as much of the semantics as possible is kept in normal functions. Therefore, a macro WITH-FOO is often limited to generating a call to an auxiliary function CALL-WITH-FOO with arguments deduced from the macro arguments. Macro &body arguments are typically wrapped into a lambda expression of which they become the body, which is passed as one of the arguments of the auxiliary function.
- nabla9 10y ago>But, for the sake of argument, I'd like to boil them down to two things: > LISP is a dense functional language. > LISP has programmatic macros. First of these is wrong and second is just picking something from feature list without any concern of practicality. When someone writes Lisp as LISP and speaks about functional programming, I get the feeling that the author has not programmed with Lisp outside school (or knows only Scheme). Using toy examples don't help. There is also problem with treating Lisp as a single entity. It's like Treating C++ and JavaScript as the same language because their syntax looks similar to someone who is not actually programming with them. There are at least two major "schools" of lisp. Traditional Lisp style with Common Lisp as it's main representative, another being Emacs Lisp. The another is Scheme & Clojure camp that goes towards different goals.
- deleted 10y ago[deleted]
- qwertyuiop924 10y agoI agree regarding this mischaracterization of Lisp, but have to laugh as you mischaracterize Scheme. Lisps are excellent at adapting to programming paradigms. Scheme is often used academically in a functional style, but if you want to go full-on procedural or OO, we're just as good as Common Lisp. Okay, maybe we're not quite as good as CLOS, but we're not as far off as you'd think. Also, most Schemes are way more traditional than Clojure. And no, Racket isn't Scheme.
- nabla9 10y agoI had to simplify in the sake of argument. Both Common Lisp and Scheme are multi paradigm languages by nature, but Scheme took philosophical step into different direction. This philosophical difference may follow into other Lisp dialects that are not exactly Scheme.
- qwertyuiop924 10y ago...I would say clojure goes in a third direction, but fair enough.
- hyperion2010 10y agoI have read the point about hygienic macros before. I have been working with racket and common lisp and I cannot tell you have annoying it is to be trying to learn macros and continually having to fight racket to let me do what I want. CL on the other hand seems to get out of the way and let me shoot myself in the foot just fine. I'd say that from a learning standpoint hygienic macros (ala define-syntax) are a roadblock because they introduce a whole bunch of hidden state which is hard to build a mental model of until after you have encountered regular macros.
- LaPrometheus 10y agoNo, It is not acceptable.
- white-flame 10y ago1) "Ruby is a denser functional language than Lisp" Lisp is a regular, explicit language. It does not strive for micro-density, but rather tends to achieve macro-density by allowing more expressive abstraction and transformation in the larger componentry of your projects. Its regularity around parenthetical s-expressions is the source of its expressive power. Things like "(+ (aref x 3) 4)" are larger than "x[3]+4", but the operations and source code representation in Lisp are directly accessible to matching and transformation without having to go through extra rigmarole to deal with classes of AST node objects or whatever. This makes the usefulness of these features immediately accessible for everybody, and useful for quick utility, not just major undertakings. 2) "Ruby gives you about 80% of what you want from macros" I'm sorry, but this section is simply ignorant of what Lisp macros are for. Simple syntactic sugar is obviously possible with macros, but certainly not its major use. Providing abstract constructs that require custom code generation, creating lower-level boilerplate (like auto-creation of introspective data structures and customized support functions), and wrapping custom behavior around inline scopes are the primary uses I've seen and used. Ruby can do a little of it, but I see no "80% of what you want" there. 3) "Ruby's libraries, community, and momentum are good" Quicklisp was created after this article was written, and has been a godsend to the community. Lisp tends to develop a very roll-your-own culture because of its quick accessibility of creating abstractions, but the ease at which you can publish & reach for libraries with QL has brought a lot of cultural shift towards reuse. There are a ton of both esoteric and practical libraries out there, and common libraries for threading, networking, OS interaction, etc, are the common case now (and actually have been for quite a while before Quicklisp as well). There's tons of interoperating flexibility because the language provides a huge baseline (especially its object system), so it doesn't all need to lock into an on-top-of-Lisp infrastructure that would constrain the programmer's options. It's a good time to be in Common Lisp.