www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What does auto std.stdio.File.ByChunkImpl byChunk (ulong chunkSize );

reply kdevel <kdevel vogtner.de> writes:
What does

   auto std.stdio.File.ByChunkImpl byChunk (
      ulong chunkSize
   );

on https://dlang.org/library/std/stdio/file.by_chunk.html mean? 
Is that
a (forward) declaration of a function named byChunk taking a 
single
ulong argument name chunkSize. But what does that function return?
Aug 03 2018
next sibling parent Alex <sascha.orlov gmail.com> writes:
On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote:
 What does

   auto std.stdio.File.ByChunkImpl byChunk (
      ulong chunkSize
   );

 on https://dlang.org/library/std/stdio/file.by_chunk.html mean? 
 Is that
 a (forward) declaration of a function named byChunk taking a 
 single
 ulong argument name chunkSize. But what does that function 
 return?
The help page you cited says: "Returns an input range set up to read from the file handle a chunk at a time."
Aug 03 2018
prev sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote:
 What does

   auto std.stdio.File.ByChunkImpl byChunk (
      ulong chunkSize
   );

 on https://dlang.org/library/std/stdio/file.by_chunk.html mean?
It looks like ddox trying to tell you what the auto actually is. But it returns a ByChunkImpl which is just a range that handles the chunk; you are supposed to think of it as just being something you foreach or pass to other ranges.
Aug 03 2018
parent reply kdevel <kdevel vogtner.de> writes:
On Friday, 3 August 2018 at 17:06:16 UTC, Adam D. Ruppe wrote:
 On Friday, 3 August 2018 at 16:58:26 UTC, kdevel wrote:
 What does

   auto std.stdio.File.ByChunkImpl byChunk (
      ulong chunkSize
   );

 on https://dlang.org/library/std/stdio/file.by_chunk.html mean?
It looks like ddox trying to tell you what the auto actually is.
But that indented "code" is not syntactically valid D. Isn't it?
Aug 03 2018
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 3 August 2018 at 17:16:14 UTC, kdevel wrote:
 But that indented "code" is not syntactically valid D. Isn't it?
Right, it would give an error if actually compiled. But remember, this is documentation that just happens to look like code, so it is intended to be legible by people rather than the compiler. (that said, it isn't how I would have written it.)
Aug 03 2018
parent reply kdevel <kdevel vogtner.de> writes:
On Friday, 3 August 2018 at 17:27:07 UTC, Adam D. Ruppe wrote:
 But remember, this is documentation that just happens to look 
 like code, so it is intended to be legible by people rather 
 than the compiler.
I could not find any elucidation of the meaning of auto <type> when used as a return type of a function.
 (that said, it isn't how I would have written it.)
You would have removed the auto?
Aug 03 2018
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Friday, August 03, 2018 17:47:53 kdevel via Digitalmars-d-learn wrote:
 On Friday, 3 August 2018 at 17:27:07 UTC, Adam D. Ruppe wrote:
 But remember, this is documentation that just happens to look
 like code, so it is intended to be legible by people rather
 than the compiler.
I could not find any elucidation of the meaning of auto <type> when used as a return type of a function.
It's not valid D code. The ddoc version of the documentation shows the actual signature: https://dlang.org/phobos/std_stdio.html#byChunk If the ddox is supposed to match the actual signature, then it's wrong in that it inserts the actual type (resulting in two return types) and in that it replaced size_t with ulong. If ddox is designed with the idea that it's going to muck with the signature in some manner in attempt to clarify what stuff like auto is inferred as, then what it's supposed to show depends on the ddox developers. But regardless, having two return types is incorrect D code, and what the ddox is showing does not match the actual function signature. - Jonathan M Davis
Aug 03 2018