What are your favorite Ruby features?

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/Computers/25588

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

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:

twiigs.com - twiigs Resources and Information.

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?:wink:

···

--
   Phlip
   Radar – O’Reilly

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

···

--
Posted via http://www.ruby-forum.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:

twiigs.com - twiigs Resources and Information.

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

···

2009/2/16 Tony Arcieri <tony@medioh.com>:

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

Hi --

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:

twiigs.com - twiigs Resources and Information.

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! :slight_smile:

David

···

On Mon, 16 Feb 2009, Tony Arcieri wrote:

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

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

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

···

On Mon, Feb 16, 2009 at 5:26 AM, Tony Arcieri <tony@medioh.com> wrote:

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

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.

Are you interested in borrowing from other languages too? In that case:

- maybe you should poll (say) Erlang users about what their favourite
features are of that language

- maybe poll Ruby users about what their favourite features from *other*
languages are, that they would have liked to have seen in Ruby

- maybe poll Ruby users if there are any things they dislike about Ruby
in its current form

···

--
Posted via http://www.ruby-forum.com/\.

I just blogged about the results of my
poll<http://unlimitednovelty.com/2009/03/what-do-rubyists-like-about-ruby.html>.
Here they are for the curious:

   1. Blocks (71%)
   2. Lambdas / Procs (57%)
   3. Mix-ins / Modules (55%)
   4. Open classes / monkeypatching (53%)
   5. Duck-typing (53%)
   6. First-class regexps (49%)
   7. Metaprogramming (49%)
   8. Syntactic sugar e.g. val ||= x; array <<>
   9. Optional parens / English-like readability (44%)
   10. Object#method_missing (42%)

···

--
Tony Arcieri

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? :slight_smile:

···

--
M. Edward (Ed) Borasky

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

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? :slight_smile:

David

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

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

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

Are you interested in borrowing from other languages too?

Yes!

In that case:

- maybe you should poll (say) Erlang users about what their favourite
features are of that language

Well, in my case, my language is running on the Erlang VM (
http://wiki.reia-lang.org) and will have all the features of Erlang and then
some.

But yes, this is excellent advice, and as I'm trying to borrow the best
features of Python as well I intend to post a similar thread on python-list

- maybe poll Ruby users about what their favourite features from *other*
languages are, that they would have liked to have seen in Ruby

- maybe poll Ruby users if there are any things they dislike about Ruby
in its current form

Both excellent advice

···

On Mon, Feb 16, 2009 at 1:31 PM, Brian Candler <b.candler@pobox.com> wrote:

--
Tony Arcieri

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 {} ?)

Sorry about that. That one was a particularly bad case of trying to jam
together poll options so there weren't so many to pick from.

But yes, you're correct: in regard to usage of blocks by the standard
library I'm talking about things like File.open {}, or for that matter
String#gsub(x) {} or Enumerable#zip {}

I feel the Ruby standard library does a great job of making use of blocks
and feel that's one of the reasons blocks are so popular in general.

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)

Pretty much, that was meant to cover all cases of altering the definitions
of existing classes/modules at runtime by a facility which may lack formal
knowledge of what the original definition actually was.

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

This is another case of overlap... the "English-like readability" bit
typically plays into DSLs which use English words and generally try to make
your code read more like a natural language (e.g. RSpec)

I certainly understand that people can like optional parens for other
reasons but DSLs are one particularly compelling use case for them, I
believe.

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

String interpolation

This was covered by the poll, I believe, although described as:

Embedding code in strings with "#{mycode}"

I hadn't heard the phrase "string interpolation" before but that's what it
covers, correct? If so, glad to know the proper term. That's a
particularly nasty one to implement but one I'd like to try my hand at soon
:slight_smile:

Zero being true

Yes, definitely a noticeable omission. I love Ruby's boolean semantics
although they seem to confuse newbies to the language.

Single inheritance

Given how pervasive single inheritance is (and the fact I already implement
it) I wasn't particularly concerned about this, so much as using mixins in
lieu of multiple inheritance. I thought about putting it on the poll, but
decided to just list mixins instead.

···

On Mon, Feb 16, 2009 at 3:25 AM, David A. Black <dblack@rubypal.com> wrote:

