richardofyork

Joined 15 years ago

Karma
437
Submissions
115
Member since
Jul 3
Developing.
View on Hacker News

Recent submissions

Comment · 12 years ago
Comment · 12 years ago
I am the author, and I will try to address some of the comments:

1. First, if you buy and read the book, your writing will definitely improve. You will write better than you ever have. I am confident you will. Those tiny grammar books on amazon.com wouldn't help much because many don't cover the crucial topics for writing well. I read nearly all of them.

2. Language is instinctual, so arguing about grammatical rules is pointless. Take this passage from my book: "I agree with Steven Pinker, as he describes in his book "The Language Instinct," that humans have an instinct to learn and use language, and some nonstandard grammars and dialects perceived to be unsophisticated and ungrammatical (Appalachian English Vernacular and Black English Vernacular, for example) do, in fact, follow sophisticated grammatical rules.

I will not hurl even a pebble of criticism to anyone who uses English grammar to his or her own inclination. Instead, this book helps people who want to improve their Standard American English and Standard British English grammar. By “standard,” I mean the form used in academia, mainstream businesses and books, and formal and informal writing aimed at the general public or educated readers.

3. For the first bullet, I combined two similar bullets into one, hence the possible oddity. I constructed it for brevity, not for eloquence. No need to niggle over a bullet; it's a peccadillo. Incidentally, I wrote an entire chapter on how to write eloquent prose.

4. Ztratar, I presume you would agree that books are not useless. While anyone can probably learn anything online, books are still usually more organized and better researched than disparate articles and blog posts spread across hundreds of websites. In fact, to my knowledge, about half of the content in my book cannot be found online. I have devised some new grammatical constructions and techniques for writing skillfully.

5. Icambron, you should definitely read my book. You will learn a lot. For example, you will learn that all those things you pointed out are actually grammar myths (aka superstitions). I have an entire section on myths that many people believe are legitimate rules of grammar. Many such myths abound even in schools, including college. You should read the following article, a section from my book; you may find some of the cool sentence constructions quite different from the prosaic and formulaic constructions taught in schools: https://grammarandwritingforcreators.com/Creative_Powerful_W...

5. Seanmcdirmid, I wrote an entire section on the rhythm and euphony of sentences, another topic rarely found in grammar books. You can read this new figure of speech that I have devised (unrelated to rhythm, but all the examples employ rhythm): https://grammarandwritingforcreators.com/Conceal_Reveal_Arti...

Comment · 13 years ago
Ohh, so that is why sites disappear from the front page suddenly. Interesting. I agree with you.
Comment · 13 years ago
Good question: I take it you are referring to the code below. The reason str is garbage collected is because of the modern implementation of the JS compiler in Chrome. Such modern JS compilers look specifically for such unused variables in closures, even when the variable is in the execution context of the closure.

To clarify, it is Chrome's decision to garbage collect the str variable in that context that resulted in str being garbage collected. It is not a result of a JavaScript bug.

Moreover, different browsers have different implementations for how they garbage collect variables in closures' scope chain. Heck, browsers do their own thing when it comes to many aspects of JavaScript.

On second thought (from our previous back and forth), you are correct that I did not explicitly discuss this specific issue in my earlier post. So you win :) and I have up-voted your two comments accordingly.

Here is the code I think you are referring to: var run = function () { var str = new Array(1000000).join('*'); var logIt = function () { console.log('interval'); }; setInterval(logIt, 100); }; setInterval(run, 1000);

Comment · 13 years ago
Are you saying my explanation does not explain the following? "logIt alone -> str is garbage collected"

I don't see why you don't understand why I am saying. My first post explains in detail how closures work and why the issue is not a JS bug, though it is indeed a memory leak. All I can say is that I have explained the overall inner workings of closures in JS, and my explanation covers all the scenarios outlined in the blog post.

This is the crux of the matter of the entire blog post:

"...str is only referenced in the main body of run, and in doSomethingWithStr. doSomethingWithStr itself gets cleaned up once run ends… the only thing from run that escapes is the second closure, logIt. And logIt doesn’t refer to str at all! So even though there’s no way for any code to ever refer to str again, it never gets garbage collected!"

And I explained why that problem is observed and why closures work the way they do.

PS. I will humbly agree to disagree: I think that I have explained all the scenarios outlined in the blog post and you disagree with me. This is not a problem; there is nothing wrong with disagreeing.

Comment · 13 years ago
nknighthb, I am just wondering. Did you downvote me because you think one part of my explanation was not specific enough?

First, you are correct that I specifically mentioned the logIf function when I discuss the specific example.But that does not take away from my thorough explanation of the main reason for the problem. In fact, everything I said about the logIt function applies to the doSomethingWithStr function, since they are both closures, so my explanation stands as is.

If you read my explanation again, you will see that I clearly explained that closures still have access to the outer function's scope, so both the logIt and the doSomethingWithStr functions have access to the outer function's scope chain even after the outer function or any of the other closures returns.

It is not until both all closures are destroyed or returns that the outer function's scope activation object is destroyed.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton