Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.

Ideas for Future Deprecations

These are some ideas, extracted from Shell Language Deprecations.

These breakages may never happen, as they require a significant new lexer mode. If they do, you will want to avoid the following syntax:

I expect that those sequences are rare, so this change would break few programs.

Table of Contents
Raw and C String Literals in Word Mode
Multiline Strings and Redirects
First Class File Descriptors (parse_amp)
Inline Eggex
Bare Function Call

Raw and C String Literals in Word Mode

We might want to make string literals in the command/word context match Oil's expressions. This means we have to disallow implicit concatenation, or certain instances of it.


var x = foo'bar'   # Not a valid Oil expression
echo foo'bar'      # Valid in shell, but discouraged


var x = 'foobar'
echo 'foobar'

We don't want to break these, so = could be special

ls --foo='with spaces'
ls --foo="with $var"

New raw and C strings (which technically conflict with shell):

echo r'\'   # equivalent to '\'
echo c'\n'  # equivalent to $'\t'

Multiline Strings and Redirects

Instead of here docs:

cat <<EOF
there, $name

cat <<'EOF'
$5.99  # no interpolation

We could have multiline strings:

cat << """
there, $name

cat << '''
$5.99  # no interpolation

Minor breakage: the ''' and """ tokens become significant. It may also be nice to change the meaning of << slightly.

First Class File Descriptors (parse_amp)

We want to make redirection simpler and more consistent. We can remove the confusing <& and >& operators, and instead use > and < with descriptors.

Remains the same:

echo foo >file
read :var <file


echo foo >& 2
read var <& 0


echo foo > &2         # descriptor with &
read :var < &0

echo foo > &stderr    # named descriptor
read :var < &stdin


echo foo 1>& 2


echo foo &1 > &2

(Note: the syntax {fd}> file.txt will be replaced by the open builtin.)


Inline Eggex

Instead of:

var pat = / digit+ /
egrep $pat *.txt

You can imagine:

egrep $/ digit+ / *.txt

Minor breakage: making $/ significant.

Bare Function Call

Instead of

call f()
call g(x, y)

You could do:

f()   # calls a func, doesn't begin a shell function declaration
g(x, y)

Generated on Fri Oct 23 00:21:10 PDT 2020