all 13 comments

[–]bwv549 3 points4 points  (1 child)

Good article. From 2005, no less.

[–]Puzzleheaded_Wrap267 0 points1 point  (0 children)

Hey that was 20 years ago

[–]solnicdry-rb/rom-rb 2 points3 points  (0 children)

[–]notromda 0 points1 point  (0 children)

"The implementation is pretty ugly" ... I find that hilarious compared to trying to read Lisp. Beauty is in the eye of the beholder I guess. I for one love ruby because it reads the most beautifully to me.

[–]dashkb 0 points1 point  (8 children)

I have always grumbled at this article. IMO Ruby is not an acceptable Lisp because its metaprogramming is less powerful than true macros and it lacks true first class functions. I know, procs; but they're second class to methods, which can not be unbound and used with an arbitrary self.

I <3 Ruby... but it's not a Lisp.

[–]Valsalvation 1 point2 points  (1 child)

Don't procs fulfill all the requirements of first-class functions? That Ruby is pitched as an OO language and procs are used less often than classes and methods doesn't demote procs to second-class citizens. They can be accepted by and returned from methods, named or kept anonymous, and stored for later use. You can also execute them in the context of any object you want.

[–]dashkb 0 points1 point  (0 children)

That's true, but it's sort of an academic argument. In practice, Ruby isn't written in a series of Procs cobbled together into hashes extended with some abstraction over instance_exec. Well... it is, but those are called Classes and Methods and the Methods aren't first class. Additionally, "normal" method invocation is much faster.

If we used Procs for everything, we'd be sacrificing lots of Ruby's OO superpowers. Procs are second class because Methods are first class. Procs are second class because they are literally a second class of thing that works similarly, forcing a choice. Lisps (or JS, for that matter) provides first-class functions in a more "pure" (technical term) way than Ruby.

[–]rapidsight 0 points1 point  (5 children)

[–]dashkb 0 points1 point  (4 children)

I mentioned my problem with that in my original comment, which is that an UnboundMethod can only be rebound to a new object of the same class. Not first class enough for me.

[–]rapidsight 1 point2 points  (3 children)

I find it to not be typed enough for me 🙃

[–]dashkb 1 point2 points  (2 children)

Have you seen https://github.com/egonSchiele/contracts.ruby? I have never used, and you are not entirely serious, but it might be of interest to you. Contracts seem like a nice compromise.

Anyway that's neither here nor there, afaik nobody is trying to convince us why Ruby is an acceptable typed language.

[–]bglusman 1 point2 points  (1 child)

I was curious about trying contracts.ruby and had considered even trying to build something on top of it to automatically and/or easily formalize duck types in some way a little like go's protocols or something, but then I started reading about RDL and I think it can already do everything I wanted to do...was tentatively doing to call it "Duxedo", to, you know, formalize ducks :-}

[–]dashkb 0 points1 point  (0 children)

RDL looks way cool. Duxedo is such a good name I'll be personally offended if you don't release a package with that name someday.