Re: [jslint] for comma
- Would you be willing to explain (or point us to something explaining) the
pitfalls of this practice?
On Fri, Jul 15, 2011 at 2:46 PM, Douglas Crockford <douglas@...>wrote:
> Is anyone still using comma expressions in the control part of for
> statements? I think this is a bad practice, but JSLint currently tolerates
[Non-text portions of this message have been removed]
> > Can you come up with an example whereSo how do you design a programming style? What justification is there for preferring one feature over another? One school says that "Just Cuz" is an adequate criteria. It just comes down to personal taste. And even though we know it isn't true, we are all free to believe that one person's taste is as good as anyone else's.
> > their use makes code clearer?
> Why is that "the real question"?
> Computer languages are tools. The tools are flexible and varied.
> Absent a very clear harm, we should not remove flexibility.
My approach is different. I am trying to have mechanical identification of defects. There are some situations that are difficult to distinguish mechanically, so I now consider all of those cases problematic, even when they are not obviously wrong.
I believe strongly in subsetting, and my design of subsets factors in things like mechanical identification.
There are certainly tradeoffs here. I am rejecting some features. But I think this is a minimal cost because those features are not essential. We can still write very good programs without them. The benefit is that we can mechanically detect more defects. An unexpected but significant benefit is that the subset is itself a better language than the whole language, and the programs written in that subset tend to communicate better to other humans.