Ruby Minimalism

A

aidy

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
tinyurl.com/6h83b3). Could we argue that Ruby is a minimal language?

Regards

Aidy
 
D

David A. Black

Hi --

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
tinyurl.com/6h83b3). 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! :)


David

--
Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!
 
M

M. Edward (Ed) Borasky

aidy said:
Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
tinyurl.com/6h83b3). 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.
 
A

Avdi Grimm

Hi,

I have been reading a WikiPedia piece on Minimalist Computing (http://
tinyurl.com/6h83b3). 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: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com
 
E

Eleanor McHugh

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 :)


Ellie

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

David A. Black

Hi --

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 :)

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

--
Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!
 
T

ThoML

I have been reading a WikiPedia piece on Minimalist Computing (http://
tinyurl.com/6h83b3). 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
http://lwn.net/Articles/206533/

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:

http://en.wikipedia.org/wiki/Image:Windowlab-screenshot.png

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.
 
M

M. Edward (Ed) Borasky

ThoML said:
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.
 
M

M. Edward (Ed) Borasky

Michael said:
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.
 
M

M. Edward (Ed) Borasky

Eleanor said:
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 :)

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

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.
 
M

M. Edward (Ed) Borasky

Michael said:
Scheme has a syntax? Wow! You learn something new every day! :D

--
*Michael T. Richter* <[email protected]
<mailto:[email protected]>> (*GoogleTalk:* (e-mail address removed))
/Those who have learned from history are bound to helplessly watch it
repeat itself. (Albert Y. C. Lai)/

Yes ... Scheme has a syntax. Otherwise, there couldn't be syntax macros.
:) Forth has a syntax too.
 
T

ThoML

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.
 
S

Simon Krahnke

* M. Edward (Ed) Borasky said:
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
 
E

Eleanor McHugh

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

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 <insert favourite Lispism here>. 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

lambda and a Proc 2
Does mastodon use ruby? 1
activemq ruby library 1
ruby graphs and hudson 1
read a windows system tray balloon in Ruby? 2
ruby into a .dll? 4
YAML 13
write ruby code on a blog 5

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top