logoalt Hacker News

nemetroidyesterday at 9:51 PM0 repliesview on HN

Using '=' for both assignment and comparison is awkward when parsing incomplete code. Consider e.g.:

  j = 5;
The user starts writing (<|> is the cursor position):

  i = <|>
  j = 5;
This is a valid expression (i is a boolean). But the user probably intends to finish writing something like:

  i = 0;
  j = 5;
So in the intermediate state we would like to emit a single warning about an incomplete statement. But since it is valid as written, we instead end up warning about e.g. j being unbound.