--
Tony Arcieri

Tony Arcieri wrote:

I just blogged about the results of my
poll<Unlimited Novelty.

Tx for the work; this survey is relevant for all of language design. By "like" we simply mean "find very profitable" here.

Here they are for the curious:

   1. Blocks (71%)

Certain other languages don't know what they are missing there.

   5. Duck-typing (53%)

And maybe some folks don't realize how important "emergent behavior" is. You can write designs in a dynamic language that you simply cannot translate to a static language. The emergent behavior is too subtle!

···

--
   Phlip

Tony, thanks for posting the outcome of your poll!

Kind regards

  robert

···

On 05.03.2009 04:31, Tony Arcieri wrote:

I just blogged about the results of my
poll<Unlimited Novelty.
Here they are for the curious:

   1. Blocks (71%)
   2. Lambdas / Procs (57%)
   3. Mix-ins / Modules (55%)
   4. Open classes / monkeypatching (53%)
   5. Duck-typing (53%)
   6. First-class regexps (49%)
   7. Metaprogramming (49%)
   8. Syntactic sugar e.g. val ||= x; array <<>
   9. Optional parens / English-like readability (44%)
   10. Object#method_missing (42%)

Good point, David, but in "my favor" ;). My diet consists mostly of my
favorite food... (pasta, caffè, 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.

···

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? :slight_smile:

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

Hi --

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)

Pretty much, that was meant to cover all cases of altering the definitions
of existing classes/modules at runtime by a facility which may lack formal
knowledge of what the original definition actually was.

I would say that altering core functionality badly is not a favorite
thing, but doing it knowledgeably might be :slight_smile:

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

This is another case of overlap... the "English-like readability" bit
typically plays into DSLs which use English words and generally try to make
your code read more like a natural language (e.g. RSpec)

I certainly understand that people can like optional parens for other
reasons but DSLs are one particularly compelling use case for them, I
believe.

I know people sometimes bundle the concept of DSL and the idea of
sounding like English together (with mixed success, usually, in my
view), but "domain-specific" doesn't really imply emulation of natural
language; it just implies a particular well-defined emergent notation
based on a subset of (computer) language constructs. At least, that's
how I see it.

I guess the only form of optional parentheses I actually would prefer
Ruby not to support is:

   def a b, c = 1

but it's not a very big deal.

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

String interpolation

This was covered by the poll, I believe, although described as:

Embedding code in strings with "#{mycode}"

Whoops, I forgot that when I made my list.

Zero being true

Yes, definitely a noticeable omission. I love Ruby's boolean semantics
although they seem to confuse newbies to the language.

It's definitely one of the Ruby rites of passage :slight_smile:

David

···

On Tue, 17 Feb 2009, Tony Arcieri wrote:

On Mon, Feb 16, 2009 at 3:25 AM, David A. Black <dblack@rubypal.com> wrote:

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

Ruby Training Atlanta! April 1-3, ruby training, atlanta, april 2009 - entp

Tony Arcieri wrote:

- maybe you should poll (say) Erlang users about what their favourite
features are of that language

Well, in my case, my language is running on the Erlang VM (
http://wiki.reia-lang.org) and will have all the features of Erlang and then
some.
  
Reia! I thought your name sounded familiar.

Here's my own list. I did fill out the questionnaire, but I'm not sure which of these were covered:

I like Ruby's relaxed syntax. I like letting things like parentheses be implied, leading to interesting, emergent phenomena like hashes as named arguments. (Not that I would complain if the language implemented named arguments -- even better if I don't have to use them as a hash -- so long as I can if I need to.)

I like the ability to create good-looking DSLs, but that's similar to the above.

The biggest thing I like from Python, and miss in Ruby, is significant indentation. Having a ton of end statements at the end of a file isn't particularly DRY, and I tend to have consistent indentation anyway.

The biggest thing I like from Javascript, and miss in Ruby, is prototypal inheritance and the near lack of a type system. There's no difference between a proc, a block, a function, and a method, and I can take any function, and apply it as a method to any object.

