Live data from Hacker News

The Ruby Stdlib is a Ghetto

mikeperham.com

41–49 of 49 posts

Re: The Ruby Stdlib is a Ghetto

#41
post #34

I wrote something similar a while ago[0]. Ruby should be the language and everything you "require" should be a Gem. It won't happen with Ruby (and isn't worth the effort). New languages, however, take heed. [0] http://thelincolnshirepoacher.com/pages/standard-libraries

Instead of forcing users to "install file" and "install path," which is bound to cause frustration, you could probably just have an "install stdlib" meta-package. Or at least an "install list stdlib" command that showed people all of the packages to install if they wanted stdlib functionality, which would be completely clear and allow for cherry-picking packages. Or install all packages in stdlib by default and let p…

Yeah absolutely. I think what is important is that people can fork and change the stdlib. I also like the idea of platform independence coming from installing different Gems, i.e. "file-java" and "file-win32". However, that could work out to be a cluster-cuss in practice.

Re: The Ruby Stdlib is a Ghetto

#42
post #12

I am not sure the author's solution, removing the said libs, is the right direction. I agree that the stdlib is crufty and slow, but they do 'work', and people certainly use them. I think the better option might be to deprecate and replace.

To me the Stdlib API looks unfixable. So imho there's only one way: * put the existing stdlib into a legacy gem * create a new stdlib with a new, good, (incompatible) API from scratch * deal with the incompatibilities that will happen

This article should be of interest to you (it's about rewriting from scratch) : http://www.joelonsoftware.com/articles/fog0000000069.html

Re: The Ruby Stdlib is a Ghetto

#43
post #32

Ghetto? How about just "old and crufty"?

It's not 'ghetto' in the slangy adjectival use (e.g., "That coat is so ghetto."), but 'ghetto' in the normal noun use: "The Ruby Stdlib is a Ghetto" (my emphasis). And if you still think that's hyperbole, it's an allusion to Zed Shaw's infamous "Rails Is A Ghetto" post.

I thought it was a reference to the tact and grace embodied by titles like "CouchDB: Perform like a pornstar".

Re: The Ruby Stdlib is a Ghetto

#44
post #29
post #6

Earlier quoted context omitted.

REXML is kept because many projects that need a pure ruby XML parser rely on it and it works for them. Usually, if you use XML beyond something small, you should use Nokogiri. Actually, 1.9.2 ships with replacements where possible: for example, CSV is now FasterCSV with a compatibility interface, Psych can be used instead of Syck for YAML parsing.

Likewise for high performance http libraries.

Yes, but most high-performance libraries are MRI specific.

I'm still searching for a good Net::HTTP replacement that runs on both MRI and JRuby.

Re: The Ruby Stdlib is a Ghetto

#45
post #11

Earlier quoted context omitted.

The Ruby language specification ( http://www.rubyspec.org/ ), to which all Ruby VMs are written, helps as far as the "number of Ruby interpreters around and their impact" goes. (Assuming I understood your concern correctly.) A new Ruby VM is considered legit if it passes Ruby Spec. That should help in both transparency and compatibility across implementations. Would you agree?

Following your link: "This website is presently being redesigned. We expect to be back soon." But I knew already that "rubyspec" wasn't a spec in the ordinary sense but a test-suit built with MSpec. The thing is that real spec actually fully specifies a language - at least up to syntax. There are real specs for Python and Java for instance. The only real spec for Ruby is still crufty Yacc code for MRI. A test suit do…

Java has a real spec. Python has documentation, but it isn't really sufficient for a spec, and for the most part alternative implementations copy down to the last implementation detail (gc details notwithstanding). A test suite is probably better than what it has.

Re: The Ruby Stdlib is a Ghetto

#46
post #5

Earlier quoted context omitted.

Copy: Much of Ruby’s standard library (the set of classes shipped with the Ruby VM itself) is old and crufty. For laughs, go look at the code for some of the classes that you’ve never used. Chances are it’s from 2000-2003 and doesn’t even look like idiomatic Ruby. I’m wondering what classes should be removed from the standard library or deprecated so that higher quality replacements can take their place. The canonica…

Drb is a bit unusual and rarely used, but I wonder what his objection is to the API?

i was also wondering what he proposed as a replacement for it

Re: The Ruby Stdlib is a Ghetto

#47
post #45

Earlier quoted context omitted.

Following your link: "This website is presently being redesigned. We expect to be back soon." But I knew already that "rubyspec" wasn't a spec in the ordinary sense but a test-suit built with MSpec. The thing is that real spec actually fully specifies a language - at least up to syntax. There are real specs for Python and Java for instance. The only real spec for Ruby is still crufty Yacc code for MRI. A test suit do…

Java has a real spec. Python has documentation, but it isn't really sufficient for a spec, and for the most part alternative implementations copy down to the last implementation detail (gc details notwithstanding). A test suite is probably better than what it has.

It depends what you mean by "better".

Maybe Python has lousy spec but as I recall, the documentation does include a BNF breakdown of what Python is.

A test suite can be good for a lot of things BUT it cannot be a specification, it cannot be even sort-of a specification. Test suites only "prove a negative", only prove that an application won't do X. A specification is at least a rough assertion of a positive, that a language does follow this pattern.

Re: The Ruby Stdlib is a Ghetto

#48
post #45

Earlier quoted context omitted.

Java has a real spec. Python has documentation, but it isn't really sufficient for a spec, and for the most part alternative implementations copy down to the last implementation detail (gc details notwithstanding). A test suite is probably better than what it has.

It depends what you mean by "better". Maybe Python has lousy spec but as I recall, the documentation does include a BNF breakdown of what Python is. A test suite can be good for a lot of things BUT it cannot be a specification, it cannot be even sort-of a specification. Test suites only "prove a negative", only prove that an application won't do X. A specification is at least a rough assertion of a positive, that a l…

Yeah, there's an EBNF syntax description. I must have missed the part where the GP thought that's all that was necessary for a "real spec". I guess I just disagree.

Java specifies the semantics of Java and the JVM remarkably fully. Python, not so much.

Post reply on HN