220 33712 <CAFk2RUYqZVo775jwQP+AGiqf3JRq8yNxB1Ru_b74YPa-qJfooA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: A more advanced switch
Date: Wed, 9 Aug 2017 15:09:35 +0300
Lines: 30
Approved: news@gmane.org
Message-ID: <CAFk2RUYqZVo775jwQP+AGiqf3JRq8yNxB1Ru_b74YPa-qJfooA@mail.gmail.com>
References: <f8c908e2-d06f-4cd1-bda0-fe2b97fd21f1@isocpp.org> <5a36b655-b2a9-4be2-8599-465810cfd1b3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1502280578 26165 195.159.176.226 (9 Aug 2017 12:09:38 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 9 Aug 2017 12:09:38 +0000 (UTC)
Cc: costelnistor12@gmail.com
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBAHXVPGAKGQE4Y3Y4BQ@isocpp.org Wed Aug 09 14:09:32 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRBAHXVPGAKGQE4Y3Y4BQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBAHXVPGAKGQE4Y3Y4BQ@isocpp.org>)
	id 1dfPnn-0006UF-JZ
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Aug 2017 14:09:31 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id 12sf22137279uaq.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Aug 2017 05:09:38 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1502280577; cv=pass;
        d=google.com; s=arc-20160816;
        b=hKYgzdsrTbJf1YB2GNy7QIhQS+kBeHG/FWJBhERj6zw/kYAPflc6ix0IHOcySpIrNV
         dqVLBSJsZv8DvdlxzK21pSoywlvOz70i1rHze9D2U29OtgHSAOfLsArAN3AjgvstHp3r
         fcRvzyuc4Atuq0h+03tLBBfY6DZnJx6ort9Ku9UkgDOQYbgtn8QVBnbyNt8MbXsldLDd
         GQHK4KVi85D2h/uvF4Jy4sxFJN57eP2f+OBw1r2YOQ2LQ1a6CxCrBXdvPZCDT1sZgXze
         nAdWD8O+yV63f5tuXw5MkXjcyZVsHZKKXKuEVwp8B6dpZBhGuwxPdX3mAjSv5rKkkg4V
         Rryw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:cc:to:subject:message-id
         :date:from:references:in-reply-to:mime-version
         :arc-authentication-results:arc-message-signature:dkim-signature
         :arc-authentication-results;
        bh=kNdAFWRyevmf6oGS0S9fQbDhFb7qobazJP+1dWSJGZY=;
        b=OE1hl7Djr52RRBsIDqQsFM1HvNpncIkZZipi6Zl1jOKIXRbazm8m5dfqlqGtVZ09rT
         frQP87RDVKWLwM+jfKrUjxwxDIzk9rJ1WcwlxhcfEL/e+A9UDIkN913oY5cFAZKH2e6q
         nmYm5pw+OdS5En0HudaxAbvGkInjzxrjdi6lXdZHo/lqcATtJB/2CXGZPfVSTRkWHRRz
         iz9B/sJi3XgUojfmjCMYn4lC8q8RGbSjuh1Q1TbmdJNk0Efmxvan9X28Nrl9lRW09J0P
         OoQPRGJFZyYPidfIc5TO246+IiYbNCPiAOOx58DqwL8MAA/datH/x8YqpJKQUOPYtXDU
         HORw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=J64xEjry;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::243 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=kNdAFWRyevmf6oGS0S9fQbDhFb7qobazJP+1dWSJGZY=;
        b=dm93rJ7e+qvK2x+Ljbh0DO0LwB+V9J+r7C4QHSEUUo0wS3U2QPgYEnoNoCMvnK/V+h
         1fp4AKrlBTatxsXfVMWtiE7O+WF+8Y7Gz2pK64Z0TFkRHV5zMU6DWHXKsjqnhMXCrrdG
         aqZLjzht8mU9+3dQzWLLKQSQpd4zGLPG7WUAAV69b1L7c1v23NeY7IBOMPDc0+HfouDk
         VSSuRerE4tbr9x93cFl+OC0cWGiaxkS10KinxlPfgpYEnQ3JYX7gnCS3PMA/53C04Ws4
         sgzFXthAVJWtftsEpxxZQtGJDpR+UpHzwshzUME9Qz8DEPkqBlmGUWpw8APjIQ4tGYHT
         MI/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=kNdAFWRyevmf6oGS0S9fQbDhFb7qobazJP+1dWSJGZY=;
        b=nO3VD+wkEY7kJjU8FXDOLjwwcjE3sP1VkgHZyl3aydEd3F/cjShpj3MU12zOp7dnPB
         QJpMyAGIFPQBOynThDAuGZWkillg1yDFx4gLuLBPEq/85HllCHSn8s87oeRC+oR7N57t
         whwbGwVIVPZ9VUYD4ZM2cRJRP/aYrhYKmlgITx69/CzF2do1ei6dajADq0hzCfwicrhR
         5/LsIadVNiBLCSCRz2g349YUEtpoKP8fYJST7jGwlKWzYSp2jy4Gy/g4v1V4rCuS9p/r
         y5B0ifo+79/PjliRWKL2tZcYgvYn4JVwdFRKdLzIhiDp/jK93VM0PAKqwhE+9lebBG0O
         7Tiw==
