Ruby Minimalism

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

Regards

Aidy

Hi –

On Fri, 25 Apr 2008, aidy wrote:

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

That’s a very interesting question. I would say: yes and no.

The “no” part is, I think, manifest in the fact that you can achieve
similar ends by different routes, and also perhaps in the fact that
there are methods with more than one name. And all that “Python vs.
Perl” stuff that seems to me, increasingly, irrelevant to Ruby (or
maybe just shop-worn and boring).

The “yes” part is more interesting. I’ve always been fascinated by the
way that Ruby creates what appear to be language-level features,
simply by recombining existing features. The best example is probably
the attr_* family of methods. We speak of “attributes” in Ruby, but
all that’s going on is that there are some methods – macros, as it
were – that create other methods that wrap instance variables. The
instance variable is a language-level construct, and so are methods.
But the “attribute” simply floats on top of those constructs.

I don’t think this means that Ruby is really minimalist; but it does
mean that Ruby uses minimalist principles in very interesting ways.

Another example is class methods. Class methods are basically just
singleton methods on class objects. (Except for one way in which
they’re special-cased, namely that subclasses can call their
superclass’s class methods.) Ruby already has singleton methods, and
classes are already objects. All you have to do is put the pieces
together.

It’s as if Ruby is saying, “You want ‘attributes’? You want ‘class
methods’? Sure – go ahead!” Of course, the core language itself does
incorporate these things. But they’re built on existing components of
the language.

