* [ruby-core:91235] [Ruby trunk Feature#15560] Add support for read/write offsets.
[not found] <redmine.issue-15560.20190123213952@ruby-lang.org>
@ 2019-01-23 21:39 ` samuel
2019-01-26 20:52 ` [ruby-core:91290] " Eric Wong
2019-01-24 1:29 ` [ruby-core:91239] " shyouhei
` (2 subsequent siblings)
3 siblings, 1 reply; 5+ messages in thread
From: samuel @ 2019-01-23 21:39 UTC (permalink / raw)
To: ruby-core
Issue #15560 has been reported by ioquatix (Samuel Williams).
----------------------------------------
Feature #15560: Add support for read/write offsets.
https://bugs.ruby-lang.org/issues/15560
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
It would be nice if read/write/send/recv/etc methods could accept an offset argument.
e.g.
```
socket = Socket.new(...)
buffer = String.b
socket.read(1024, buffer)
socket.read(1024, buffer, offset: buffer.bytesize)
```
The same for write, e.g.
```
socket = Socket.new(...)
buffer = String.b
amount = socket.write(buffer)
socket.write(buffer, offset: amount)
```
Could also include "size:" so that we can selectively write parts of the buffer.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:91239] [Ruby trunk Feature#15560] Add support for read/write offsets.
[not found] <redmine.issue-15560.20190123213952@ruby-lang.org>
2019-01-23 21:39 ` [ruby-core:91235] [Ruby trunk Feature#15560] Add support for read/write offsets samuel
@ 2019-01-24 1:29 ` shyouhei
2019-01-26 8:30 ` [ruby-core:91274] " samuel
2019-01-26 11:01 ` [ruby-core:91279] " samuel
3 siblings, 0 replies; 5+ messages in thread
From: shyouhei @ 2019-01-24 1:29 UTC (permalink / raw)
To: ruby-core
Issue #15560 has been updated by shyouhei (Shyouhei Urabe).
I can imagine it is useful for TCPSocket#write to accept only a part of a buffer crafted by somebody else. But I cannot think of any actual use case when #read is useful with that extension. Do you have one?
----------------------------------------
Feature #15560: Add support for read/write offsets.
https://bugs.ruby-lang.org/issues/15560#change-76484
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
It would be nice if read/write/send/recv/etc methods could accept an offset argument.
e.g.
```
socket = Socket.new(...)
buffer = String.b
socket.read(1024, buffer)
socket.read(1024, buffer, offset: buffer.bytesize)
```
The same for write, e.g.
```
socket = Socket.new(...)
buffer = String.b
amount = socket.write(buffer)
socket.write(buffer, offset: amount)
```
Could also include "size:" so that we can selectively write parts of the buffer.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:91274] [Ruby trunk Feature#15560] Add support for read/write offsets.
[not found] <redmine.issue-15560.20190123213952@ruby-lang.org>
2019-01-23 21:39 ` [ruby-core:91235] [Ruby trunk Feature#15560] Add support for read/write offsets samuel
2019-01-24 1:29 ` [ruby-core:91239] " shyouhei
@ 2019-01-26 8:30 ` samuel
2019-01-26 11:01 ` [ruby-core:91279] " samuel
3 siblings, 0 replies; 5+ messages in thread
From: samuel @ 2019-01-26 8:30 UTC (permalink / raw)
To: ruby-core
Issue #15560 has been updated by ioquatix (Samuel Williams).
It is useful for read when user wants to read some data, and it wasn't enough (e.g. implementing `gets`) so you need to read some more at the end of what you already have.
----------------------------------------
Feature #15560: Add support for read/write offsets.
https://bugs.ruby-lang.org/issues/15560#change-76521
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
It would be nice if read/write/send/recv/etc methods could accept an offset argument.
e.g.
```
socket = Socket.new(...)
buffer = String.b
socket.read(1024, buffer)
socket.read(1024, buffer, offset: buffer.bytesize)
```
The same for write, e.g.
```
socket = Socket.new(...)
buffer = String.b
amount = socket.write(buffer)
socket.write(buffer, offset: amount)
```
Could also include "size:" so that we can selectively write parts of the buffer.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:91279] [Ruby trunk Feature#15560] Add support for read/write offsets.
[not found] <redmine.issue-15560.20190123213952@ruby-lang.org>
` (2 preceding siblings ...)
2019-01-26 8:30 ` [ruby-core:91274] " samuel
@ 2019-01-26 11:01 ` samuel
3 siblings, 0 replies; 5+ messages in thread
From: samuel @ 2019-01-26 11:01 UTC (permalink / raw)
To: ruby-core
Issue #15560 has been updated by ioquatix (Samuel Williams).
Also, rather than using a keyword argument, it could be a 3rd argument after buffer, since buffer must be supplied in order for this to work.
----------------------------------------
Feature #15560: Add support for read/write offsets.
https://bugs.ruby-lang.org/issues/15560#change-76525
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
It would be nice if read/write/send/recv/etc methods could accept an offset argument.
e.g.
```
socket = Socket.new(...)
buffer = String.b
socket.read(1024, buffer)
socket.read(1024, buffer, offset: buffer.bytesize)
```
The same for write, e.g.
```
socket = Socket.new(...)
buffer = String.b
amount = socket.write(buffer)
socket.write(buffer, offset: amount)
```
Could also include "size:" so that we can selectively write parts of the buffer.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread