Re: Proposal for a (small) enhancement to the value() function.

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

Robert Craig wrote:
> 
> CChris wrote:
> > Currently, value(), defined in get.e, takes a sequence and returns 
> > {status code, value read}.
> > The proposed enhancement is to return 
> > {status code,
> >  value read,
> >  number of characters read,
> >  number of leading whitespace characters}.
> > 
> > This can be done at the cost of creating a duplicated, slightly modified
> > copy
> > of the internal Get() function, so that performance won't be affacted at
> > all.
> > get() won't be affected, since where() will give you most of the same
> > information.
> > 
> > Any thoughts? issues? other suggestions?
> 
> I don't care too much, one way or the other,
> since I haven't had a need for the extra information,
> but I can see that if you wanted to use value() to process
> a long string containing many object-representations,
> like you can do with get(), then you would like to know
> how many characters it read each time, so you could chop those off
> the input sequence, and run value() on the rest. 
> 
> I don't think this would break any significant 
> amount of existing code.
> 
> If people think this is worthwhile, then my (weak) preference 
> would be:
> 
>    - go ahead, but extend get() as well, to keep the
>      symmetry between get() and value()
> 
> A small point that may or may not affect you:
> When get() or value() process an object representation, 
> they sometimes stop reading when they see '}' or '"', 
> but sometimes they must read an extra space,
> e.g. for numbers like 3.33333 an extra character (e.g. blank)
> might have to be consumed in order to know that you've reached 
> the end of the number. There is no way for get() to push this 
> character back into the input stream. This issue bothered one or 
> two people in the past. i.e. a stream like {1,2,3}3.33333 can be 
> read properly, but 3.33333{1,2,3} can't. That's why the docs say 
> you need some whitespace between all objects in the stream.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

As you can see, there is also an alternate scheme proposed by Pete Lomax.

I thought get() could easily say
junk=seek(input_file,where(input_file)-1))

 to back up the extra
space, if needed. This won't work with some devices of course, and there's no way
to tell whether input_file refers to a device. I don't know if anyone cares.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu