Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100929 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81347 invoked from network); 24 Oct 2017 09:58:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2017 09:58:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.223.175 mail-io0-f175.google.com Received: from [209.85.223.175] ([209.85.223.175:52638] helo=mail-io0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/80-58908-3DE0FE95 for ; Tue, 24 Oct 2017 05:58:44 -0400 Received: by mail-io0-f175.google.com with SMTP id f20so23208592ioj.9 for ; Tue, 24 Oct 2017 02:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ie6hpm8s8b1+HEam9brHRWIjV+9wz/HEE67j/hWHE6o=; b=lylNKxnu+TBnV+vQRbwkMUwt40i+0u7epDD2HoblOORcyDufXe8xEUHDhf+wRharwV D0kFNFouDHMV7gkq9q8n4w+7ucI/8BinDcZCLLl9+ZuBElgZgy56G98YODqEWmVALn5U 2NSB9F2BPxE8+cKlTwKceFRM8IagSI1nbBFMXOPa9XxYHQ20iRxKP15ffQK9w58nG5i7 9h5NCpWSgcowJLGAhOwKFMruKsuoq5H0nDkobjEusfP7/8NUBfruCYu88Mwcv8beC+FS LxdzTgxafcwWFLBM/1YT/zkteOjKWralomTgRpB21Esxkf75ENwY7onW2TpMrb6u9VoP Jfog== 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; bh=Ie6hpm8s8b1+HEam9brHRWIjV+9wz/HEE67j/hWHE6o=; b=E13prFlCG+uCsFblsLqmnhxzKY8p2z6JlLeRoeYYgERe3tmSE1+u/sv/pafi4SVFXL kIpDQge7DLTdhISyFMlwkpIdgqytM2wqcs68Tb/IHUxHdoIBKes2ExdZbJ2cKwDcs8PY qj5fFnQ/k/8GykPc8VOW3tfboArCF0tdlzfIZ2Otl3BkH4I13/KE/zy3DesqZ1IOmWJy iFw1A6dkA2AZnBNo37dWW6LKW4Dkkgsz2DMS5nen97UlZ0ibn698tBis2G72F20rwCkM AS1GscEzQFhs1/tutjbamohjvUnVOx36dZUgmwOaLhHlPTW96YZ4xni+YFi18nPwl9sz kozQ== X-Gm-Message-State: AMCzsaWckNLuwH8VfY++XlY8zjcRwcDTD7kqbyODnSHSRL+rM2vaKQ1r JOXJ9jkvViTd7eWn7zKT6jl4q/oJpm67pNJziLc= X-Google-Smtp-Source: ABhQp+TyxuanmNKEL0zWw9LaCVVAVHXcVdSFATeBbWEE7Q/Hbwujc5Fk6cIjji3V0gWuJT28t0LpGiPnh0qMpZIgyzE= X-Received: by 10.107.9.210 with SMTP id 79mr19196084ioj.94.1508839121633; Tue, 24 Oct 2017 02:58:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.35.78 with HTTP; Tue, 24 Oct 2017 02:58:41 -0700 (PDT) In-Reply-To: References: <0ac37ce7-62f4-7b1c-5b3d-2d2f45190f07@oracle.com> Date: Tue, 24 Oct 2017 11:58:41 +0200 Message-ID: To: Thomas Punt Cc: Christopher Jones , PHP Internals Content-Type: multipart/alternative; boundary="001a113ec2cade4509055c47fb0e" Subject: Re: [PHP-DEV] [RFC] Flexible Heredoc and Nowdoc Syntaxes From: nikita.ppv@gmail.com (Nikita Popov) --001a113ec2cade4509055c47fb0e Content-Type: text/plain; charset="UTF-8" On Tue, Oct 24, 2017 at 11:27 AM, Thomas Punt wrote: > Hi Christopher, > > > > I like the added flexibility in placement of the end token, but I think > requiring only tabs or spaces, and stripping whitespace from all > {here|now}doc > > lines is error prone and adds unnecessary complexity. > > I agree that the requirement for using either tabs or spaces is not > necessary, but > I included it because it does help with readability when looking at the > indentation > level of the heredoc and nowdoc (and subsequently how much whitespace will > be stripped from each line). It's not just a question of readability. You just can't strip a mixed space/tab indentation unless you specify a tab width. If one line is indented with two tabs and the other with 16 spaces, what do you strip? All 16 spaces (ts=8)? Only 8 (ts=4)? Only 4 (ts=2)? Unless we want to specify the One True Tab Width or introduce an ini setting for this, it's not really possible to handle this in a reasonable way. With respect to the stripping of whitespace, however, > I feel that this is definitely necessary. If it was not stripped, then > indenting the > closing token and body will cause a lot of whitespace to prepend every > line in > the body of text. This is definitely not desirable, and may cause > programmers to > continue to not indent the body of the heredoc/nowdoc, which leads us back > to > where we currently are of having indentation of code ruined with such > syntaxes. > > > Other languages follow these semantics of stripping whitespace from new > lines > > according to the indentation of the closing marker, such as Elixir (normal > """ syntax) > > and Ruby (special <<~ syntax). > > > Thanks, > > Tom > --001a113ec2cade4509055c47fb0e--