Re: Problems with GET.E

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

Thanks Jiri for attempting to improve get().
Your earlier efforts made the current
released get() much faster.

I haven't looked at your code yet, because
I suspect that you haven't taken into account
the thing that really made me require whitespace
between top-level objects. It's not just a problem
of correctly parsing an input stream from a file.
That can be done, and maybe you've achieved it.
I think it was even done correctly in a much earlier release of
Euphoria.

Consider the problem of parsing:

                123{99, 88, 77}

It will be necessary to read '1', '2' and '3' from the input file,
and then read '{' to know that you've reached the end of the
123 atom. get() must then return the atom's value.
The next call to get() must somehow see '{' again. That can
be achieved by retaining an "ungotten" character or in
some other way that requires get.e to retain some information
between calls in some variable. This can work when
you make consecutive calls to get() on the same input file.
But what are you going to do if the user makes a call to
get() *on a different file*, or if he performs a seek() to move
to a different part of the same file. Your ungotten or
saved character is now wrong.

You could try to fix this by instead seeking back one position
at the end of get(), so the next get() will see the same
character again. I don't want to get into this because
I don't want to assume that seek() will work on all types
of files/devices on all platforms. I could also attempt to
implement an "unget" facility for all Euphoria file I/O,
but as I said, I don't consider the whitespace
separation requirement to be so terrible that it requires
any major effort to improve it. In any case you will
always need whitespace between top-level atoms.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://www.RapidEuphoria.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu