eval(repr(x)) == x

Jonathan Hogg jonathan at onegoodidea.com
Mon Jan 28 04:53:55 EST 2002


On 27/1/2002 20:26, in article slrna58oja.4cd.philh at comuno.freeserve.co.uk,
"phil hunt" <philh at comuno.freeserve.co.uk> wrote:

> I once designed a language whose main feature was that this
> was true for all x.
> 
> As a consequence, all data was trivially serializable.

Haskell does this. Unfortunately it's painfully inefficient compared to a
standard serialisation scheme.

I once wrote an interpreter for a domain specific language in Haskell. It
would parse and typecheck the input language to produce a data structure
suitable for interpreting. To save the time of parsing and typechecking
repeatedly I wrote the entire data structure out to a file.

Unfortunately, the resulting file was twice as big as the original input and
took four times longer to read back in again as it had taken to generate in
the first place.

Admittedly this was a flaw with Haskell, but it's still a cautionary tale
;-)

Jonathan




More information about the Python-list mailing list