Mandatory braces

Lähettäjä: Johannes Ahl-mann <softpro@gmx.net>
Aihe: mandatory braces

hi,

i've been playing around with ruby a bit and have a proposal to make.
i am sure that ruby won't adopt it right away and maybe it goes too much
against the ruby way. also, if this has been discussed earlier here, i
apologize for not researching ;-))

if ruby made braces (the round ones :wink: mandatory this would produce
some very nice effects and break nothing except for backward compatibility
(i think). regarding the backward compatibility one could even introduce
a new command-line switch to explicitely activate the "new" syntax.
a few things would become possible:

- differentiation between method bindings and method applications, i.e.
    "function1(function2)" instead of "function1(method(:function2))

Just skipping the method() step might be enough? The visual cue from
a Symbol would seem to be equivalent to parens, so:

function1(function2) # Calls function1 with the result of function2
function1(:function2) # Calls function1 with a Proc/Method object

- procedure objects could be treated similarly to functions:
    "myproc()" instead of "myproc.call()"

An overridable operator () would be useful.

- ruby code would look more uniform, because at the moment the mixing
  of braces and no-braces drives me crazy *gg*
- on the negative side this would force braces for methods "yield",
  "print", "puts", "break", etc.
please tell me whether this is a bad idea,

Well, only for the fact that it would mandate extra typing :slight_smile:

Johannes

E

E S <eero.saynatkari@kolumbus.fi> writes:

- procedure objects could be treated similarly to functions:
    "myproc()" instead of "myproc.call()"

An overridable operator () would be useful.

I actually would like that, but else, *no way* for forced ().
I think they make python unreadable.

···

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org