A concise description of Ruby?

B

bruno modulix

Edgardo Hames a écrit :
Given that Ruby comes from Perl and Smalltalk,
and lisp and Python...
why do some people keep
comparing Ruby and Python all the time?

"""
I wanted a scripting language that was more powerful than Perl, and more
object-oriented than Python. That's why I decided to design my own language.
"""
http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html

Well... If I tell you "Highly dynamic, hi-level, interpreted, garbage
collected, file-based, strongly OO && mildly functional, clear syntax
and fun to use", it could apply to both languages.
Do they share a similar background (besides the usually mentioned similarities).

Guess what ?-)

IMHO, the biggets difference is that the 'main' influence (well... the
most obvious...) is C for Python and Smalltalk for Ruby (oh, and yes :
most pythonistas think of Perl as one of the most horrible thing in the
world !-)

Bruno
 
J

Jamis Buck

bruno said:
Well... If I tell you "Highly dynamic, hi-level, interpreted, garbage
collected, file-based, strongly OO && mildly functional, clear syntax
and fun to use", it could apply to both languages.

You're right, except that (IMO) Python is not strongly OO. That's my
opinion. I'm not stating this to start a flamewar, just to show that
opinions can differ on what the features of a particular language are.
 
B

bruno modulix

gabriele renzi a écrit :
Simon Strandgaard ha scritto:
On Wednesday 20 October 2004 14:47, Curt Hibbs wrote:
[snip]
So, I wanted to ask all of you, what would your answer be to the
question
"What is Ruby"?



Ruby allows to you enhance the builtin string class with you own methods,
which you can invoke "im a string".own_method

Thats the sentence I use most.
I don't know if there are other languages that allow for this?

python does,

It doesn't.
 
J

Joao Pedrosa

Hi,
"""
I wanted a scripting language that was more powerful than Perl, and more
object-oriented than Python. That's why I decided to design my own language.
"""
http://www.linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html

Well... If I tell you "Highly dynamic, hi-level, interpreted, garbage
collected, file-based, strongly OO && mildly functional, clear syntax
and fun to use", it could apply to both languages.

You seem to like Python a lot. Can I ask you 10 features of Ruby that
Python lacks or at least does not deliver as easy as Ruby does. It
matters to me that the syntax to a feature is easy enough, because I
don't want it to make the source-code bigger or uglier than necessary.
:) And when multiplying it by 10k, it matters.
Guess what ?-)

IMHO, the biggets difference is that the 'main' influence (well... the
most obvious...) is C for Python and Smalltalk for Ruby (oh, and yes :
most pythonistas think of Perl as one of the most horrible thing in the
world !-)

That's simplifying too much for Ruby. Python may have that influence, though.

Cheers,
Joao
 
D

Dick Davies

* Curt Hibbs said:
Yesterday, a co-worker came into my office and saw the shiny, new pickaxe II
book on my desk and said "What is Ruby?"

Unfortunately, I really blew the opportunity as I attempted to come up with
a brilliant one or two sentence description. The best I could muster was
something like, "Uhh... err... it's kind of like perl or python but much
better." How lame is that!

To avoid this in the future, I would a like to have a stock reply ready to
go. A few short sentences that clearly crystallize what Ruby is and why the
asker should care. Once I make it past this introduction (in situations
where there is time and its appropriate) I can talk endlessly in-depth about
Ruby. But I want to be able to make that good first impression without
tripping all over myself... An impression good enough to make them want to
know more.

So, I wanted to ask all of you, what would your answer be to the question
"What is Ruby"?

I usually go for "First rule of Ruby Club - you do not talk about Ruby Club"
- it's politer than 'what, Google down, is it?'.
 
C

Curt Hibbs

I, for one, dislike Python for various reasons. However, both Python and
Ruby exist, and are both successful, because they fit different people's
ways of thinking about the world. Ruby fits my way of thinking. Python
doesn't. For a Python fan, it is doubtless the other way around.

