Proposed clarification in documentation: #1004

Merged
merged 2 commits into from Feb 15, 2012

3 participants

@peterp

Accounts.reset(<%= ... %>) to accounts.reset(<%= ... %>)
Projects.reset(<%= ... %>) to projects.reset(<%= ... %>)

As it's popular in JavaScript to capitalize constructors it might be confusing in this context.

@braddunbar
Collaborator

👍

@jashkenas
Owner

I dunno -- maybe I'm just old fashioned, but I like to have capitals for my top-level objects...

If we make this documentation change, does this PR cover all of the places where we use caps for non-constructors?

@braddunbar
Collaborator

I see, Accounts is capitalized because it's a global. In that case, perhaps we should just ensure that it's clear Accounts is a collection instance and not a constructor.

var Accounts = new Backbone.Collection();
Accounts.reset(<%= ... %>);
@peterp

I'll go through the documentation to make sure,

  • or -

The documentation could also create the collection to avoid any possible confusion:

var Accounts = new Collection();
Accounts.reset(<% ... %>);

@braddunbar
Collaborator

For what it's worth, there is some precedent here.

@jashkenas
Owner

Let's go that way then. Also, no need for parens when new-ing a value without params.

var Accounts = new Backbone.Collection;
Peter Pistorius and others added some commits Feb 14, 2012
Peter Pistorius Changed:
`Accounts.reset(<%= ... %>)` to `accounts.reset(<%= ... %>)`
`Projects.reset(<%= ... %>)` to `projects.reset(<%= ... %>)`

As it's popular in JavaScript to capitalize constructors it might be confusing in this context.
742dde3
@peterp peterp fixes #1004 c4d53ab
@braddunbar braddunbar merged commit cf93180 into jashkenas:master Feb 15, 2012
@braddunbar
Collaborator

Thanks @peterp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment