uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Add .times to integer #566

Closed flbulgarelli closed 8 years ago

flbulgarelli commented 8 years ago

That is a simpler case of range iteration:

3.times {
   someone.doSomething()
}

We could name it times, or timesDo or timesRepeat . I like the first one.

matifreyre commented 8 years ago

Shouldn't it receive a closure as its argument? El ene. 1, 2016 14:41, "Franco Leonardo Bulgarelli" < notifications@github.com> escribió:

That is a simpler case of range iteration:

3.times { someone.doSomething() }

We could name it times, or timesDo or timesRepeat . I like the first one.

— Reply to this email directly or view it on GitHub https://github.com/uqbar-project/wollok/issues/566.

javierfernandes commented 8 years ago

@matifreyre that's actually a closure. Just that, as I noticed :) the new closure's syntax could be confused with blocks (sets of statements/expression).

This can be read as:

3.times( {  someone.doSomething()   })

Maybe that's more explicit.

matifreyre commented 8 years ago

You mean the parenthesis are optional even when you do have parameters? Indeed it looks like a block. If that's the case, it seems very confusing to me. I'd rather not have that option, or at least limit it to no-parameter methods.

On Fri, Jan 1, 2016 at 6:26 PM, javierfernandes notifications@github.com wrote:

@matifreyre https://github.com/matifreyre that's actually a closure. Just that, as I noticed :) the new closure's syntax could be confused with blocks (sets of statements/expression).

This can be read as:

3.times ( { someone.doSomething() } )

Maybe that's more explicit.

— Reply to this email directly or view it on GitHub https://github.com/uqbar-project/wollok/issues/566#issuecomment-168338866 .

npasserini commented 8 years ago

The parenthesis are optional only for a message with a unique parameter which is a closure.

On Fri, Jan 1, 2016 at 7:13 PM, Matías Freyre notifications@github.com wrote:

You mean the parenthesis are optional even when you do have parameters? Indeed it looks like a block. If that's the case, it seems very confusing to me. I'd rather not have that option, or at least limit it to no-parameter methods.

On Fri, Jan 1, 2016 at 6:26 PM, javierfernandes notifications@github.com wrote:

@matifreyre https://github.com/matifreyre that's actually a closure. Just that, as I noticed :) the new closure's syntax could be confused with blocks (sets of statements/expression).

This can be read as:

3.times ( { someone.doSomething() } )

Maybe that's more explicit.

— Reply to this email directly or view it on GitHub < https://github.com/uqbar-project/wollok/issues/566#issuecomment-168338866>

.

— Reply to this email directly or view it on GitHub https://github.com/uqbar-project/wollok/issues/566#issuecomment-168340988 .

npasserini commented 8 years ago

:+1: to this, even when we I have serious doubts about the now syntax closure.

On Fri, Jan 1, 2016 at 8:03 PM, Nicolas Passerini npasserini@gmail.com wrote:

The parenthesis are optional only for a message with a unique parameter which is a closure.

On Fri, Jan 1, 2016 at 7:13 PM, Matías Freyre notifications@github.com wrote:

You mean the parenthesis are optional even when you do have parameters? Indeed it looks like a block. If that's the case, it seems very confusing to me. I'd rather not have that option, or at least limit it to no-parameter methods.

On Fri, Jan 1, 2016 at 6:26 PM, javierfernandes <notifications@github.com

wrote:

@matifreyre https://github.com/matifreyre that's actually a closure. Just that, as I noticed :) the new closure's syntax could be confused with blocks (sets of statements/expression).

This can be read as:

3.times ( { someone.doSomething() } )

Maybe that's more explicit.

— Reply to this email directly or view it on GitHub < https://github.com/uqbar-project/wollok/issues/566#issuecomment-168338866

.

— Reply to this email directly or view it on GitHub https://github.com/uqbar-project/wollok/issues/566#issuecomment-168340988 .

flbulgarelli commented 8 years ago

Hey @matifreyre @npasserini I have started another thread about optional parenthesis #564 Could we discuss them there?

matifreyre commented 8 years ago

Sure thing. I also agree with the "times" addition for integers.