shoes / shoes4

Shoes 4 : the next version of Shoes
Other
1.59k stars 194 forks source link

Should we adopt Ruby 2.0 keyword arguments syntax for DSL methods? #229

Open wasnotrice opened 11 years ago

wasnotrice commented 11 years ago

I was wondering if the new keyword arguments might be a good fit for Shoes. Here's an experiment. What do you think? Currently, JRuby doesn't support this syntax (in 1.7.3 or in head), but I'm sure it will land soon.

wasnotrice commented 11 years ago

Update: JRuby does support keyword args with the --2.0 flag, but it's not 100% compatible with MRI's implementation--some of my specs fail under JRuby.

PragTob commented 11 years ago

I think that keyword args are an option for the future when it is more stable. Just today an important change to keywords got merged into MRI, namely that there can be required keyword arguments. Which is super important for me.

So I believe it would be best to adapt when this feature is more stable. It might something to do after the initial release for a 1.1 version or so.

Plus, currently at least code climate would still break (at least they didn't support keyword arguments back in march and will not until ruby-parser supports them).

But overall I'm a big :+1: on this since I :heart: keyword arguments =)

davorb commented 11 years ago

I thought about that when 2.0 came out and imho it might be too early to jump on this right now. But it's absolutely something that we should adopt in the future. Maybe in 8+ months?

PragTob commented 11 years ago

That's also a time frame I thought of. I would wait at least until required keyword args ship to jruby and are official in both MRI and jruby e.g. in releases of both not just master/trunk. And then a little bit of time :-)

wasnotrice commented 11 years ago

Yeah, I'm not thinking we should merge this in now...I was just curious about how much simpler the keyword args would be. I went from thinking, "lots" to thinking, "oh, not so much", to thinking, "maybe we should change the dsl to be keywords only" to thinking "let's just put all the logic in the parameter list" ;)

I'm curious how Code Climate would treat this kind of thing. It certainly doesn't like our current implementation :)

PragTob commented 11 years ago

Hehe there is a lot to improve on the current implementation :-)

As for code climate, as of 2 months ago it wouldn't work at all with keyword arguments... due to the need of a new version of ruby-parser it whatever that gem's name is.

I think we should keep this under consideration for the future. Therefore adding it to the 4.1.0 mile stone for now.