M2 icon indicating copy to clipboard operation
M2 copied to clipboard

value of string terminating in semicolon

Open mahrud opened this issue 1 year ago • 2 comments

This somewhat surprised me. Shouldn't the value of a string terminating in ";" be null?

i1 : value "new HashTable from {}"

o1 = HashTable{}

o1 : HashTable

i2 : value "new HashTable from {};" -- I expected null, got hash table!

o2 = HashTable{}

o2 : HashTable

i3 : value "(new HashTable from {})"

o3 = HashTable{}

o3 : HashTable

i4 : value "(new HashTable from {};)" -- I expected null, got null

i5 : 

Edit: here is a specific problem that this causes:

i5 : << last capture generateAssertions "12;"

i1 : assert( (12;) === 12 );
currentString:1:1:(3):[7]: error: assertion failed

mahrud avatar Aug 18 '24 04:08 mahrud

it looks like it's intentional (cf the argument returnLastvalue of readeval). but I don't understand why, superficially it seems like a bug.

pzinn avatar Aug 28 '24 10:08 pzinn

Could you point to a line? I'm not sure where in readeval you're referring to.

mahrud avatar Aug 28 '24 11:08 mahrud