Subject: bug#26055: 25.1; Eshell dollar expansion $var[i] not working

From: Chunyang Xu <[email-masked]>
Date: Sat, 11 Mar 2017 17:35:05 +0800

I execute the following commands in Eshell

~ $ setq l (quote (a b c))
(a b c)
~ $ echo $l[1]
~ $ nth 1 $l
b
~ $

I expect 'echo $l[1]' should print 'b'

~ $ setq s 'foo bar baz'
foo bar baz
~ $ echo $s[1]
~ $ nth 1 (split-string s)
bar
~ $ 

and 'echo $s[1]' should print 'bar' because in
(info "(eshell) Dollars Expansion") it says

‘$var[i]’
     Expands to the ‘i’th element of the value bound to ‘var’.  If the
     value is a string, it will be split at whitespace to make it a
     list.  Again, raises an error if the value is not a sequence.

Do I misunderstand this? Besides, the manual also says

‘$var[hello]’
     Calls ‘assoc’ on ‘var’ with ‘"hello"’, expecting it to be an alist
     (*note Association Lists: (elisp)Association List Type.).

it looks like to me they are using the same syntax, if so, how can
Eshell know which is which?

~ $ setq al (quote (("1" . one) ("2" . two)))
(("1" . one)
 ("2" . two))
~ $ echo $al[1]
one
~ $