incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: The sum function (used in reduce)
Date Sat, 25 Apr 2009 19:09:45 GMT
On Sat, Apr 25, 2009 at 2:58 PM, Wojciech Kaczmarek
<kaczmarek.w@gmail.com> wrote:
> On Sat, Apr 25, 2009 at 20:15, Paul Davis <paul.joseph.davis@gmail.com> wrote:
>> On Sat, Apr 25, 2009 at 2:04 PM, Chris Anderson <jchris@apache.org> wrote:
>>> On Sat, Apr 25, 2009 at 11:05 AM, Wojciech Kaczmarek
>>> <kaczmarek.w@gmail.com> wrote:
>>>> Now I see similar questions emerged. So my point is now: Is there a
>>>> way, existing or planned, to share some functions between views
>>>> without using couchapp macros?
>>>
>>> No such plans. The functions are stored according to a hash of their
>>> byte representation, so it's important that the function doesn't load
>>> any additional code, changing its behavior without changing its
>>> byte-string. Hence the use-case for something like CouchApp.
>>
>> The reason for the hashing is that we need to know when the function
>> changes to know when to reindex documents. Storing library code
>> somewhere ends up making this a bit more complicated. I wouldn't call
>> it out of the question to have something, but I don't think its on
>> anyone's agenda as things like CouchApp alleviate most of the need for
>> it.
>
> I see. This is quite clever hack. I like its simplicity (Couchdb
> shines this way in other aspects as well, so kudos to all implementors
> :-).
> So the result of CouchApp push are just injected code chunks, right?
> What about code size for really complicated macro sets, is it
> irrelevant in practice?
>

Yeah, the code is just injected inline. I wouldn't worry about code
size unless you're doing something fairly strange. For normal use
which includes things like pulling in entire templating systems I've
never heard of an issue.

HTH,
Paul Davis

Mime
View raw message