russplaysguitar / UnderscoreCF

An UnderscoreJS port for Coldfusion. Functional programming library.
http://russplaysguitar.github.com/UnderscoreCF/
MIT License
89 stars 38 forks source link

variables._ is undefined #42

Closed farism closed 10 years ago

farism commented 10 years ago

When trying to use any underscore function that depends another underscore function I get an error

'_ is not defined'

it seems that it is trying to access the _ in the variables scope set on line 14

variables._ = this;

This is on cf10 windows 7. I'm not the most familiar with Coldfusion, and scopes still seem a mystery to me.

russplaysguitar commented 10 years ago

Could you please provide an example of code that I can use to reproduce the error? Thanks!

farism commented 10 years ago

Sure. This is the simplest example I could come up with. ColdFusion v10,283922

https://github.com/farism/underscore-cfc-test

russplaysguitar commented 10 years ago

The problem is that on line 1: <cfset _ = CreateObject('Underscore')> you are using CreateObject() without calling the init() method. You can change it to <cfset _ = CreateObject('Underscore').init()> or use the new syntax: <cfset _ = new Underscore()>

farism commented 10 years ago

Great, thanks for the quick responses!

russplaysguitar commented 10 years ago

hey no prob! let me know if you run into any other problems