guile-user
[Top][All Lists]
Advanced

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

Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(


From: Ludovic Courtès
Subject: Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(
Date: Wed, 13 Aug 2014 23:06:45 +0200
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Jan Nieuwenhuizen <address@hidden> skribis:

> Ludovic Courtès writes:
>
>> The problem is that SRFI-10 itself does not specify an external
>> representation for hash tables, nor does Guile.  Thus this patch cannot
>> be applied.
>
> Yes, I understand that...Still, "wouldn't it be nice" if Scheme/Guile
> had something that javascript has, in JSON hash tables are "simply"
>
>    {"key0": value, "key1": value}

Yes, it would.

But the beauty of Scheme is that the language can be extended to support
that, like with the ‘hash-table’ macro suggested at
<http://lists.gnu.org/archive/html/guile-user/2014-07/msg00009.html>.

> and although that's in some way much uncooler and restricted and set-in
> stone wrt Scheme readers and SRFI-10...you *are* able to stream and
> communicate objects over ascii/utf-8, unlike #,(hash ...

If the goal is to serialize/unserialize things, then the best option is
to devise an external representation, say:

  (hash-table (key0 value0) ...)

And then have ‘read-hash-table’ and ‘write-hash-table’ procedures
(rather than pass arbitrary sexps read from the wire to ‘eval’.)

> Here we are with a unimaginable cool srfi-10 reader extension, but we
> cannot really use it to communicate.

SRFI-10 is cool to reduce typing, but I’m not convinced it really helps here.

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]