kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

Display result of additional assignment (if no terminating semicolon) #525

Closed tavmem closed 4 years ago

tavmem commented 6 years ago

This is a minor difference between kona and k2.8. I'm adding it as an issue simply to document it. (Further compatibility is an enhancement.)

$ cat tst1.k
a:1

Loading this script works ljust ike k2.8

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  \l tst1
  a
1

Add a second assignment to any line without a terminating semicolon in that line, and the the second assignment is displayed (unlike k2.8).

$ cat tst2.k
a:1; b:2
c:3

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  \l tst2
2

Add a terminating semicolon to the line with the additional assignment, and there is no display (just like k2.8).

$ cat tst3.k
a:1; b:2;
c:3 

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  \l tst3
  a
1
  b
2
  c
3