In that sense, I think that Ruby has a way of taking on the features
of whoever is using it. Of course it has its own style and
architecture. But it’s so easy to add features, and to see almost
mirage-like language features even when they’re not really there. I’ve
always said that the biggest issue most people face when learning Ruby
is that the language is simpler than they can believe. Attributes are
certainly a good example of that; I’ve seen a lot of people struggling
because they’re trying too hard to see some identity that isn’t there
between, say, instance variables and attributes. The idea that it’s
just a bunch of methods that do very, very simple things is in some
ways harder to grasp than something more elaborately engineered would
be (but I’m glad it isn’t! :slight_smile:

David

aidy wrote:

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

Regards

Aidy

I don’t think Ruby is minimalist in any sense of the word. As far as I’m
concerned, there are just two minimalist programming languages – Scheme
and Forth. I don’t even think Common Lisp qualifies. APL and Smalltalk
probably come closer than any others.

There are quite a few features you could take out of Ruby to make it
more “minimalist”. For openers, the syntactic freedom many people love
about Ruby is a source of great complexity for any entity (human or
program) that must parse it. Scheme and Forth don’t suffer from this.

On Fri, Apr 25, 2008 at 8:10 AM, aidy [email protected] wrote:

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

I’m having a hard time believing this qualifies as an actual movement,
as opposed to the product of some Wikipedist with an agenda and too
much time on his or her hands.

Some apps, languages, or devices are small, simple, and do one thing
well. Others are large, complex, and do many things. Others are
large, complicated, and do a few things poorly. Deriving some kind of
overarching movement from the fact that the small, simple constructs
exist is a stretch.


Avdi

Home: http://avdi.org
Developer Blog: Avdi Grimm, Code Cleric
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com

On 25 Apr 2008, at 15:11, M. Edward (Ed) Borasky wrote:

I don’t think Ruby is minimalist in any sense of the word. As far as
I’m concerned, there are just two minimalist programming languages
– Scheme and Forth. I don’t even think Common Lisp qualifies. APL
and Smalltalk probably come closer than any others.

There are quite a few features you could take out of Ruby to make it
more “minimalist”. For openers, the syntactic freedom many people
love about Ruby is a source of great complexity for any entity
(human or program) that must parse it. Scheme and Forth don’t suffer
from this.

But conversely it’s possible to write powerful programs with a very
minimalist feel using Ruby, so whilst the language isn’t minimalist it
allows the programmer to be economical in a way that many languages
fail to do.

Of course sometimes it’s possible to express things in so terse a
manner that even a zen master would be hard pressed to decipher them :slight_smile:

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

Hi –

On Fri, 25 Apr 2008, Eleanor McHugh wrote:

But conversely it’s possible to write powerful programs with a very
minimalist feel using Ruby, so whilst the language isn’t minimalist it allows
the programmer to be economical in a way that many languages fail to do.

Of course sometimes it’s possible to express things in so terse a manner that
even a zen master would be hard pressed to decipher them :slight_smile:

True, but one of the things I love about Ruby is that, for the most
part, as the code gets smaller, it actually becomes clearer. Of course
in golfing contests and such it takes on that line-noisish quality
that makes it hard to decipher.

David

On Fri, 2008-04-25 at 21:10 +0900, aidy wrote:

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

I don’t think any language with five (or more?) different ways of
handling something as fundamental as conditionals can be considered
“minimalist”. One aspect of “minimalist” languages would be the notion
that there’s one way to do each type of thing, after all.

The languages I would consider “minimalist” by the standards set down in
the preamble (haven’t read the whole article yet) might include
Lisp/Scheme, Io, Lua, Dylan (kinda/sorta), APL and its follow-ons (K and
J?), Forth and some of the simpler, more orthogonal assembly languages
(so no Intel assemblers, no Z80*s, etc.).

Ruby qualifies actually as a pretty heavyweight language where
practically every feature of the language has many different ways of
getting expressed. (Note: I’m not saying Ruby is a bad language! I
still use it by choice. I’m just saying it’s not minimalist by any
stretch of any imagination.)

ThoML wrote:

Also note the mention of brainfuck as a minimal language.

Well, if you believe it is a language (and I don’t) it’s certainly
minimal. There is a language called “lazy-k” that’s part of the Parrot
virtual machine. It’s built on SKI combinators, and is certainly
minimal. But again, I’m not sure it’s a language.

I have been reading a WikiPedia piece on Minimalist Computing (http://
Minimalism (computing) - Wikipedia). Could we argue that Ruby is a minimal language?

No. Eg the grammar doesn’t look very minimal:
http://blog.nicksieger.com/articles/2006/10/27/visualization-of-rubys-grammar

I have to say I find the article quite funny. Apart from the lack of a
clear definition of “minimal” including some kind of threshold (the
example of minimalism get bigger with every paragraph), I think it’s
definitely, uhm, interesting to see a picture of a “minimal” window
manager that shows a not so minimal web browser with an army of
useless plugins installed:

This kind of minimalism is a placebo. (Nothing against placebos. Don’t
get me wrong.)

Also note the mention of brainfuck as a minimal language.

Michael T. Richter wrote:

The languages I would consider “minimalist” by the standards set down in
the preamble (haven’t read the whole article yet) might include
Lisp/Scheme, Io, Lua, Dylan (kinda/sorta), APL and its follow-ons (K and
J?), Forth and some of the simpler, more orthogonal assembly languages
(so no Intel assemblers, no Z80*s, etc.).

Well … Lisp 1.5, yes, and Scheme. But Common Lisp? I don’t really
think so. Once they tacked on CLOS and got to CLTL, CLTL2 and ANS Common
Lisp, it was pretty much beyond hope for “minimalist” status.

I don’t know Lua, Io and Dylan well enough to weigh in on their
minimalism, but I’ll accept APL. Assemblers? Well, pretty much all macro
assemblers as languages are minimalist, but if you’re talking about the
underlying machine code/architecture, I’d say you’re talking more about
RISC vs. CISC than minimalist/non-minimalist languages.

On Sat, 2008-04-26 at 13:37 +0900, M. Edward (Ed) Borasky wrote:

But seriously, despite its minimalism, once you understand the core
syntax and semantics of Scheme, it’s fairly easy to read Scheme code.

Scheme has a syntax? Wow! You learn something new every day! :smiley:

Eleanor McHugh wrote:

But conversely it’s possible to write powerful programs with a very
minimalist feel using Ruby, so whilst the language isn’t minimalist it
allows the programmer to be economical in a way that many languages fail
to do.

Of course sometimes it’s possible to express things in so terse a manner
that even a zen master would be hard pressed to decipher them :slight_smile:

You can do that in C too – write a Forth inner interpreter in C and
then code in Forth. :slight_smile:

But seriously, despite its minimalism, once you understand the core
syntax and semantics of Scheme, it’s fairly easy to read Scheme code. A
Scheme interpreter in C is, on the other hand, almost indecipherable.

Yes … Scheme has a syntax. Otherwise, there couldn’t be syntax macros.

Precisely (syntax) macros can make it harder to read scheme code
though because you have to know a certain word is a macro and not a
function in order to tell how the code will work.

Forth has a syntax too.

It couldn’t have less.

Michael T. Richter wrote:

repeat itself. (Albert Y. C. Lai)/

Yes … Scheme has a syntax. Otherwise, there couldn’t be syntax macros.
:slight_smile: Forth has a syntax too.

On 26 Apr 2008, at 05:37, M. Edward (Ed) Borasky wrote:

then code in Forth. :slight_smile:
It scares me how many of the same rabbit holes we’re explored…

But seriously, despite its minimalism, once you understand the core
syntax and semantics of Scheme, it’s fairly easy to read Scheme
code. A Scheme interpreter in C is, on the other hand, almost
indecipherable.

Minimalism is resolution-dependent, in that what looks minimal at one
level of abstraction will generally look incredibly complex the moment
you start exploring how those abstractions are composed. The advantage
of very high level languages is that they usually ship with lots of
useful abstractions, removing the need to build your own from scratch
and thus broadening the extent to which an average programmer can
casually achieve what in lower level languages might require a deep
understanding of computer science and/or the underlying platform.

It’s much like the way that your average media studies student can
sound insightful because of the vocabulary they’ve learned, even
though they’d be hard pressed to form those opinions on their own ;p

And that sort of brings us back to Forth, which has always recognised
that non-specialists programming is about words and numbers rather
than parse trees or closures or . Which
isn’t to say that the kind of conceptual minimalism that many favoured
CS languages try to achieve is a bad thing, just that it’s often
difficult for the average programmer to apply those languages to real-
world problems under real-world conditions.

Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net

raise ArgumentError unless @reality.responds_to? :reason

Well, if you believe it is a language (and I don’t) it’s certainly
minimal.

What exactly disqualifies Brainfuck as a language?

mfg, simon … l