I don't think there is anything wrong with that. I don't think Ruby is
out to displace Python. In fact, I don't think it ever could, just
because there are lots of people for whom Python is a better fit than
Ruby is. That's not blasphemy, just honest talk. ;)

Well said!

Curt
 
J

Joao Pedrosa

Hi,

Well said!

Maybe we should have a clear position of why Ruby is a "little bit" better
than Python for us. The reason is to evangelize Ruby more easily or at
least not repeat ourselves when explaining what Ruby is. The third
option is to shut-up about it, keeping out little secret. :)

Cheers,
Joao
 
S

Simon Strandgaard

* Curt Hibbs <[email protected]> [1047 13:47]: [snip]
So, I wanted to ask all of you, what would your answer be to the question
"What is Ruby"?

I usually go for "First rule of Ruby Club - you do not talk about Ruby
Club" - it's politer than 'what, Google down, is it?'.


Ruby has hidden positive suprises. Even though I have used it for long time,
it keeps amaze and suprise me. It gives me energy.
 
J

Joel VanderWerf

Simon Strandgaard wrote:
...
Ruby has hidden positive suprises. Even though I have used it for long time,
it keeps amaze and suprise me. It gives me energy.

So ruby has both POLS and POPS (or POMS)?

I agree though--when I've been surprised by ruby, it has almost always
been a pleasant surprise.
 
M

Mike Clark

Maybe we should have a clear position of why Ruby is a "little bit"
better
than Python for us. The reason is to evangelize Ruby more easily or at
least not repeat ourselves when explaining what Ruby is. The third
option is to shut-up about it, keeping out little secret. :)


Or just keep building good, clean applications that people can
understand quickly and maintain economically. Then they'll want to
know how you did it.

Mike
 
R

Reimer Behrends

bruno modulix ([email protected]) wrote:
[...]
IMHO, the biggets difference is that the 'main' influence (well... the
most obvious...) is C for Python and Smalltalk for Ruby (oh, and yes :
most pythonistas think of Perl as one of the most horrible thing in the
world !-)

I very much doubt that C ever was a strong influence for Python's
design; Python's roots lie in ABC [1], a teaching language developed at
CWI, and there is some additional Modula-3 influence. Recent (post 1.5)
additions draw on features available in yet other languages, such as
Icon and Sather, but not C, either.

Reimer Behrends

[1] http://homepages.cwi.nl/~steven/abc/
 
J

Jamis Buck

Joao said:
Hi,




Maybe we should have a clear position of why Ruby is a "little bit" better
than Python for us. The reason is to evangelize Ruby more easily or at
least not repeat ourselves when explaining what Ruby is. The third
option is to shut-up about it, keeping out little secret. :)

Good point, Joao. For me, I prefer Ruby over Python for a few reasons:

1) Python's outline style REALLY bugs me.

2) Last time I used Python (may be different now), you had to
explicitly declare 'self' as a parameter of every method. It just seemed
noisy and unnecessary.

3) Ruby's C API is the cleanest of any language I've ever seen.

4) Blocks are a beauty unto themselves.

There are other things I love about Ruby (of course!), but it's been 4
years since I last looked at Python and I don't feel qualified to say
whether Python has those other features or not.

- Jamis
 
G

gabriele renzi

bruno modulix ha scritto:
The second part was already used 5 years ago when talking about Python...

imo python's marketing word is 'readability' or 'simplicity', not fun.
google agrees:
"makes programming fun again" + ruby ->152 results
fun+ruby -> 1.100.000
"makes programming fun again" + py -> 63 results
fun+python -> 630.000

;)
 
G

gabriele renzi

Joao Pedrosa ha scritto:

Maybe we should have a clear position of why Ruby is a "little bit" better
than Python for us. The reason is to evangelize Ruby more easily or at
least not repeat ourselves when explaining what Ruby is. The third
option is to shut-up about it, keeping out little secret. :)

you can't really have a a clear 'why it is better for me' thing.
I mea, that why you have 'for me' :)
Just tell 'em "it fits my mind better, YMMV but, well, try it"
 
