[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

What are your favorite Ruby features?

Tony Arcieri

2/16/2009 4:27:00 AM

[Note: parts of this message were removed to make it a legal post.]

I'm creating a new language which borrows heavily from Ruby, and I'm curious
what features of Ruby its users enjoy the most.

I've put up a poll here:

http://www.twiigs.com/poll/Technology/Compu...

It's multiple choice, but if possible, try to limit yourself to the top 10
features of Ruby you consider important, rather than checking every single
box.

And of course, feel free to respond on the list, particularly with any
features you think I've omitted which are worthy of attention.

--
Tony Arcieri

65 Answers

Phlip

2/16/2009 4:51:00 AM

0

Tony Arcieri wrote:

> [Note: parts of this message were removed to make it a legal post.]
>
> I'm creating a new language which borrows heavily from Ruby, and I'm curious
> what features of Ruby its users enjoy the most.
>
> I've put up a poll here:
>
> http://www.twiigs.com/poll/Technology/Compu...
>
> It's multiple choice, but if possible, try to limit yourself to the top 10
> features of Ruby you consider important, rather than checking every single
> box.

Many of the items you list, such as "metaprogramming", or "easy to create DSLs",
are now must-have features for any language, going forward. That is Ruby's
impact on the industry.

But about "Redefining the behavior of core types", one might conflate overriding
with Monkey Patching. Overriding is good - it's what OO is all about. But...

It would be nice if Ruby, and your language, made Monkey Patching safe. One
reason we monkeys must patch is lack of Construction Encapsulation. If we could
simply upgrade the target object itself to our derived type, then we would not
need to "underride" a method and risk everyone gets it. So a system that
encapsulates construction automatically, so programmers don't need to work extra
for it, might be useful.

Another way to make MP safe might be Aspect Oriented Programming. I suspect that
AOP is actually Monkey Patching, with the added benefit you can declare which
modules see the patch and which see the classic behavior.

Finally, this may come as a shock to those who read my posts, but I tend to
think that TDD support systems, beginning with the lowly assert() method, should
behave like a debugger's variable watch system when they fail. They should
report the source code and value of every expression in their neighborhood when
they fail. But implementing that for an assertion - even within the mighty Ruby
- is often freaking impossible. I have written an assert{ 2.0 } that comes
very close, using major hacking with internal Ruby tools on that block. But
getting rid of the block, and just using assert(), would be a major win.

Could your language provide all those abilities as first-class features, under
the "metaprogramming" and "reflection" banners, so we can use them anywhere?
(And [ahem!] why weren't they in your list?;)

--
Phlip
http://broadcast.oreilly.com/2009/02/merb-mind...

znmeb

2/16/2009 5:08:00 AM

0

Phlip wrote:

> Many of the items you list, such as "metaprogramming", or "easy to
> create DSLs", are now must-have features for any language, going
> forward. That is Ruby's impact on the industry.

Those existed in Lisp, Scheme and Forth, but Ruby made them *popular*
and quite a bit more readable.

> Another way to make MP safe might be Aspect Oriented Programming. I
> suspect that AOP is actually Monkey Patching, with the added benefit you
> can declare which modules see the patch and which see the classic behavior.

Well ... there *are* AOP languages. Does anybody use them? :)



--
M. Edward (Ed) Borasky

I've never met a happy clam. In fact, most of them were pretty steamed.

Bezan Kapadia

2/16/2009 6:24:00 AM

0

Exception Handling , though it gets wacky at times...
--
Posted via http://www.ruby-....

Robert Klemme

2/16/2009 8:34:00 AM

0

2009/2/16 Tony Arcieri <tony@medioh.com>:
> I'm creating a new language

Why?

> which borrows heavily from Ruby, and I'm curious
> what features of Ruby its users enjoy the most.
>
> I've put up a poll here:
>
> http://www.twiigs.com/poll/Technology/Compu...
>
> It's multiple choice, but if possible, try to limit yourself to the top 10
> features of Ruby you consider important, rather than checking every single
> box.

I got 9. Phew!

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end

David A. Black

2/16/2009 10:26:00 AM

0

Hi --

On Mon, 16 Feb 2009, Tony Arcieri wrote:

> I'm creating a new language which borrows heavily from Ruby, and I'm curious
> what features of Ruby its users enjoy the most.
>
> I've put up a poll here:
>
> http://www.twiigs.com/poll/Technology/Compu...
>
> It's multiple choice, but if possible, try to limit yourself to the top 10
> features of Ruby you consider important, rather than checking every single
> box.
>
> And of course, feel free to respond on the list, particularly with any
> features you think I've omitted which are worthy of attention.

Some of the choices involve coupling things that I wouldn't
necessarily put together, like the standard library and its use of
blocks (I'm not sure what you mean by the latter; things like
File.open {} ?) or open classes and monkeypatching (I don't know which
of the various meanings of the latter you mean; I think they're all
subsets of the former) or optional parens and English-like readability
(I'm ambivalent about both, but for different reasons, and it depends
a bit which optional parens you mean).

A couple of other things that might go on such a list:

String interpolation
Zero being true
Single inheritance

Anyway, I had no trouble finding ten and then some! :-)


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!

