Forgot your password?
typodupeerror
Programming Ruby

Ruby, Clojure, Ceylon: Same Goal, Different Results 138

Posted by timothy
from the ways-of-seeing dept.
snydeq writes "Charles Nutter, Rich Hickey, and Gavin King each discovered that 'simplicity' doesn't mean the same thing as they developed Ruby, Clojure, and Ceylon, respectively. 'Languages that are created with similar goals in mind may yield highly disparate final results, depending on how their communities understand those goals,' writes Andrew Oliver. 'At first, it surprised me that each language's creator directly or indirectly identified simplicity as his goal, as well as how differently the three creators and their languages' communities define what simplicity is. For Ruby, it is about a language that feels natural and gets out of your way to do what you want. For Clojure, it is about keeping the language itself simple. For Ceylon, it is a compromise between enabling the language to help, in King's words, "communicating algorithms to humans" and providing proper tooling support: the same general goal, three very different results.'"
This discussion has been archived. No new comments can be posted.

Ruby, Clojure, Ceylon: Same Goal, Different Results

Comments Filter:
  • by pmontra (738736) on Sunday June 17, 2012 @12:15PM (#40352053) Homepage

    There isn't. But this is how to do it in Ruby

    String.instance_methods.select {|m| m.match("sub")}
    => ["sub", "gsub!", "gsub", "sub!"]

    instance_methods returns an array. select iterates on it calling a code block on every element. If the block returns true it adds the element to the array it will return at the end of the loop. |var| is how the element is passed to the block. Blocks can span over multiple lines, it's usual to wrap them inside a do..end but { } still work.

    String.instance_methods.select {|m| m =~ /sub/}} is the perlish alternative.

    I didn't match "last" as in the article because Ruby's String has no methods with "last" in their name.

  • by MarchHare (82901) on Sunday June 17, 2012 @12:26PM (#40352135)

    A slightly better way, IMHO:

        String.instance_methods.grep /sub/

  • by jbolden (176878) on Sunday June 17, 2012 @01:35PM (#40352659) Homepage

    That's why there is no easy to explicitly do things such as pointers, gotos, and operator overloading

    The reason there was no pointers was that pointer manipulations were highly machine dependent. Java emerged out of Oak and the slogan "write once run anywhere" was key to its popularity.

    Goto -- came from the whole philosophy that goto leads to bad code.

    Operator overloading and multiple inheritance are both examples where subtle shifts in code can lead to enormous shifts in how the compiler views the code. One of the key aspects of Java was making sure that side effects to changing code were contained.

"But this one goes to eleven." -- Nigel Tufnel

Working...