G

gabriele renzi

Joao Pedrosa ha scritto:

That's simplifying too much for Ruby. Python may have that influence, though.

that's simplifying too much for both, but bruno was talking about _main_
influence, and well, ruby and smalltalk are mostly the same language
with different syntax ;)
 
G

gabriele renzi

bruno modulix ha scritto:

It doesn't.

Right, it does'nt for 'types' like str, but it does for all the other
classes, and you can override builtin's metaclass.
And there is a module to allow the change of builtins.
But in the end you're right, I was incorrect (by reading 'builtin' as
'existing' )
 
E

Eivind Eklund

I don't think there is anything wrong with that. I don't think Ruby is
out to displace Python. In fact, I don't think it ever could, just
because there are lots of people for whom Python is a better fit than
Ruby is. That's not blasphemy, just honest talk. ;)

I've tried to talk to people that know burh Ruby and Python, in an
attempt to find somebody that actually like Python-the-language better
than Ruby-the-language, because I'd really like to learn Python, and
I'm looking for motivation.

I've not yet found anybody that like Python-the-language better. I've
found people that like Python-the-implementation better, and a few
that like the documentation better. I've found a few that think that
significant whitespace is good (and about the same that hate
significant whitespace), but not yet any that like Python-the-language
better than Ruby-the-language better. All seem to feel that Ruby is
better.

Counter examples are (somewhat) welcome ;-)

Eivind.
 
G

gabriele renzi

Eivind Eklund ha scritto:

Counter examples are (somewhat) welcome ;-)

I know some, the points I remember are:

