incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1151) Require function doesnt fullfil specification
Date Fri, 06 May 2011 14:33:03 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13029952#comment-13029952
] 

Paul Joseph Davis commented on COUCHDB-1151:
--------------------------------------------

If I understand this bit correctly it looks fine to me. Though I might reorganize how the
id's are processed to help with my future sanity. The current method looks to be more of an
online algorithm that processes module names a section at a time. Generally when I work with
names that have the relative modifiers I'll first normalize the relative parts of the name
out so that the lookup is a bit more straightforward but that's just personal preference.

If no one has any objection to this I'll go ahead and commit it this afternoon.


> Require function doesnt fullfil specification
> ---------------------------------------------
>
>                 Key: COUCHDB-1151
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1151
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11.2, 1.0.2, 1.1
>            Reporter: Alexander Shorin
>            Priority: Critical
>              Labels: commonjs, javascript, require
>         Attachments: design.require.txt, design_docs.js.patch, utils.js.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> According CommonJS Modules specification [1]:
> > 4.  Module identifiers may be "relative" or "top-level". A module identifier is
"relative" if the first term is "." or "..".
> > 5.  Top-level identifiers are resolved off the conceptual module name space root.
> This specification is broken in current realization at those terms. See design test case.
> Actually problems:
> 1. Module id is broken if module imports from same level (as via '.') or from parent
level (as via '..'). AFAIK, module id should be valid to make require(mod.id) call successful.
See`_show/relative-id`, `_show/require-relative-id` and `_show/relative-parent-id` function.
> 2. Absolute module import is broken from relative imported module. See`_show/absolute-require`
function.
> 3. Multiple relative imports from same level(as via '.') breaks require function. See
`_show/maze` function.
> Those problems makes require function works unexpectedly and obstructs solving at least
one more issue #1075 [2]
> I know that all relative imports are discouraged, but if they are supported, why they
shouldn't work properly?(:
> [1] http://wiki.commonjs.org/wiki/Modules/1.1.1
> [2] https://issues.apache.org/jira/browse/COUCHDB-1075

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message