Post AQArV1I43kzCmL9Pw8 by rbates@ruby.social
(DIR) More posts by rbates@ruby.social
(DIR) Post #AQApYNU9nOAqZlHSIi by solnic@ruby.social
2022-12-01T20:04:38Z
0 likes, 0 repeats
Probably unpopular opinion: ruby should only have a block-based class and module definition syntax. It would enable things that are now problematic, like knowing when a class definition ended, which could be very useful in case of libraries.#ruby #programming
(DIR) Post #AQApYNv6BDizvJsyIK by james@ruby.social
2022-12-01T20:22:06Z
0 likes, 0 repeats
@solnic what I want is a way to pass multiple blocks to a method. No idea what a nice syntax would look like though 🤷
(DIR) Post #AQArV1I43kzCmL9Pw8 by rbates@ruby.social
2022-12-01T20:43:53Z
0 likes, 0 repeats
@james @solnic Couldn't you pass lambdas as arguments if you need mulitple blocks?foo(bar: -> { ... }, blah: -> { ... })
(DIR) Post #AQAre0GvDQ22E5trzE by james@ruby.social
2022-12-01T20:45:28Z
0 likes, 0 repeats
@rbates @solnic yes but it's not beautiful.I think I know in the back of my mind that there is no syntax for doing what I want that also looks good to my eyes. But the heart wants what the heart wants...
(DIR) Post #AQAsVwvHsnGbTeVKAS by davetron5000@ruby.social
2022-12-01T20:55:15Z
0 likes, 0 repeats
@james @rbates @solnic Happy to slide in here with a ridiculous suggestion for the syntax:https://gist.github.com/davetron5000/cd6bc04a059ab6141533e1a8f415d75a
(DIR) Post #AQAtYQtlVPagygXYrA by james@ruby.social
2022-12-01T21:06:52Z
0 likes, 0 repeats
@davetron5000 @rbates @solnic a valiant effort!
(DIR) Post #AQAxjw7u8lhepdtX6m by baweaver@ruby.social
2022-12-01T21:53:45Z
0 likes, 0 repeats
@james @davetron5000 @rbates @solnic I'm still a fan of function objects which stack and compose block calls, like:Condition.if {...}.else{...}(not sure I'd do that specifically, but that general shape)