- @vars sux
- $vars too
- why should I write 'end'??
- functions should be objects and __call__ is cool (the function
aplication operator, () )
- multiple inheritance is a good thing
- __nonzero__ is sometimes useful (#to_bool for rubyists )
- blocks are useless
- python's metaclasses are great
- list comprehensions are far better than map() and the likes
- hey, writing self is good, you can name it cls or ignore it when non
writing instance methods
- having separated concepts for statements and expressions is useful
(just heard once)
- callcc is the devil
- TIMTOWTDI is a wrong concept
- general dislike of %stuff literals
- lack of named arguments
- docstrings are cool


note that not all of them think all this, I just summed all the
different critics.

But I think they just had a quick look at ruby, not a deep one, and they
usually agree that in the end there are far more similarities than
differences.
 
P

Phlip

Jamis said:
I, for one, dislike Python for various reasons. However, both Python and
Ruby exist, and are both successful, because they fit different people's
ways of thinking about the world. Ruby fits my way of thinking. Python
doesn't. For a Python fan, it is doubtless the other way around.

I don't think there is anything wrong with that. I don't think Ruby is
out to displace Python. In fact, I don't think it ever could, just
because there are lots of people for whom Python is a better fit than
Ruby is. That's not blasphemy, just honest talk. ;)

Python and Ruby are so closely similar they will cause a great amount of
friction and sibling rivalry.

I worked with Python exclusively for 2 years. (Don't swoon with delight at
the idea of not working with Java for 2 entire years, folks. A dime of
profit from the venture would have been nice! But t'wasn't Python killed
that beast.) I at least earned the right to decree that Ruby always has and
always will beat Python.

Regardless of how much effort Python's implementers may spend catching up,
detail by detail Ruby got its language definition right. Python started with
the "indent to declare structure" model; this pushed down the idea of real
blocks with block closures. Ruby started with block closures, and these
provided cognitive efficiencies that have propelled the language's syntax,
semantics, and culture far beyond Python.
 
N

Nikolai Weibull

I know some, the points I remember are:

And here is what you should respond to their counterexamples:
- @vars sux
- $vars too

These are certainly not very hard-hitting counterexamples. @vars tells
both you and Ruby that 'var' is a class member variable. What can be
better than that? Prefixing class member variables with m_ perhaps? Or
perhaps just _? $vars tells both you and Ruby that 'var' is a global
variable. What can be better than that? You're supposed to minimize
the number of these in a program either way, so seeing these is a bad
sign either way and so you solve your own problem with "ugly"
variable-scope specifiers by not using them (and thus not global
variables). Either way, _you_ win.
- why should I write 'end'??

Because you're telling both Ruby and yourself where something ends?
Sure, Python uses indentation (and thus whitespace) for these things and
we all know what problems people have with indentation and whitespace
(tabs vs. spaces, make, and so on).
- functions should be objects and __call__ is cool (the function
aplication operator, () )

This is a joke, no? I'll assume it is and will stop here.
- multiple inheritance is a good thing

Multiple inheritance has its merits, but generally it makes class
hierarchies both harder for the compiler and for the programmer to
understand. Very few objects one may want to model require multiple
inheritance (mostly geometrics). You can do fine without it.
- __nonzero__ is sometimes useful (#to_bool for rubyists )

Why? In Ruby, everything but false and nil is true, so why would you
want this? If you would want a #to_bool, then use that instead. Using
pseudo-truthvalues on objects is both bad style and confuses the
intention of the code.
- blocks are useless

You are surely joking again, no? Blocks are probably the _one single
thing_ that makes Ruby great. Blocks, or closures as they are often
called, are what makes Lisp/Scheme great. They are basically what
defines both Ruby and Lisp/Scheme. If you find them useless you surely
shouldn't be using Ruby.

Also, if they are useless, why does Python have them?
- python's metaclasses are great

Why are they better than Ruby's?
- list comprehensions are far better than map() and the likes

Yes, that's why Ruby doesn't have map(); that's why we have .map. Why
do you find that

l = [1, 2, 3]
[i * 2 for i in l]

is far better than

l = [1, 2, 3]
l.map{ |i| i * 2 }

? It's not like one version is longer than the other, or one is easier
to follow than the other? In fact, the Python version requires the use
of two keywords and an additional feature of list creation.
- hey, writing self is good, you can name it cls or ignore it when non
writing instance methods

How is that a good thing? If you want to ignore it, then wouldn't you
rather simply not mention it at all? If you had given a decent argument
for this, such as "I use it as a reminder that obj.method(...) is more or
less like writing method(obj, ...) as : is in Lua", then at least you
would have made an argument for your point.
- having separated concepts for statements and expressions is useful
(just heard once)

What do you mean? That everything shouldn't have a value? If so, why?
I admit that it's not always useful, but there certainly are times that
one appreciates this and there's no reason it shouldn't be this way. It
only simplifies the concepts, both for the programmer, the language
designer, and the compiler. Writing a denotational semantics for the
language.
- callcc is the devil

Yes, certainly, and look how easy it is to simulate in Python:

http://www.ps.uni-sb.de/~duchier/python/continuations.html

You obviously don't understand what you're talking about. You just
followed some of the threads about continuations and thought to yourself,
"Boy, I'm certainly not following this discussion. I'll just say that I
think that call/cc is evil and people will think that I've thought this
through and that I am somehow gifted."
- TIMTOWTDI is a wrong concept

That's why Ruby isn't Perl. I can't really tell what you are getting at
with this point.
- general dislike of %stuff literals

You mean like %{literal}? Don't use them then.

Is it better to have '''literal''', """literal""", r"literal",
u"literal", ur"literal", U"literal", UR"literal", Ur"literal", and
uR"literal". Yeah, that's certainly _a lot_ better.
- lack of named arguments

While it is true that Ruby doesn't have named arguments as such atm (you
may use hashes instead), there is a nice syntax in the works for later
versions.
- docstrings are cool

Yes, they are. Finally, an argument that actually stands up against
simple critique. Ironic that it should be your last choice ;-).
note that not all of them think all this, I just summed all the
different critics.
But I think they just had a quick look at ruby, not a deep one, and they
usually agree that in the end there are far more similarities than
differences.

Hopefully not too many similarities ;-),
nikolai
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top