I wrote the following code, intended to join strings into a url.
_ = require 'underscore'
exports.joinUrl = (start, rest...) ->
  for item in rest
    if _.last start is '/'
      if _.first item is '/'
        start += item[1..]
      else
        start += item
    else
      if _.first item is '/'
        start += item
      else
        start += '/' + item
  start
When I start up the coffeescript repl, a very strange thing happens:
> _ = require 'underscore'
[snipped]
> {joinUrl} = require './joinurl'
{ joinUrl: [Function] }
> _
{ joinUrl: [Function] }
Huh? Somehow the import of joinUrl is overwriting the definition of the variable _. Even though (a) coffeescript wraps the module pasted above into a function, so that any usage of the variable _ shouldn't affect the outer scope, and (b) at no point in that code do I make any assignment of _, except to require 'underscore', which should be the exact same thing!
Any idea what's going on here?