Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 17029 invoked from network); 29 Apr 2009 20:28:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Apr 2009 20:28:29 -0000 Received: (qmail 20633 invoked by uid 500); 29 Apr 2009 20:28:28 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 20560 invoked by uid 500); 29 Apr 2009 20:28:28 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 20550 invoked by uid 99); 29 Apr 2009 20:28:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 20:28:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of losthost@yandex.ru designates 213.180.200.23 as permitted sender) Received: from [213.180.200.23] (HELO forwards2.yandex.ru) (213.180.200.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Apr 2009 20:28:18 +0000 Received: from webmail38.yandex.ru (webmail38.yandex.ru [77.88.60.17]) by forwards2.yandex.ru (Yandex) with ESMTP id 6DE0D4C4781 for ; Thu, 30 Apr 2009 00:27:55 +0400 (MSD) Received: from localhost (localhost.localdomain [127.0.0.1]) by webmail38.yandex.ru (Yandex) with ESMTP id 3AEA87E42A1 for ; Thu, 30 Apr 2009 00:27:55 +0400 (MSD) X-Yandex-Spam: 1 X-Yandex-Front: webmail38 X-Yandex-TimeMark: 1241036875 Received: from ppp89-110-4-140.pppoe.avangarddsl.ru (ppp89-110-4-140.pppoe.avangarddsl.ru [89.110.4.140]) by mail.yandex.ru with HTTP; Thu, 30 Apr 2009 00:27:43 +0400 From: dmi To: dev@couchdb.apache.org Subject: javascript user library MIME-Version: 1.0 Message-Id: <226961241036863@webmail38.yandex.ru> Date: Thu, 30 Apr 2009 00:27:43 +0400 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Virus-Checked: Checked by ClamAV on apache.org Hi, All! I would like to suggest some way to have library functions in the javascript (or other) views. Currently, if I have some structured entries and a bunch of "library" functions to peek values from them, which are highly used in many views, I have two possible ways: 1. to include the library functions in the each view; 2. to patch couchdb's main.js and to include the library in it. Both ways are ugly, imho... I realize, it would be cool to have, say, "/_library/libname" document with the library body. And to have the optional parameter 'library' in the view's definition: {'map': 'function body', 'reduce': 'function body', 'library': ['libname', ....]} so when couchdb pass the view's functions to the view server it will pass not only 'add_fun', but also 'add_lib' command with the library body to evaluate in the view execution environment. Unfortunately, I'm far from being an expert in couchdb ideology to propose more constructive ideas about :-) -- WBR, Dmi.