just for fun: pop quiz

Robert Sneidar slylabs13 at me.com
Sun Feb 3 14:59:12 EST 2013


I think one of my guesses would have actually made more sense. Have the result return the number of characters read. That way you could check for zero in the result, and if not, you have the size of your chunk ready to go. But EOF in the result is surprising. It's hard to imagine the developer logic that drove them to this conclusion.

Bob


On Feb 3, 2013, at 11:08 AM, Richard Gaskin wrote:

> Jerry Jensen wrote:
> 
> >>> On 03/02/2013, at 11:36 AM, Richard Gaskin wrote:
> >>>
> >>>> Without looking in the Dictionary, what would you expect the value
> >>>> of tResult to be after successful execution of:
> >>>>
> >>>> open file tValidFilePath for read
> >>>> read from file tValidFilePath until EOF
> >>>> put the result into tResult
> >>>> close file tValidFilePath
> >>>>
> >>>>
> >> On 03/02/2013, at 11:38 AM, Monte Goulding wrote:
> >>
> >>> empty?
> >>>
> > On Feb 2, 2013, at 4:39 PM, Monte Goulding wrote:
> >
> >> :-(
> >>
> > Me too. ;-(
> >
> 
> Curious, isn't it?
> 
> In my informal survey among people I've talked with the results were the same as here, with nearly everyone guessing that a read command which executes without error would have empty in "the result".
> 
> Instead, in the case of using specifically "...until EOF" or "...until end", the result contains "eof".
> 
> This turns out to be documented (down in the fine print toward the bottom of the Dictionary entry for "read from file", but not above in the section that describes what "EOF" does), yet it's such a departure from the rest of the language that I was tempted to flag it as a bug.
> 
> It's been around so long that they're not likely to change it, so I won't be littering the RQCC with yet another unactionable request.
> 
> Still, does seem odd.
> 
> Can you think of a circumstance in which you've already specified to read until EOF, and the command executes flawlessly just as you've asked it to, yet you still need to be notified that it reached EOF?
> 
> --
> Richard Gaskin
> Fourth World
> LiveCode training and consulting: http://www.fourthworld.com
> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
> Follow me on Twitter:  http://twitter.com/FourthWorldSys
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list