On Tue, Oct 24, 2017 at 11:27 AM, Thomas Punt <tp...@hotmail.co.uk> 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 >