Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 83858 invoked from network); 27 Sep 2010 18:12:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Sep 2010 18:12:14 -0000 Received: (qmail 37712 invoked by uid 500); 27 Sep 2010 18:12:13 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 37615 invoked by uid 500); 27 Sep 2010 18:12:13 -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 37607 invoked by uid 99); 27 Sep 2010 18:12:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 18:12:12 +0000 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.210.52 as permitted sender) Received: from [209.85.210.52] (HELO mail-pz0-f52.google.com) (209.85.210.52) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 18:12:06 +0000 Received: by pzk27 with SMTP id 27so1780043pzk.11 for ; Mon, 27 Sep 2010 11:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=quQk0MOIFODsJQ0m5St3b0x5Jyde0NLALRLrYN9tWsA=; b=pyA6vaF531p05Y+LimL/QnossVJrXm6LVsDsoe+QaIj12s0DHp+1IsvLkofh6kbT+s ptBBy6HguSJ9uwxYOAj4AilGhdQUIlj1ltcgfDQCXmV1Mcx8WacAPJrJnzCNmkbyY7vN +BmN3f7YgW2i91gKyp1GxAfTh9Kirj4Rhl9Ro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=jA6+KV6/FxIumpDlNt0FzFfrJPZ+5jJ6O8ZEEm2jIuY7KRkPJm8M1LE19OO034E1PK Gwj21j4vppU/wTcpp4Ct5P47wdHaATpMd0sPwdI07v1Hd6G89GiISYKHVo4g4fK93qWR AAdqD/hc/y1imwuxiaa9b6jaJA+0vq+OkW+Rw= Received: by 10.142.230.11 with SMTP id c11mr6801770wfh.327.1285611103474; Mon, 27 Sep 2010 11:11:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.30.194 with HTTP; Mon, 27 Sep 2010 11:11:02 -0700 (PDT) In-Reply-To: References: From: Paul Davis Date: Mon, 27 Sep 2010 14:11:02 -0400 Message-ID: Subject: Re: adding new macro to couch_db.hrl To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Sep 27, 2010 at 2:06 PM, Filipe David Manana wrote: > On Mon, Sep 27, 2010 at 7:04 PM, Adam Kocoloski wro= te: >> I don't like "get" because it clashes with the auto-imported erlang:get = (for the process dictionary). >> >> Any reason to prefer a macro over an -import statement? > > Just to avoid doing the import everywhere and I still consider > get_value too long :P > >> >> Adam >> >> On Sep 27, 2010, at 1:47 PM, Filipe David Manana wrote: >> >>> Hi, >>> >>> I'm getting tired of typing couch_util:get_value(......). It also >>> consumes too much horizontal space. It's probably the most used >>> function from couch_util. >>> I'm thinking of adding a new macro in couch_db.hrl, like: >>> >>> -define(value(Key, List), couch_util:get_value(Key, List)). >>> >>> -define(value(Key, List, Default), couch_util:get_value(Key, List, Defa= ult)). >>> >>> Or maybe naming the macro just "get". >>> >>> Anyone against it? >>> >>> >>> cheers >>> >>> -- >>> Filipe David Manana, >>> fdmanana@gmail.com, fdmanana@apache.org >>> >>> "Reasonable men adapt themselves to the world. >>> =A0Unreasonable men adapt the world to themselves. >>> =A0That's why all progress depends on unreasonable men." >> >> > > > > -- > Filipe David Manana, > fdmanana@gmail.com, fdmanana@apache.org > > "Reasonable men adapt themselves to the world. > =A0Unreasonable men adapt the world to themselves. > =A0That's why all progress depends on unreasonable men." > I'd have to agree with Filipe that I'd probably rather see a macro than an import. For some reason or another imports tend to annoy me because its a layer of indirection between what's being called. Granted, in some of those cases its probably more of a sign that we need to break some of the various files into sub modules and what not. More at 10.