From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6FF5F1F5CB for ; Thu, 19 Sep 2024 21:51:11 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=Sco7lz9c; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=lrkrdJ18; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1726782668; bh=z1Vg8P9GfRk2UyrNKzaxekcsMEr6oE6sc55dC56WJNw=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=Sco7lz9ceAeKp3k/vJRlomU//hrirGiBqUraU4gNdcWwjFUJfdguo8fdaOy3U69xi nGzIUcA7qoUcYcTEfmVbzhSl3xj/nmYqhOxU0OE/OIwnJhQfGWYJCcuyWFM+2O7SyH 5A5OHLTAn/LxPOkGug3+ciZSbdREMPtvpAq2su78= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 550E643E16 for ; Thu, 19 Sep 2024 21:51:08 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=lrkrdJ18; dkim-atps=neutral Received: from s.wfbtzhsw.outbound-mail.sendgrid.net (s.wfbtzhsw.outbound-mail.sendgrid.net [159.183.224.105]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 2246143D31 for ; Thu, 19 Sep 2024 21:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=/adiBUARzJ79J8uhUlPfkvuEv/+Y3BIVPFOM2GcuPq4=; b=lrkrdJ185TMDCXBYk8coPEEIql9aNGwTXz4V/WpPgYeBoHDgJPD+6guFjC+cNtZEfPs/ WzMR8TJ5YjSQzd7USZ9n9kPdUwAFhHFCwDm1X9xnNdWSPzGON6BlWHbRp0i/3qNz1zZtjk snhH8bNpbvr5GD+0+NDiu6MzXpIGdFvVVS8L9dfLfNK22/qaROe36dlIhNgbI3IymorHf/ HBFRzaWWCgXH5rr08ItM8tFg3wVjvGLKA2qWwyoXr66xGb+xh/1hsK0BiZA7Cb50gAHf0H msicUUnlkp2P4EtnUMpFBrtfPk0FGrTP4Gc+9cinmWhcEkPFCcAL9zuPgM89YKsA== Received: by recvd-5577bcb48c-462gf with SMTP id recvd-5577bcb48c-462gf-1-66EC9CBF-7 2024-09-19 21:50:55.75531122 +0000 UTC m=+618845.582567621 Received: from herokuapp.com (unknown) by geopod-ismtpd-22 (SG) with ESMTP id J-sd8ns8QBCm0sa6PVjpPQ for ; Thu, 19 Sep 2024 21:50:55.725 +0000 (UTC) Date: Thu, 19 Sep 2024 21:50:55 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20756 X-Redmine-Issue-Author: kbrock X-Redmine-Issue-Priority: Normal X-Redmine-Sender: kbrock X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 95897 X-SG-EID: =?us-ascii?Q?u001=2E+Y2T8K9iEYAG22L5MkNQC34RaZgdxGaDq8I6aaeV+81e=2FcAwba8i7Lr6l?= =?us-ascii?Q?JBfIB15Ky15z3kpZdwvEgeU0vcG8Lwi6rQpXOJf?= =?us-ascii?Q?HKkx8lP7kTBuHl41yeldoRl=2FduLUYhLWiFEYrfb?= =?us-ascii?Q?HongNB1VqaIlTBnmxU7ap0hdfMQELaTN=2FetV7Xj?= =?us-ascii?Q?PI3L9Qp9tAuHe3UAQgLylu26rYVQMgF=2Ff2mw7iQ?= =?us-ascii?Q?zB8yTBgPbOMA250Tjpa4uubLpM5FQrem0+DHbnH?= =?us-ascii?Q?v+l8CO52EE2x7odZE0IDJSE8Pw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: RUJCEEI4GWZCJAJ2H7KFAHB243MMRAUZ X-Message-ID-Hash: RUJCEEI4GWZCJAJ2H7KFAHB243MMRAUZ X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119262] [Ruby master Feature#20756] Introduce Boolean class List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "kbrock (Keenan Brock) via ruby-core" Cc: "kbrock (Keenan Brock)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20756 has been reported by kbrock (Keenan Brock). ---------------------------------------- Feature #20756: Introduce Boolean class https://bugs.ruby-lang.org/issues/20756 * Author: kbrock (Keenan Brock) * Status: Open ---------------------------------------- Hello All, Is is possible to add a parent class for `TrueClass` and `FalseClass`? I always found it strange that there was not a concept to group `true` and `false` together. e.g.: ```ruby class TrueClass < Boolean ; end class FalseClass < Boolean ; end # replaces the hack: module Boolean ; end TrueClass.include(Boolean); FalseClass.include(Boolean); ``` In our code, we often want to validate that a value is of a certain type. ```ruby case(value) when String ... when Integer ... when true, false ... # Boolean # alt: when TrueClass, FalseClass end # or def valid_args? value.kind_of?(String) end def valid_args? value.kind_of?(Integer) end def valid_args? [true, false].include?(value) [TrueClass, FalseClass].detect { |klass| value.kind_of?(klass) } end ``` Does it make sense to others to have a way to group `true` and `false` together? Thank you for your thoughts, Keenan -- 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/lists/ruby-core.ml.ruby-lang.org/