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=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no 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)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2E4F21F4B8 for ; Thu, 10 Oct 2024 10:48:51 +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=xXSZ80oW; 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=JtmRgy4I; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1728557328; bh=iVpZYJjuQWTTAerAnXimDdqbEUt2aul1QMyEX55CXvk=; 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=xXSZ80oWSbSKtqGq+cOZ3HPctenJZGyLsRI5L36jVqw0mtc9ij2ysyzax/6bwMUt5 qQAoPVRNjG51mjf+d78L/IdB/dYikRmDZwTkc8BTRgmqLMrWhwN1hTQugn8rUAMJqn SJJ39JItTP6nhcGrcXI1NoNAghcE+hsQO8THAtlw= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id B6B8744001 for ; Thu, 10 Oct 2024 10:48:48 +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=JtmRgy4I; dkim-atps=neutral Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by nue.mailmanlists.eu (Postfix) with ESMTPS id D269243FC3 for ; Thu, 10 Oct 2024 10:48:35 +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=A+3BX+88PGYw/Znw9rHS8w7hoExHM62af9wVuooXcdk=; b=JtmRgy4IqIdAs/WTzR751m2oByqNTo2nA7ONTjdjpwR6ANoCsDHvit5fzGmJNhGw5HsJ 77JTvcv1gl/mFwG9LXC5ZETuhVsD29tJJAiRmQi4f+AZXXEUUGzkY5ZkGa9UMpBs1gcUm3 11mnXdo2zIc5LSDQAJec3C5he80bBfdTNtyufcfU67zVyR2efiBiGMHwE+6ZXaw2t48vEQ ERjdxBUyQbfK04Uxae3Z8Nam+cPd5jHX/fXgdwCHH+LPZ0o6LibihJ2vv4f4Vne811nm/+ x0uQixjby6cUFNTWTk9ZgiERrxnSaBs1Y8bXxcQvCGUbgiPVXHcwpTDdOa1tkfJQ== Received: by recvd-5577bcb48c-tmc27 with SMTP id recvd-5577bcb48c-tmc27-1-6707B102-18 2024-10-10 10:48:34.813631056 +0000 UTC m=+2393441.949819232 Received: from herokuapp.com (unknown) by geopod-ismtpd-0 (SG) with ESMTP id iPBK8BqTS7Kqyq0zEVh5rQ for ; Thu, 10 Oct 2024 10:48:34.675 +0000 (UTC) Date: Thu, 10 Oct 2024 10:48:34 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20793 X-Redmine-Issue-Author: artemb X-Redmine-Issue-Priority: Normal X-Redmine-Sender: Eregon 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: 96139 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax2Z59RTTIiybBij5cZEQSsjEthjFWp?= =?us-ascii?Q?dKOJO4WPANNx7T+kQPL93XX29ejI5XhoQzhKMC7?= =?us-ascii?Q?A0D4Z2GhG9vUpSuWWaQHyq6=2FQEKWC4uLh1qRcwH?= =?us-ascii?Q?iwSKyayMkd=2FDqH5p29275RxmwPcqqnfhKHX3r2O?= =?us-ascii?Q?v05PvGUz0VbDxuTTX3iAfAu9Iw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: 7J3CXPND2O67MYRYEFD4NOHWKBPLRF2Q X-Message-ID-Hash: 7J3CXPND2O67MYRYEFD4NOHWKBPLRF2Q 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:119504] [Ruby master Feature#20793] Allow Multiple Arguments for the .is_a? Method List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20793 has been updated by Eregon (Benoit Daloze). I think pattern matching can/should be used here instead of making `is_a?` more complicated: ``` irb(main):001:0> name = :abc => :abc irb(main):002:0> name in String | Symbol => true irb(main):003:0> name = 42 => 42 irb(main):004:0> name in String | Symbol => false ``` `is_a?` is deeply optimized so accepting multiple arguments would likely make it slower or complicate things significantly. ---------------------------------------- Feature #20793: Allow Multiple Arguments for the .is_a? Method https://bugs.ruby-lang.org/issues/20793#change-110119 * Author: artemb (Artem Borodkin) * Status: Open ---------------------------------------- I propose allowing multiple arguments to be passed to the .is_a? Method imply "OR" semantics: ``` ruby name.is_a? String, Symbol ``` Currently, we need to write the following to achieve the same functionality: ``` ruby [String, Symbol].include?(name.class) ``` -- 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/