StefanSalewski / NimProgrammingBook

Computer Programming with the Nim Programming Language -- A gentle Introduction
262 stars 19 forks source link

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

Open hasanyasin opened 5 months ago

hasanyasin commented 5 months ago

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.

StefanSalewski commented 5 months ago

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 commented 4 months ago

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 commented 4 months ago

Fixed.