Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F07121854B for ; Wed, 2 Dec 2015 12:42:47 +0000 (UTC) Received: (qmail 67550 invoked by uid 500); 2 Dec 2015 12:42:41 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 67483 invoked by uid 500); 2 Dec 2015 12:42:41 -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 67402 invoked by uid 99); 2 Dec 2015 12:42:40 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2015 12:42:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 83A191A5BD3; Wed, 2 Dec 2015 12:42:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.102 X-Spam-Level: X-Spam-Status: No, score=-0.102 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 5h7r83__vTXS; Wed, 2 Dec 2015 12:42:38 +0000 (UTC) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 8604C35C5B; Wed, 2 Dec 2015 12:42:38 +0000 (UTC) Received: by igcto18 with SMTP id to18so30302932igc.0; Wed, 02 Dec 2015 04:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=etsbLvu/SBz/jtOzfqvow5CvygujmUdHjwbnE4Pl78Y=; b=CH0NPv8BGfWzzUaCm6ZXy3hnZk5pn+Pz53wNbg82n9rFrUlMnqXKTvEhm5MrjOxyvW 7NzjaNXkWFnlyPfyUzknGHwQP70pGJ9YQfXY+lqer9QfvWbn0k9M0Ga6GTPKq1omk5o2 9eXV+SZzE4BOr/s72LEKUMnRbymUwVZ4rcJYs7e5nek1z8CA0h+7T87wOhKmbZQ23M7G FI2b5cxzW0C2HWy9t2qPaiMadU/7uAV93/H+PjSQsmNVqI1nL27S0Sh4JNXELkQ0N6NY MQr2GnuTwFn8C5ix1PBKFyhyiO48hppchMvRjC3qc6xaM3140RxRlWq8VAmPn15pgpz0 03nQ== MIME-Version: 1.0 X-Received: by 10.50.41.98 with SMTP id e2mr32798881igl.84.1449060157968; Wed, 02 Dec 2015 04:42:37 -0800 (PST) Received: by 10.36.59.139 with HTTP; Wed, 2 Dec 2015 04:42:37 -0800 (PST) In-Reply-To: <63953CC0-7576-4A77-8284-DFA6529E6FF1@apache.org> References: <63953CC0-7576-4A77-8284-DFA6529E6FF1@apache.org> Date: Wed, 2 Dec 2015 15:42:37 +0300 Message-ID: Subject: Re: [PROPOSAL] Deprecate global functions in query server From: Alexander Shorin To: couchapp@couchdb.apache.org Cc: "dev@couchdb.apache.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Garren, On Wed, Dec 2, 2015 at 3:35 PM, Garren Smith wrote: > > This is an interesting idea. I think passing the emit function in is a go= od idea and might make somethings easier in PouchDB. I would rather a map = function looked something like this > > function (doc, emit) { > > } That's nice, but won't work: map function has access to a lot of other global functions we provide, so you'll end with signature of 7 arguments. I don't think there is any reason to fix this problem by a half. Just fix all globals or no one. > I don=E2=80=99t like the idea of passing a userCtx object. That feels ove= rly bulky. Things like JSON/require are global variables in Node.js or the = browser so my feeling is to follow their lead on those. ctx referenced not to userCtx, but a generic context object that hold all the global function and objects we provide now. These are listed in reference on documentation. May be we can find a better name to not cause confusion. funcs? env? Suggestions welcome (: -- ,,,^..^,,,