Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [Feature Request] Adding option to support triple quotes

The tripe single quotes can have single quotes in them, and the triple double quotes can have double quotes.
It’s useful for normal English interpolation:
“””I’m going to kill process “${some_process}.”
     Proceed? (Y/n)”””
It’s useful for regexes:
[[ “$sth” =~ ‘’’ “\w+”=‘?(\d+)’? ‘’’ ]]
It’s useful for putting code in strings, which is extremely useful for macros, code generators, evaling code of other languages (node -e, python -c, etc):
“”” $var_name=“\$$var_value”

There are quite a few “...”’”’”...” and the like already in my code, and they are make the code unreadable and ugly. 

> On Aug 13, 2019, at 8:58 PM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Aryn Starr wrote on Tue, 13 Aug 2019 06:08 +00:00:
>> Adding an option to zsh to support triple quotes (TRIPLE_QUOTES) would 
>> make possible much more readable code.
>> We can have double triple quotes that support `$` interpolation, and 
>> triple single quotes that just take raw strings.
> What would be the difference to ordinary «'…'» and «"…"» string
> literals?  They can already be multiline.

Messages sorted by: Reverse Date, Date, Thread, Author