[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby Minimalism

aidy

4/25/2008 12:09:00 PM

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
14 Answers

David A. Black

4/25/2008 12:33:00 PM

0

Hi --

On Fri, 25 Apr 2008, aidy wrote:

> 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.r... for details and updates!

Phlip

4/25/2008 1:05:00 PM

0

aidy wrote:

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

The correct URI, unwrapped:

http://en.wikipedia.org/wiki/Minimalism_%28co...

We can argue, but the answer is no. Ruby intends to be useful. It has
many systems that allow you to save terms and statement, and minimize
your code, but it gets there by being expressive, not minimal. It's not
like some functional languages, where the only two keywords are an
apostrophe ' and the letter l.

Ruby is a "Lean" and "Very High Level Language". Lean because you can
write 10% of the lines you'd write in another language, and VHLL because
advanced programmer activities, such as regular expressions, are built
into the language definition.

Also, that WikiPedia article appears to be original research, and a point-
of-view. Citing blogs with the same name would seem to confirm this
suspicion...

And citing Apple's broken mouse buttons as an example of a Good Thing??
There aren't words to describe the stupidity...

--
Phlip

M. Edward (Ed) Borasky

4/25/2008 2:12:00 PM

0

aidy wrote:
> 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.

Avdi Grimm

4/25/2008 2:28:00 PM

0

On Fri, Apr 25, 2008 at 8:10 AM, aidy <aidy.lewis@googlemail.com> wrote:
> 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:...
Developer Blog: http:.../devblog/
Twitter: http://twitte...
Journal: http://avdi.livej...

Eleanor McHugh

4/25/2008 2:38:00 PM

0

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


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-...
----
raise ArgumentError unless @reality.responds_to? :reason



David A. Black

4/25/2008 2:44:00 PM

0

Hi --

On Fri, 25 Apr 2008, Eleanor McHugh wrote:

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

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.r... for details and updates!

ThoML

4/25/2008 4:12:00 PM

0

> 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-rub...
http://lwn.net/Articl...

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

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. Edward (Ed) Borasky

4/26/2008 4:16:00 AM

0

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.

M. Edward (Ed) Borasky

4/26/2008 4:28:00 AM

0

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.


M. Edward (Ed) Borasky

4/26/2008 4:38:00 AM

0

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

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.