ClojureScript

Throw exception if multiple namespaces are required with the same alias

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Take for example this code:

(ns foo
  (:require [views.bar :as bar]
            [model.bar :as bar]))

;; this is meant to use views.bar
(bar/update-view)

The call to update-view fails with a "Cannot call method call of undefined", which is quite confusing if you have a big list of requires at the beginning. The expected behavior would be a compile-time error.

Activity

Hide
Tom Jack added a comment -

I had found it convenient to be able to do

(:require [foo :as f]) (:require-macros [foo :as f])
, although I admit I was a bit surprised when I discovered that that worked.

Would you be interested in a patch which preserves this behavior, or will we have to use separate aliases for fn/macro ns's from now on?

Show
Tom Jack added a comment - I had found it convenient to be able to do
(:require [foo :as f]) (:require-macros [foo :as f])
, although I admit I was a bit surprised when I discovered that that worked. Would you be interested in a patch which preserves this behavior, or will we have to use separate aliases for fn/macro ns's from now on?
Hide
David Nolen added a comment -

A patch to allow macro dependencies to reuse a namespace alias is welcome.

Show
David Nolen added a comment - A patch to allow macro dependencies to reuse a namespace alias is welcome.
Hide
Tom Jack added a comment -

Here's a patch that does that (macro-realias.patch, 23 Dec 2012).

Show
Tom Jack added a comment - Here's a patch that does that (macro-realias.patch, 23 Dec 2012).

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: