mastering_nim icon indicating copy to clipboard operation
mastering_nim copied to clipboard

numeric literals

Open random-bites opened this issue 2 years ago • 1 comments

On page 51, chapter 12, the book has a numeric expression that looks something like -128i8 (with a narrow vertical rectangle) instead of the intended expression -128'i8.

The affected sentence (from the online documentation):

The rationale is that an expression -128'i8 should be valid and without this special case, this would be impossible -- 128 is not a valid int8 value, only -128 is.

Parenthetically, this sentence is a little bit puzzling when first read, because the reader has not yet been introduced to type suffixes (except in the syntax on p. 50) and so has to surmise that the suffix i8 makes the literal an int8 value.

random-bites avatar Jul 28 '22 13:07 random-bites

numeric expression that looks something like -128▯i8 (with a narrow vertical rectangle)

Thanks for the report, this will be fixed in the next version of the book.

narimiran avatar May 08 '23 12:05 narimiran