I also like things like Rubinius. I'd love to be able to dig deep into something like Reia without needing to use Erlang, just as I can usually dig into Ruby without needing C.

One thing I like from Erlang, and hope Reia keeps, in some form: Reloading modules on the fly.

This may be difficult, though -- technically it's possible in Ruby, but Ruby is dynamic enough that the sanest way has been Merb's approach of loading all of the library and framework code (everything except your app), then forking, then loading your app. When you want to make a change to your app, it kills the child, forks again, and loads your code, rather than try to patch a new version of your code onto the old....

Probably your best bet is to make it possible, and let other solutions be developed on top of that capability.

I love the idea of Reia, and can't wait to see where it goes. It's not yet polished enough to be used at work, and I've been impatient enough that I've started trying to write an actor library in Ruby. It's going very, very slowly.

···

On Mon, Feb 16, 2009 at 1:31 PM, Brian Candler <b.candler@pobox.com> wrote:

Tony Arcieri wrote:

Are you interested in borrowing from other languages too?

Yes!

You asked for it ...

From Newspeak (<http://NewspeakLanguage.Org/&gt;\):
- extremist message sending paradigm (no variables, no constants, no
     class dictionary, no instance fields ... just message sends)
- if everything is a message send, (nested) classes automatically
     also become namespaces, modules, mixins, packages, libraries and
     frameworks -- no need for a seperate module system or things like
     selector namespaces!
- object-capability based security
- mirror-based reflection (goes great together with
     object-capabilities: mirrors are capabilities for reflection)
- object literals
- aliens (extremely cool object-oriented FFI)
- Brazil (extremely cool GUI widget bindings)
- Hopscotch (there's actually two seperate things, both called
     Hopscotch: a framework for GUI applications and an IDE built with
     that framework)
- structured comments
- optional type annotations for implementing optional pluggable type
     systems
     
From Ioke (<http://Ioke.Org/&gt;\):
- even more extremist message sending: even literals are actually
     messages!
- Common Lisp style condition system instead of exceptions
- flexible handling of operators (however, see also Fortress)
- macros (however, see also the next entry)

From Converge (<http://ConverPL.Org/&gt;\)
- powerful compile-time metaprogramming in a language with complex
     syntax
     
From Fortress (<https://ProjectFortress.Sun.Com/&gt;\):
- even more extremist operator flexibility
- the idea that this is 2009 and we no longer have teletypes but
     instead pixel screens and Unicode and that programming language
     syntax should reflect that (e.g. Ruby's syntax was essentially
     designed in 1957)

From Cobra (<http://Cobra-Language.Com/&gt;\):
- both static (with inference) and dynamic typing
- language-integrated documentation (like Python docstrings)
- language-integrated unit tests
- language-integrated contracts (pre- and postconditions, invariants)

From Clojure (<http://Clojure.Org/&gt;\):
- arbitrary object metadata
- sane equality semantics due to deep immutability
- support for multiple orthogonal concurrency models that complement
     each other (Agents similar to Erlang Actors, Software
     Transactional Memory à la Haskell but better and variables with
     thread semantics)
- extremely powerful polymorphism due to user-provided dispatch
     functions, even more powerful than Common Lisp multimethods

From Scala (<http://Scala-Lang.Org/&gt;\), Perl 6
(<http://Perl.Org/perl6/&gt;\) and OMeta (<http://TinLizzie.Org/ometa/&gt;\):
- insanely powerful pattern matching, yet respecting OO encapsulation

*whow* That's quite a list! I expect a first prototype of Reia
sometime around 2030 (-:

jwm

···

On Mon, Feb 16, 2009 at 1:31 PM, Brian Candler <b.candler@pobox.com> wrote:

Language features aren't gratifying in the same way that food is,
though. There's another agenda: writing a program as well as possible.
If that agenda isn't served by lambdas, then there are no lambdas,
even if I think lambdas are really cool.

I love many Ruby features but they don't have the same kind of pull
as, say, Sugar Pops :slight_smile:

David

···

On Mon, 16 Feb 2009, Robert Dober wrote:

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? :slight_smile:

Good point, David, but in "my favor" ;). My diet consists mostly of my
favorite food... (pasta, caffè, 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?

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

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