Removing the quote distinction?
Removing the quote distinction?
Posted May 19, 2005 16:07 UTC (Thu) by liljencrantz (guest, #28458)In reply to: Removing the quote distinction? by kleptog
Parent article: Fish - The friendly interactive shell
Actually I mostly got the idea from another language I occasionally misuse: English. It is common in written English to nest quotations within quotations by alternating between single and double quotes. It seems intuitive and useful to me, as I often end up writing strings that will be parsed at a later time. I thought that this would be unsurprising for other people as well, but it seems I might have been wrong on that one. So I may have the law of least surprise against me on this one.
On the other hand, one reason for not wanting two kinds of quotes is that I feel the constructs of computer languages should be as orthogonal as possible. This way you maximize the number of ideas that can be concicely expressed with a syntax of a given size. Two different types of quotes that do nearly the same thing does not strike me as an elegant solution.
Posted May 19, 2005 17:44 UTC (Thu)
by smeg4brains (guest, #207)
[Link] (2 responses)
Maybe keep the difference in the quotes as usual, but steal python's
All of the single quote variations could skip the variable expansion, but all of the double quote versions could expand variables..
This way you can keep some of the backward compatibility with bash/sh, but you also have cleaner/better quote mechanisms as well..
Example:
echo """Hello $USER
Welcome to "Ackerman.umci.com".
echo '''To add to your $PATH variable, use something like:
Posted May 19, 2005 23:20 UTC (Thu)
by liljencrantz (guest, #28458)
[Link]
I think I'll wait for a while and see if the screams for more quoting options die out. I'd rater keep the language small. Also, I'm kind of lazy.
Posted Mar 9, 2008 20:30 UTC (Sun)
by Mysingen (guest, #50982)
[Link]
Yeah.. the language seems pretty nice, but I do have to agree with people that the quotes should be handled differently.. Removing the quote distinction?
''' , '' , '
and
""" , "" , "
ideas.
All connections logged."""
export PATH="$PATH:/home/jeffb/.bin/" '''
Yes, using something like Pythons one, two or three quotes is an option. It means that quotes can be nested, while also allowing different kinds of quotes. Removing the quote distinction?
Removing the quote distinction?
Why not just escape the variables instead?
set a Hello
set b '\$a is $a'
set a Goodbye
echo $b
should print "$a is Hello"
It is just a hassle to keep track of what will be expanded in bash scripts and I would really
like the distinction between ' and " to go away.