Robert Dober

2/16/2009 11:09:00 AM

0

On Mon, Feb 16, 2009 at 5:26 AM, Tony Arcieri <tony@medioh.com> wrote:
Very nice, thank you for showing the polling results.
I see that the single most loved feature is lambdas with 88%.
I like that but do we use them to that extent?
Maybe something to reflect upon, right;)? - or is this high-jacking
this thread, yup feels so. I will open a new one.
Robert


--
There are some people who begin the Zoo at the beginning, called
WAYIN, and walk as quickly as they can past every cage until they get
to the one called WAYOUT, but the nicest people go straight to the
animal they love the most, and stay there. ~ A.A. Milne (from
Winnie-the-Pooh)

David A. Black

2/16/2009 11:36:00 AM

0

Hi --

On Mon, 16 Feb 2009, Robert Dober wrote:

> On Mon, Feb 16, 2009 at 5:26 AM, Tony Arcieri <tony@medioh.com> wrote:
> Very nice, thank you for showing the polling results.
> I see that the single most loved feature is lambdas with 88%.
> I like that but do we use them to that extent?

There's no usage extent implied. Does your diet consist mainly of your
favorite food? :-)


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!

Phlip

2/16/2009 12:06:00 PM

0

Bezan Kapadia wrote:

> Exception Handling , though it gets wacky at times...

The great thing about blocks is you can hide the wackiness:

def foo
x = 42
yield_me do
return x + 1
end
end

def yield_me
prepare()
yield()
explode()
ensure
cleanup()
end

That is the "execute around pattern" - prepare() and cleanup() will always call
around blocks passed to yield_me. Even if the block raises an exception.

Question - does the return throw away the explode() call? I have not yet
bothered to determine this while coding, though I may even have used the effect
in others' blocks, already!

--
Phlip

Robert Dober

2/16/2009 12:36:00 PM

0

On Mon, Feb 16, 2009 at 12:36 PM, David A. Black <dblack@rubypal.com> wrote=
:
> Hi --
>
> On Mon, 16 Feb 2009, Robert Dober wrote:
>
>> On Mon, Feb 16, 2009 at 5:26 AM, Tony Arcieri <tony@medioh.com> wrote:
>> Very nice, thank you for showing the polling results.
>> I see that the single most loved feature is lambdas with 88%.
>> I like that but do we use them to that extent?
>
> There's no usage extent implied. Does your diet consist mainly of your
> favorite food? :-)
Good point, David, but in "my favor" ;). My diet consists mostly of my
favorite food... (pasta, caff=E8, cioccolati )
Surely you will eat as much of your favorite food as a balanced diet
allows (and probably just a little more).
Do we do this with lambdas? I do not think so..., do you?
R.


--=20
There are some people who begin the Zoo at the beginning, called
WAYIN, and walk as quickly as they can past every cage until they get
to the one called WAYOUT, but the nicest people go straight to the
animal they love the most, and stay there. ~ A.A. Milne (from
Winnie-the-Pooh)

Robert Dober

2/16/2009 3:55:00 PM

0

On Mon, Feb 16, 2009 at 2:13 PM, David A. Black <dblack@rubypal.com> wrote:

>
> Language features aren't gratifying in the same way that food is,
> though.
I am glad you realize.
Now do you really think it is a bad idea to think about modifying our
approach to what we do in general and programming in Ruby in special?
Is there anything intrinsically counter productive or maybe even
stupid in my remark?
I have the feeling you did not take my suggestion seriously, pity....

Robert