Sam Steingold on Fri, 22 Dec 2017 19:58:24 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: t_QUAD printed representation


> * Karim Belabas <Xnevz.Orynonf@zngu.h-obeqrnhk.se> [2017-12-22 16:21:18 +0100]:
>
> * Sam Steingold [2017-12-22 15:37]:
>> 
>> For clarity sake: the issue is read/print consistency.
>> I should be able to save and recover an object using its text
>> representation
>
> This is sadly not the case. The only way to "save and recover" an
> *identical* object is to use writebin / read.

I assume you mean gidentical()-level of equivalence.
For now I assume "functional equivalence" in the spirit of CL `equal`
(http://clhs.lisp.se/Body/f_equal.htm).

As a Lisper, I think that human-readable read/print consistency is a
critical feature.  It would be nice if it were implemented.

> ( And even then, this
> depends on a sane session context : variable ordering, etc... )

One could argue about relevance of "session context" at length. ;-)
However, the basic situation: copy/paste the last textual output into
the current prompt to get gidentical return value - seems like a
no-brainer.

>> without special cases for t_QUAD (and what other types?)
>
> t_QUAD is the worst but there are other caveats.

Are they listed anywhere?


>> IOW, for any object x and any string s, the following should hold:
>> 
>> gequal(gp_read_str(GENtostr_raw(x)),x) = 1
>> strcmp(s,GENtostr_raw(gp_read_str(x))) = 0
>
> It doesn't hold in general

I noticed :-(
However, do you agree that, in general, it _should_ hold?
("normatively", not "positively").

> the only way to reliably transmit a completely general object is to
> serialize it and use binary data (we use this intensively e.g for MPI
> interface), not convert to string and back.

Of course.
Some objects (e.g., an open stream) cannot be serialized.
However, if you CAN serialize an object, you should.
And if you cannot, the serialization (=== printed representation) should
indicate that this string cannot be read back.
E.g., Lisp uses the "#<...>" syntax for objects that cannot be read back.

> What is your exact use case ?

I do not have a specific use case.  To offer a straw man argument, if I
observed "1+4=7", would you ask me for a use case too? ;-)
Or, in reference to the recent Pandas havoc, if GP raised an error on
"sum(i=1,0,1/i)" -- would you ask me for a use case before fixing to
return 0?  ;-)

Thanks.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://iris.org.il
http://mideasttruth.com https://jihadwatch.org http://islamexposedonline.com
Only the mediocre are always at their best.