X-Gm-Message-State: AHYfb5jjb7ebl2XS/fDEA8+bq14/RqGllpFiVErK8uoWF4MD+IlRLEZG
	2Eche5Ls/gMgl+mn
X-Received: by 10.176.19.111 with SMTP id h44mr4581294uae.5.1502280577793;
        Wed, 09 Aug 2017 05:09:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.46.90 with SMTP id i87ls201391ioo.13.gmail; Wed, 09 Aug
 2017 05:09:36 -0700 (PDT)
X-Received: by 10.159.33.143 with SMTP id 15mr4676781uac.217.1502280576597;
        Wed, 09 Aug 2017 05:09:36 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1502280576; cv=none;
        d=google.com; s=arc-20160816;
        b=Ftgxscbx/GKTplozLAQvvNXEdbMOH6ZxLzYfHULEXWHzNHX+w4kK3fVxpl+bMkIqv9
         SBEVyhZOGSSVtD/jQ/BBJNJfRzSammNrNNP2hFnFuhgHNEjVngTqe5eFQojyRQ41Efe6
         tW70aqyoLTxcRUyINN97oW+HA/UBftO7uQ5WDJSWzOVpwdBie1HGyePrcEx5dXWTN8nL
         sZURMXkIsl7ZiolvG/mRYAV17ysMFaxVOC/U4ckA68tT8QHzRUYD23jTnJ/pvzGapbVM
         Ucm399KetfsRUerkKYyfQEoQQYYH8vvvS+b3XjRaM7NtIOPkt7eU2ZdnVpxeOO72+BSe
         xKsA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=cc:to:subject:message-id:date:from:references:in-reply-to
         :mime-version:dkim-signature:arc-authentication-results;
        bh=vqZxpelaexavOtDcJjorcwb2opBBPX0gwGnKho60F+k=;
        b=cFF1H40sUaUl38bj3AtVX6Mc0o9LTQPTjpUvkLOyKa0ElwR3GeWAeLhFkkOJD9LJ/L
         lXCTK/a+DA3FXVASKFsk0/3cGN/E8n/b71CBgQ3U829PiQFg7rTNZUW5XwdRq7JQ9rTe
         naSnqyfVm2iJXp+3Y7P0DF2T5YO5xnriivhjbhTTA64eJ43bMXO8o2vJPyk9KaDcmtDB
         /JgxZDSCtUXsXwnBFzXYQzOyJj8uGUsfRyUJ8EHWVLz/9kwYxEJHktQlVb8ykiA4dTkB
         si+hnjDwtMOXwDZQdmF5pD0GxXiAsA/FtOsroPKFxAEImqSLpdcuKio7D4cV9IRGEZfh
         KoWQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=J64xEjry;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::243 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-ua0-x243.google.com (mail-ua0-x243.google.com. [2607:f8b0:400c:c08::243])
        by mx.google.com with ESMTPS id k11si2362535uai.401.2017.08.09.05.09.36
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 09 Aug 2017 05:09:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::243 as permitted sender) client-ip=2607:f8b0:400c:c08::243;
Original-Received: by mail-ua0-x243.google.com with SMTP id k43so3761342uaf.1
        for <std-proposals@isocpp.org>; Wed, 09 Aug 2017 05:09:36 -0700 (PDT)
X-Received: by 10.159.37.70 with SMTP id 64mr4872848uaz.195.1502280576212;
 Wed, 09 Aug 2017 05:09:36 -0700 (PDT)
Original-Received: by 10.103.103.65 with HTTP; Wed, 9 Aug 2017 05:09:35 -0700 (PDT)
In-Reply-To: <5a36b655-b2a9-4be2-8599-465810cfd1b3@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=J64xEjry;       spf=pass
 (google.com: domain of ville.voutilainen@gmail.com designates
 2607:f8b0:400c:c08::243 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:33712
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33712>

On 9 August 2017 at 14:55,  <olafvdspek@gmail.com> wrote:
> I'd like to see a generalization of switch, allowing it to be used with for
> example std::string (view).
>
> std::string s;
>
> switch (s)
> {
> case "A":
> case "B":
> default:
> }
>
> No syntax updates necessary.

That's not a switch, that's an if-else chain masquerading as a switch.
I would strongly
suggest adding a pattern-matching mechanism and leaving switch alone; switch has
semantics that don't fit into general matching, and other expectations
that a general
matching mechanism doesn't have, including recommendations against using switch
because switch does fall-through and a general matching mechanism
probably shouldn't.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUYqZVo775jwQP%2BAGiqf3JRq8yNxB1Ru_b74YPa-qJfooA%40mail.gmail.com.

.
