From: "hurricup (Alexandr Evstigneev) via ruby-core" Date: 2023-04-04T04:37:50+00:00 Subject: [ruby-core:113102] [Ruby master Feature#19545] lp/hp logic parsing inconsistency Issue #19545 has been updated by hurricup (Alexandr Evstigneev). jeremyevans0 (Jeremy Evans) wrote in #note-4: > hurricup (Alexandr Evstigneev) wrote in #note-3: > > And any expression is a valid argument for any call. > > Just to be clear, while this may be a common belief, this is not the case. If you define valid expression to be a piece of Ruby code that could be executed by itself without a syntax error, then not all valid expressions are valid arguments in Ruby. The most obvious reason why not all valid expressions can be arguments is that some valid expressions contain `,`, which is used to separate arguments (e.g. multiple assignment). However, that isn't the only reason. Thank you for the explanation. This is totally understandable for me. I just saying that this may be non-intuitive for the language user. Comma situation could be handled with proper precedence btw. Like perl does, for example. If you curios, see the table in the end of section: https://perldoc.perl.org/perlop#Operator-Precedence-and-Associativity ---------------------------------------- Feature #19545: lp/hp logic parsing inconsistency https://bugs.ruby-lang.org/issues/19545#change-102637 * Author: hurricup (Alexandr Evstigneev) * Status: Open * Priority: Normal ---------------------------------------- As far as i get it, low precedence logic should behave the same as high precedence. But: This is ok: ``` puts(false || !false) ``` And this is not: ``` puts(false or not false) ``` Feels like in latter case there is some mess with comma precedence. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/