I have just looked at the final PDF. Looks really nice. (The customer name at 
the bottom of each page -- well if they think that it will help...) I have the 
feeling that the epub version is not really identical with the PDF currently -- 
will there be an update for ebub later? Somewhere I read that final epub would 
be available on 4 of september, so I tried a epub download yesterday, but epub 
seems to be still meap 10?

I still have to decide if I may read some parts again, maybe on some dark 
winter days. So I just looked what errors have been fixed and what new stuff is 
added compared to the firsts meaps. Well, I am still irritated about Dom's 
remark to the ReadUntil() proc:

Page 165 final pdf:
    
    
    domainCode.setLen(0)
    i.inc parseUntil(line, domainCode, {' '}, i)
    
    #The length of the string is reset to
    #0. This is much more efficient
    #than assigning "" because setLen
    #reuses memory instead of
    #allocating new strings.
    

That still looks strange for me, because we have
    
    
    proc parseUntil*(s: string, token: var string, until: set[char],
                     start = 0): int {.inline.} =
      ## parses a token and stores it in ``token``. Returns
      ## the number of the parsed characters or 0 in case of an error. A token
      ## consists of the characters notin `until`.
      var i = start
      while i < s.len and s[i] notin until: inc(i)
      result = i-start
      token = substr(s, start, i-1)
    

So token is the result of substr. For the first meap I had the strong feeling 
that this means that a new string is allocated and I have still no idea how 
that match to Dom's string reuse remarks. (I reported that point long time ago, 
and Dom replied something like "well, maybe".

Well, maybe Manning and Dom are right, maybe the compiler does indeed some 
magic here? But my feeling is still, that token/domainCode are newly allocated 
for each call, so there is no string reuse involved, and domainCode.setLen(0) 
is unnecessary. I was hoping for a more detailed explanation from Manning 
people.

Another less important point: Why use {' '} ? Set for single char? There is a 
proc dedicated for single char, so why not use that?

Well, the PDF looks very nice. And my name is even listed in the reviewer 
section, thanks. 

Reply via email to