Eve icon indicating copy to clipboard operation
Eve copied to clipboard

Need better error message for bare values missing an attribute

Open yuanmai opened this issue 8 years ago • 3 comments

commit
  [#foo 101]

gets Expecting token of type --> Equality <-- but found --> ']' <--

However, you can do this

search
  i = 101
  
commit
  [#foo i]

yuanmai avatar Nov 22 '16 11:11 yuanmai

The error message could probably be more insightful, but the error is genuine, and this is not a bug.

Your first code block does not define a valid Eve record. Records must consist of attributes, which are assigned one or more values. You cannot put a value like 101 directly into a record.

Why does the second block work then? It's because when you use "i" in the record, you are creating an "i" attribute, which will have the value 101. It's equivalent to writing:

commit
  [#foo i: 101]

nmsmith avatar Nov 22 '16 12:11 nmsmith

Ok, now I understand. Thanks for the clarification!

yuanmai avatar Nov 22 '16 12:11 yuanmai

Even though your issue is solved, I'll leave it open to track the error message fix.

cmontella avatar Nov 22 '16 20:11 cmontella