Post AuFedvdocKt9mDgrOS by fuxoft@kompost.cz
(DIR) More posts by fuxoft@kompost.cz
(DIR) Post #AuFedvdocKt9mDgrOS by fuxoft@kompost.cz
2025-05-19T12:16:02Z
0 likes, 0 repeats
Just spent 20 minutes pulling my hair out because Ruby's "and" has lower operator precedence than assignment to variable!#programming #nerdy #ruby
(DIR) Post #AuFgFfESAr1fqLNvPs by dusoft@fosstodon.org
2025-05-19T12:34:13Z
0 likes, 0 repeats
@fuxoft Bleh, wtf.
(DIR) Post #AuFgP9Cg6uz9P74oHg by LukeAlmighty@gameliberty.club
2025-05-19T12:36:14Z
0 likes, 0 repeats
@fuxoft This is why I never skip a perentecise.Even though, it ends up being a mess of funding the missing/redundant ones. :ablobcool:
(DIR) Post #AuFkg2XmWX7pUOG3lI by fuxoft@kompost.cz
2025-05-19T13:24:03Z
1 likes, 0 repeats
@LukeAlmighty Yeah, but my life so far hasn't prepared me for the possibility that "x = a and b" is not "x = (a and b)" but instead "(x=a) and b".
(DIR) Post #AuFkj02GJ3F4ZuvUB6 by fuxoft@kompost.cz
2025-05-19T13:24:32Z
0 likes, 0 repeats
@dusoft That should serve as a lesson in difference between "and" and "&&"...
(DIR) Post #AuFlofvc4r75uO5QMi by LukeAlmighty@gameliberty.club
2025-05-19T13:36:52Z
0 likes, 0 repeats
@fuxoft Yeah, 20 minutes is an insane speed when it comes to this bullshit.
(DIR) Post #AuFmIr6d5EdnGMd8nQ by svoop@ruby.social
2025-05-19T13:42:03Z
0 likes, 0 repeats
@fuxoft That's how the rule of thumb "and/or only for control flow" came to be: "a<b && b<c" versus "perform(action) and log(action)" (with the latter being synonymous to "log(action) if perform(action)" in a more natural order).
(DIR) Post #AuFmsu9lDe8x9IHhTM by dusoft@fosstodon.org
2025-05-19T13:48:32Z
0 likes, 0 repeats
@fuxoft Also languages should be designed around common sense 🙂
(DIR) Post #AuFnSetnQJfyFmrksy by blami@mastodon.online
2025-05-19T13:55:03Z
0 likes, 0 repeats
@fuxoft I hate that too. and/or in ruby are not logical and/or but logical composition. Point of their existence is to be able to express control flow in an expression.
(DIR) Post #AuFz5SXgOk0GigE7we by fuxoft@kompost.cz
2025-05-19T16:05:21Z
0 likes, 0 repeats
@dusoft In Ruby, assignments are expressions and "and" & "or" are intended for composing larger expressions while "&&" & "||" are intended for "normal" boolean operations. I can't say I approve but it makes some sense.