Re: Problems with GET.E

new topic     » goto parent     » topic index » view thread      » older message » newer message

Robert Craig wrote:
>> Correct me if I'm wrong, but aren't several get() calls
>> in a row supposed to return all of the objects that were
>> printed to the file? ...
>
>get() requires that there be at least one character of
>whitespace (blank, tab or new-line) separating the
>top-level objects in the file.
>
>You can easily observe that this will likely be
>necessary between two atoms,
>e.g.
>        111 222
>
>but it shouldn't be necessary between
>two sequences, or an atom and a sequence e.g.:
>
>        145.999{1,2,3}
>or
>        {1,2,3}{4,5,6}
>
>because the braces should be enough.
>So why does get() require whitespace in *all* cases?
>
>It was much easier to implement that way (it's a long story),
>and I didn't think anyone would really mind.
>
>> From what I can see, one way to do it
>> would be to have print() put a space after every object
>> it outputs.
>
>What about the users of print() who don't want the
>extra space? Is it that hard to add:
>      puts(fn, ' ')
>to your code?

No... if you really *meant* it the way it is, I'm not
asking for a change; I can see some difficulty with
affixing a space or newline to the end of everything
print()ed. I just thought that your original intent
was to have people be able to use:

   print (fn, obj1)
   print (fn, obj2)
   ...
   ext_obj1 = get (fn)
   ext_obj2 = get (fn)

as naturally as they would puts() and getc(). As things
currently stand, it means I may have to leave out parallel
functions for print() and get() from my next project--
you'll see why soon. But, if that's the way they were
meant to operate anyway, ah well...


... meanwhile, Gabriel Boehme wrote:
>In any event, for the immediate future, this is probably the best solution
>for the problem in question:
>
>global procedure put(integer fn, object data)
>   print(fn, data)
>   puts(fn, ' ')   -- or '\n', either one will work
>end procedure

I'll be certain to do something like this whenever I start
working with large datafiles. For now though, the situation
isn't causing any real problems--I just thought I'd clear it
up before it did.

(Side note: I know I'm going to be called on this, but
having get() and print() operate the way they currently do
DOES seem... ill-paired. There's really no need to change
get()--when writing two integers to a file, you're going
to HAVE to put something between them anyway. So maybe we
could try to find out how many folks use print() in a
manner that would cause problems if print() were changed
to attatch a newline? I suspect it's not that many,
if any at all...)


Rod Jackson

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu