Skip to main content
news

Re: Snit post-editing

Steve Carroll
SubjectRe: Snit post-editing
FromSteve Carroll
Date12/11/2015 08:02 (12/10/2015 23:02)
Message-ID<5288ca4f-adbd-4c3d-92ec-d45f422b9dc8@googlegroups.com>
Client
Newsgroupscomp.os.linux.advocacy
Followsowl

On Thursday, December 10, 2015 at 10:48:40 PM UTC-7, owl wrote:

owl
Steve Carroll <fretwizzer@gmail.com>wrote:

Steve Carroll
On Thursday, December 10, 2015 at 7:53:04 PM UTC-7, owl wrote:

(snip)

owl
OK.

Steve Carroll
Did you grasp how javascript handles closures here?

( I know, you like it about as much as you like Beck ;)

owl
I don't write code for a living

Nor do I.

, and I guess I just don't see the benefit of closures. I've never encountered a need for them so far (but then the languages I code in don't offer them anyway, so...).

Here, there really isn't one but you can use them for encapsulating (and protecting) data; other languages use classes for this. ES6 will have a 'class' keyword but I still don't think it'll function the same as it does in other languages. Frankly, I think it's just lipstick to facilitate people coming from other languages but I could be wrong... haven't really looked into it.

Out of curiosity, is there a benefit in calling this way: var slamSnit = greeting('Snit'); var greetOther = greeting('other'); slamSnit('Snit', 'crackhead'); greetOther('owl', 'crackhead'); versus this way: greeting('Snit')('Snit','crackhead'); greeting('other')('owl','crackhead');

No real benefit in this example but it is a way to create functions that are more expressive with respect to how you might (re)use it, while simultaneously passing default params as you do. That coupling greatly helps organization and makes things much more readable. It may not look like it here but it can actually add in making your code more DRY. This isn't the best example as it just shows how the concept works on a simple level. Unfortunately, this can often make it look more verbose for no reason, looking like the opposite of what you're trying to achieve.

As for Beck, we'll just have to agree to disagree. I'll never be a convert.

I'm not looking to convert you, just to show you that talent exists even in things you may not like. Take Snit, for example... lots of trolling talent there.