NimProgrammingBook icon indicating copy to clipboard operation
NimProgrammingBook copied to clipboard

Use of word "concept" in place of "defer"

Open hasanyasin opened this issue 1 year ago • 3 comments

Under the section titled "Defer statement", the term "concepts" is mistakenly used in place of "defer".

The concepts statement can be used to ensure that special actions like closing a file or freeing resources are always executed.

where it should have been:

The defer statement can be used to ensure that special actions like closing a file or freeing resources are always executed.

The same mistake continues throughout the mentioned section.

hasanyasin avatar Apr 29 '24 18:04 hasanyasin

Thank you very much for reporting. I really wonder how this mistake has happened -- unfortunately now other reader has seen that before. In case I should ever touch the book content again, I will surely fix that.

StefanSalewski avatar Apr 30 '24 07:04 StefanSalewski

Well, we used a list of Nim keywords to make it easier to highlight them in the asciidoc source text:

// we can use all of Nim's keywords just as {while} instead of [.key]#while# now!
:addr: pass:q[[.key]#addr#]
:and: pass:q[[.key]#and#]
:as: pass:q[[.key]#as#]
:asm: pass:q[[.key]#asm#]
:bind: pass:q[[.key]#bind#]
:block: pass:q[[.key]#block#]
:blocks: pass:q[[.key]#blocks#]
:break: pass:q[[.key]#break#]
:case: pass:q[[.key]#case#]
:cast: pass:q[[.key]#cast#]
:concept: pass:q[[.key]#concept#]
:concepts: pass:q[[.key]#concepts#]
:const: pass:q[[.key]#const#]
:continue: pass:q[[.key]#continue#]
:converter: pass:q[[.key]#converter#]
:converters: pass:q[[.key]#converters#]
:defer: pass:q[[.defer]#concepts#]
:discard: pass:q[[.key]#discard#]
:distinct: pass:q[[.key]#distinct#]
:div: pass:q[[.key]#div#]

That list format is not too nice, as the keyword repetition can easily introduce errors. Luckily, we now have AI tools like GPT-4, which can help us without detailed instructions:

Please check the following list for errors:

The list looks mostly correct, but there is a minor error. The entry for :defer: is different from the others and appears to have a typo. It is listed as :defer: pass:q[[.defer]#concepts#] instead of the expected format pass:q[[.key]#defer#].

StefanSalewski avatar May 15 '24 10:05 StefanSalewski

Fixed.

StefanSalewski avatar May 15 '24 11:05 StefanSalewski