REBOL3 tracker
  0.9.12 beta
Ticket #0002027 User: anonymous

Project:



rss
TypeBug Statuscomplete Date12-May-2013 01:34
Versionr3 master CategoryPorts Submitted byabolka
PlatformAll Severityminor Prioritynormal

Summary READing from http:// without /string should not try to convert to string!
Description In the comments to #1234, BrianH writes:

"READ/string is a shortcut for TO-STRING READ, but when /string is not specified that means that the developer doesn't want it converted to a string. If they did, they would have called READ/string instead. So that means that the HTTP conversion code needs to happen a little less automatically before this ticket can be considered fixed."

#1234 is concerned with READ/string _not_ converting to string!, even though that conversion is explicitly requested. This ticket is for discussing (and tracking an eventual fix) whether the default behaviour of READ without /string should change (for HTTP).
Example code

			

Assigned ton/a Fixed inr3 master Last Update19-Aug-2013 01:00


Comments
(0003858)
abolka
12-May-2013 02:02

Let's present what appears to me to be the main counter-argument as well:

HTTP allows for transmission of encoding meta-data. (READ/string obviously should make use of this, making it more than just strictly a shortcut for `to-string read`.) Now it could be argued, that READ ought the be the main "user friendly" function, and make use of whatever information it has available, to present more "user friendly" results. This would certainly entail automatic decoding, whenever possible.

My first counter to this counter would be, that LOAD is the main "user friendly" wrapper, doing magic, and READ be something more predictable and always return a binary! (unless told otherwise).
(0003859)
BrianH
12-May-2013 19:31

Well, if you want the binary data, then READ without /string would be definitely unfriendly if it did the conversion, regardless of whether it has the metadata it would need to do so. READ returning a string means that LOAD would have to do a TO-BINARY on that string before it could parse it, which adds a lot of unnecessary overhead.

Don't get me wrong, READ/string should definitely use any metadata, HTTP headers, whatever that it needs to do a better job of converting its results to string. For people who need a string I wouldn't hesitate to recommend that they use READ/string instead of TO-STRING READ. Properly implemented it should be a lot more efficient to use.
(0003936)
abolka
19-Aug-2013 01:00

Pull request submitted: https://github.com/rebol/rebol/pull/129

Date User Field Action Change
19-Aug-2013 01:00 abolka Status Modified submitted => complete
19-Aug-2013 01:00 abolka Comment : 0003936 Added -
19-Aug-2013 00:45 abolka Description Modified -
19-Aug-2013 00:45 abolka Fixedin Modified => r3 master
12-May-2013 19:31 BrianH Comment : 0003859 Added -
12-May-2013 02:02 abolka Comment : 0003858 Added -
12-May-2013 01:34 abolka Ticket Added -