uqbar-project / wollok

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

Add reverse message to list #546

Closed JuanchiRios closed 8 years ago

javierfernandes commented 8 years ago

A couple of small details (we should have done this with a PR so we could create comments inline :P)

In subList method you are reassigning the parameters "start" and "end"

start = start.limitBetween(0,this.size()-1)
end = end.limitBetween(0,this.size()-1)

This "works" because wollok interpreter doesn't pay attention to static checks on imported files like the sdk. But I guess that if you open wollok.wlk with wollok editor you will find a compilation error, because in wollok parameters are "final", you cannot reassign them.

So, please go ahead and change it to something like

val _start = start.limitBetween(0,this.size()-1)
val _   end = end.limitBetween(0,this.size()-1)

Or whatever.

Then the other minor comment is that when passing a closure as the only argument to a message you don't need to wrap it with parenthesis This

a.forEach([i| newList.add(this.get(i))])

Can become

a.forEach[i | newList.add(this.get(i)) ]