Hacker News new | ask | show | jobs
by dialamac 1948 days ago
I’m amused that a number in this thread saw these observations as a “diss”... that’s more on you then me. I didn’t pass any value judgement on these differences, merely that they exist and demonstrate some fundamental differences in the history of these languages. While Ruby lambdas are essentially first class anonymous functions they were added late in the language and they are distinct from methods that predate them. You can’t just drop them in seamlessly where a method is used. The point stands that while both Ruby and python have accreted more stuff as time wears on, their initial design principles were starkly dissimilar.
1 comments

Yo bro dialamac / Caught in a falsehood / Tryin' to dial it back / Feels misunderstood / Sez lambda came late / But changelog don't lie / Since v0.8 / Ruby so fly.

Or, in prose form: I don't see anyone disagreeing that Ruby & Python are dissimilar both in principle and in practice, but "Ruby doesn't even have first-class functions" was most unreservedly an epic howler, and once played, folks were inevitably gonna have some fun passing that football around, and despite most of the changelog from 1995 being in Japanese there are nevertheless references to lambdas that early on, although the more concise "stabby" syntax didn't rear up until ca.2008.

[See screenshot]
> "Functions in Ruby are methods"

RECORD SCRATCH. THE ROOM FALLS SILENT.

NARRATOR: A common assumption, but no. Equating object methods to functions is a furphy. The argument along the lines of:

"Ruby's object methods are Ruby's functions, but you can't pass them around, ergo they're not functions"

is using the term "function" in two different ways, but assuming they're the same; this is not an argument based on substance, but upon mislabelling. The conclusion is bogus because the premise is bogus.

It may arise from a category error, assuming that the thing depends intrinsically upon the literal representation of the thing, or (worse) the common name of the thing, but this is a) wrong anyway, and b) loses coherence entirely in a language in which function literals can be conjured and lexically rebound at runtime.

In actuality, Ruby's lambdas are functions, and first-class, by the only definition with substance: they are closures capable of higher-order expression, taking functions as parameters when invoked, and returning functions as results.

Which is why saying "it don't have them" on a forum named after a fixed-point combinator is to invite: a) ridicule, and b) lambda calculus expressions in rap battle form.

CROWD: Yeah!

MUSIC STARTS / GLITTERBALL CLOSEUP

I’m glad you think highly of your poetic abilities, but I have no desire to engage in that pointless argument.

Edit: and yes.. uh comment deleted as charged, since you had edited after I replied.

> I have no desire to engage

And yet,

> go full on neckbeard

Here you are,

> you seem to have balled up tightly in your own self worth

In full-on pompous balloon ad hominem mode,

> https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/fun...

With a reference page that is 22 years out of date,

> you can finish this argument with whatever hand you prefer

And a bitter, resentful, dick joke.

Well, I don't have a beard, and I ain't the dick here.

> How does one call a lambda after all

Why not fire up the interpreter and go

    f[x]
yourself.

Which is the title of this song.

POSTSCRIPT:

Oh look, a comment deleter / throws around shit / but too late for this meter / Yo' can check it all out / at https://inopinatus.org/i/all_the_sweeter.png

You win.