From: "sawa (Tsuyoshi Sawada) via ruby-core" Date: 2023-03-30T05:35:47+00:00 Subject: [ruby-core:113046] [Ruby master Feature#17290] Syntax sugar for boolean keyword argument Issue #17290 has been updated by sawa (Tsuyoshi Sawada). I withdraw this proposal. Please close it. I came up with a better idea #19559. ---------------------------------------- Feature #17290: Syntax sugar for boolean keyword argument https://bugs.ruby-lang.org/issues/17290#change-102585 * Author: sawa (Tsuyoshi Sawada) * Status: Open * Priority: Normal ---------------------------------------- We frequently use keyword arguments just to pass `true` value out of the truthy/falsy options given. And in many such cases, the falsy option is set as the default, and only the truthy value is ever passed explicitly. I propose to have a syntax sugar to omit the value of a keyword argument. When omitted, it should be interpreted with value `true`. ```ruby gets(chomp:) CSV.parse(" foo var ", strip:) ``` should be equivalent to ```ruby gets(chomp: true) CSV.parse(" foo var ", strip: true) ``` Additionally, we may also extend this to pragmas. ```ruby # frozen_string_literal: ``` to be equivalent to: ```ruby # frozen_string_literal: true ``` -- 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/