From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: taylanbayirli@gmail.com (Taylan Ulrich B.) Newsgroups: gmane.lisp.guile.user Subject: Re: guile-json 0.2.0 released Date: Fri, 05 Apr 2013 00:21:51 +0200 Message-ID: <8738v63pj4.fsf@taylan.dyndns.org> References: <871uaqha98.fsf@taylan.dyndns.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365114127 30512 80.91.229.3 (4 Apr 2013 22:22:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Apr 2013 22:22:07 +0000 (UTC) Cc: guile-user To: Panicz Maciej Godek Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Apr 05 00:22:35 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UNsYD-00080h-HW for guile-user@m.gmane.org; Fri, 05 Apr 2013 00:22:33 +0200 Original-Received: from localhost ([::1]:36243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNsXo-0007T2-Kv for guile-user@m.gmane.org; Thu, 04 Apr 2013 18:22:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNsXe-0007S5-QE for guile-user@gnu.org; Thu, 04 Apr 2013 18:22:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNsXb-0006Pz-P9 for guile-user@gnu.org; Thu, 04 Apr 2013 18:21:58 -0400 Original-Received: from mail-bk0-x22c.google.com ([2a00:1450:4008:c01::22c]:37970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNsXb-0006Pg-Ca for guile-user@gnu.org; Thu, 04 Apr 2013 18:21:55 -0400 Original-Received: by mail-bk0-f44.google.com with SMTP id jk13so1777043bkc.3 for ; Thu, 04 Apr 2013 15:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=ZocPQGu49WuMW39sU2XpNlG8KHdYhGy+Ytr+FG66CY0=; b=AkcdbZQnOuKarNgLfV8TlbV8UoHhfKx/11BTTPUeWW3iZ6LIpD5kqxHuvS1O8XQjq0 d+00zwWpzSJ9+k9BRqSX76ywzfKdgvOmoRz3NpMD6OIfcG/7OEeNn29bab/52wJvZd9f 50hOUntowmDgMS18Y/SOkFjYlzihuEsO8OvfKVcsIMgaezsxCbneH/l66J/s5zuMPLwk YE1eg7Dz8eeV2qPmbAIYKYZ76IIHw6qNRlDIpfQTN/RO1S/Bxje7jrCBjwHtyk3gejjz DcfzHy9hiaaGAtAIzQnLaL0F1a76d2tVPnU5P1OhD2dNaB8GpBkb2aPEV4IAcye34pjW 8i9w== X-Received: by 10.205.32.208 with SMTP id sl16mr5847257bkb.27.1365114114360; Thu, 04 Apr 2013 15:21:54 -0700 (PDT) Original-Received: from taylan.dyndns.org (p4FD93BE3.dip.t-dialin.net. [79.217.59.227]) by mx.google.com with ESMTPS id r17sm7359603bkw.21.2013.04.04.15.21.52 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 04 Apr 2013 15:21:53 -0700 (PDT) In-Reply-To: (Panicz Maciej Godek's message of "Thu, 4 Apr 2013 14:06:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4008:c01::22c X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10234 Archived-At: Panicz Maciej Godek writes: > Well, I see why the representation based on hash tables is adequate > for JSON. There are, however, situations, when one wants to have an > ordered set, and it's good to have choice. Clojure, for instance, > offers such choice, and from the perspective of a programmer it's > better to have a choice. > > [...snip...] > > Of course it can. However it's not convenient. I use emacs+geiser and > when I want to see the content of a variable -- if it's a list or some > other basic type -- I just point a cursor on it and I get the value in > a minibuffer. When I want to see the content of hash-table, I need to > explicitly evaluate (hash-map->list cons my-hash-table), which seems > unnecessary When a hash-table is nested, it turns into a nightmare. If > there was a more reader-friendly representation of hashes, it would be > far more convenient. I could come up with some representation myself, > and use it in my programs, but I guess that this problem is more > serious and requires more attention. > > All in all, you don't write vector->list and list->vector to get a > nice printable representation of vectors -- there was an issue, and it > has been solved. Racket has its printable representation of hashes, > which is much nicer than the one of guile (although still not > perfect). How important these matters are is very subjective I guess. To be honest, I don't have a strong opinion at all, but was writing what I believe would be the stance of most Guile developers. If you believe these features to be important for the larger Guile user-base, you might want to bring that to the attention of developers (perhaps already achieved with these mails), or send patches. :) > Judging by the speed at which subsequent Reports on algorithmic > language Scheme are released, schemers don't seem know the word > "urgent" :) Which is good. > However, I think it is an important matter. I also think that it is no > good for scheme implementations to diverge from one another, if there > is no good reason for that. Yet you seem to be recommending highly non-standard features. Or did I misinterpret something? > Note that easy-to-use hash tables are what win the market for PHP, > despite many drawbacks of that language. What I know about PHP associative-arrays is that they are created by using the pseudo-function array(), with an alternative syntax, and are in many ways indistinguishable from normal arrays, which I seem to remember had bit me already one of the few times I had to use PHP. As someone with a generic sense for consistency and orthogonality, I found all that very distasteful. If PHP wins "the market" with such an implementation, then there's probably something wrong with the market. (There is, indeed, I believe.) > I know of no other implementation of Scheme than Guile which supports > SRFI-105. And I guess that the implementators will remain reluctant > with regard to it, as it introduces more randomness to the way the > code can be written. It's a relatively young SRFI. It's very well-thought-out though in my opinion, and offers a *generic* solution to the kind of problem you described. It doesn't introduce "randomness," it introduces well-defined extensions to the reader-syntax. I'd urge you to read it if you haven't already. > On the other hand, what are the argumets against making hash-tables, > vectors et al. applicable, assuming that "programming languages should > be designed not by piling feature on top of feature, but by removing > the weaknesses and restrictions that make additional features appear > necessary"? I don't have any arguments against that; in fact I just learned what it means for an object to be applicable. Seems like a nice idea on the surface, and I can't think of any immediate draw-backs. I'm not sure if it might be confusing to have more than two types of applicable objects (syntax-keywords and procedures), and I could probably only answer that question for myself after having written some code using that feature. Would be interested in hearing other people's opinion on this... > Plainly, the size is kept in the internal representation of the hash > table: > > typedef struct scm_t_hashtable { > unsigned long n_items; /* number of items in table */ > ... > > cf. > http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=libguile/hashtab. > h;h=82ed22e66eb1f5045793cfc55cca0be040d4aab1;hb=HEAD#l66 > > It would be really cheap&easy to get it from there. I just wanted to > show that hash-tables are neglected in Scheme in general, and in Guile > in particular. That sounds nasty indeed. It's late for me today; if no one's quicker than me, tomorrow I might see that I implement hash-size in C as my first Guile-contribution. :P Regards, Taylan