flatiron / plates

Light-weight, logic-less, DSL-free, templates for all javascript environments!
MIT License
831 stars 69 forks source link

Defensive semicolon #49

Closed tauren closed 12 years ago

tauren commented 12 years ago

Apologies in advance for nit-picking, but is there a specific scenario where the defensive semicolon at the beginning of plates.js is necessary?

;var Plates = (typeof process !== 'undefined' && typeof process.title !== 'undefined') ? exports : {};

My understanding is a defensive defensive semicolon is needed before a line that starts with an open parenthesis, such as an immediately executed anonymous function:

;(function() {})(); 

But I don't see why it would be needed before var. I'm asking because currently there is no way for plates.js to pass jshint without removing the semicolon. I requested a jshint option to be more lenient on defensive semicolons, but @antonkovalyov didn't see the reasoning either and it was understandably rejected: https://github.com/jshint/jshint/issues/487

If there is a good reason for it, let me know, and I'll reopen the jshint issue.

heapwolf commented 12 years ago

its defensive in consideration of concatenation. but im not as compassionate as i once was about this. I would accept a pull request which removes it.