Re: What are your favorite Ruby features?



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

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-maps.html
.



Relevant Pages

  • Re: Amazing LINQ for .Net
    ... >>> dynamic typing, use a different language. ... why even use types at all, if Ruby apparantly is so great? ... functional programming concepts into OOP. ... C#'s new features that help facilitate a more functional approach as ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Why do some methods names which replace the content in place doesnt have the "!" sign?
    ... } I program in C++ but fail to see how a feature from} a statically typed language would provide any benefit to a dynamic} language such as Ruby. ... I have never wanted for such a feature in Ruby but} I have wanted features from Ruby in other languages. ... There are many valuable features that are orthogonal to whether typing is ...
    (comp.lang.ruby)
  • Re: Ideas on "Why Living Dangerous can be A Good Thing" in Ruby?
    ... "Why Ruby's openness isn't a flaw." ... This thread is not about a language war, but touches on issues at the ... To convince people that Ruby is Right for cases where they are clinging ... features or changed coding styles. ...
    (comp.lang.ruby)
  • Re: PHP GTK vs every other stand-alone language
    ... Ruby actually comes VERY close to my descriptions. ... out and has those nice features for sure. ... the main language wich Sun seems to have copied when building Java. ... Support can be very helpful. ...
    (comp.lang.php)
  • Re: Ruby as First Language
    ... } My order was Quick BASIC, then C++, PHP, then Ruby. ... Most forms of Basic are, indeed, impediments to learning to ... I learned AppleSoft BASIC as my first language. ... } the basics of C or C++ in parallel with Ruby. ...
    (comp.lang.ruby)