News for hackers. Stuff that matters.
Re:Show HN: Textures.js, SVG Patterns for Data Visualization by mbostock on Wednesday March 18, 2015 @02:02PM (#9227424)
Aren’t these textures already reusable? The constructed texture object (the result of textures.lines(), e.g.) can be called on as many selections as you like to reuse it.

I feel it’s a matter of taste, but one practical reason I prefer chaining to configuration objects is that you get a runtime error when you misspell a property, rather than it being silently ignored.

Re:Show HN: Textures.js, SVG Patterns for Data Visualization by ttty on Wednesday March 18, 2015 @06:51PM (#9229183)
Image you have an UI which talks to this. For example you have a button on/off. How would you do?

    var t = texture().lines().stroke('red')
    if(this.button.on) t= texture.heavier()
Compare the previous with this one.

    var t = texture({lines: true, heavier: this.button.on, stroke: 'red'})
I also hate the non standard constructor: this should be like this

    var texture = new Texture({lines: true, heavier: this.button.on, stroke: 'red'});
Re:Show HN: Textures.js, SVG Patterns for Data Visualization by siddboots on Wednesday March 18, 2015 @11:53PM (#9230118)
"heavier: this.button.on" has ambiguous semantics. Do libraries really use this pattern?

Also, use of the "new" keyword is contentious. You can hardly pretend that it is best practice.

Re:Show HN: Textures.js, SVG Patterns for Data Visualization by ricsca on Thursday March 19, 2015 @10:50AM (#9232300)
It should be

    var t = texture().lines().stroke('red')
    if(this.button.on) t.heavier()