www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.mmfile: void[] opSlice(), ubyte opIndex() inconsistent type?

reply mw <mingwu gmail.com> writes:
Hi,

I noticed:


https://dlang.org/phobos/std_mmfile.html

```
void[] opSlice();
Returns entire file contents as an array.

void[] opSlice(ulong i1, ulong i2);
Returns slice of file contents as an array.

ubyte opIndex(ulong i);
Returns byte at index i in file.
```

Should the type of opSlice() be ubyte to be consistent as 
opIndex()?
Oct 08 2022
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 10/8/22 4:50 PM, mw wrote:
 Hi,
 
 I noticed:
 
 
 https://dlang.org/phobos/std_mmfile.html
 
 ```
 void[] opSlice();
 Returns entire file contents as an array.
 
 void[] opSlice(ulong i1, ulong i2);
 Returns slice of file contents as an array.
 
 ubyte opIndex(ulong i);
 Returns byte at index i in file.
 ```
 
 Should the type of opSlice() be ubyte to be consistent as opIndex()?
Yes. But I feel like this was brought up before and rejected... -Steve
Oct 08 2022