News for hackers. Stuff that matters.
Re:What Pythonistas Think of Ruby by gcampbell on Wednesday February 03, 2010 @12:35PM (#1098264)
The other side of the argument: why support anonymous functions, but restrict them to one line? That seems highly arbitrary.
Re:What Pythonistas Think of Ruby by fuzzyman on Wednesday February 03, 2010 @12:45PM (#1098293)
Nope - not arbitrary, it is because of the indentation scoping rules. Try coming up with a syntax for statement based lambdas that isn't ugly as heck.
Re:What Pythonistas Think of Ruby by jashkenas on Wednesday February 03, 2010 @01:18PM (#1098410)
First, links for context.

Guido's take: http://www.artima.com/weblogs/viewpost.jsp?thread=147358

Arcieri's take: http://www.unlimitednovelty.com/2009/03/indentation-sensitiv...

It's not hard if we disallow statements, and make everything into an expression that returns a value -- something that Ruby does right. The value of a block of statements is just the value of the last statement in the block.

So, whether you call it a function, or a method, or a lambda, or a block, whitespace with multi-line expressions can be made to work.

The commonly-cited lambda-with-multiple-prints example, in CoffeeScript:

    count: ->
      print 'one'
      print 'two'
      print 'three'
Re:What Pythonistas Think of Ruby by kevingadd on Wednesday February 03, 2010 @12:43PM (#1098285)
Not one line, one statement.