3

Source: You Don't Know JS: this & Object Prototypes by Kyle Simpson (2014)

Example:

This mechanism is often called "prototypal inheritance" (we'll explore the code in detail shortly), which is commonly said to be the dynamic-language version of "classical inheritance". It's an attempt to piggy-back on the common understanding of what "inheritance" means in the class-oriented world, but tweak (read: pave over) the understood semantics, to fit dynamic scripting.

As I understand it, the part that begins with but tweak is just insertion text, kind of like a parenthetical statement. So, to fit dynamic scripting is the continuation of it's an attempt to piggy-back on the common understanding of what "inheritance" means in the class-oriented world (to fit dynamic scripting). What I have a problem with here is how exactly does that insertion text fit in with the rest of the sentence? What exactly do you think but tweak etc means? Is the author talking directly to me? Should I tweak the understood semantics? I don't fully grok the aspect it is used in.

  • Consider: "it's an attempt to decorate the house but keep the cost as low as possible". More elegant than "but" would be yet. "decorate ... yet keep". – Tᴚoɯɐuo Dec 15 '15 at 13:22
  • CopperKettle: Sorry, my bad. I used the wrong link. I fixed it now. – Michael Rybkin Dec 15 '15 at 13:38
  • TRomano: I guess that comma after the clause threw me off. – Michael Rybkin Dec 15 '15 at 13:40
  • 4
    Punctuation marks are ants at the syntactical picnic. – Tᴚoɯɐuo Dec 15 '15 at 14:00
4

In that "but-clause" in the sentence, Kyle is not addressing you, Cookie Monster, in a parenthetical manner. It's just part of the general flow of the sentence.

We can remodel the sentence a bit and the meaning will become clearer:

This mechanism is often called "prototypal inheritance" (we'll explore the code in detail shortly), which is commonly said to be the dynamic-language version of "classical inheritance". It's an attempt to piggy-back on the common understanding of what "inheritance" means in the class-oriented world, while tweaking (read: paving over) the understood semantics in order to to fit dynamic scripting.

  • 1
    prototypal is just weird. I think it should be prototypical. – Damkerng T. Dec 15 '15 at 12:29
  • 1
    I've found the original text and it's prototypal there. I don't feel a difference, although I also expected prototypical. There may be a difference. – CowperKettle Dec 15 '15 at 12:31
  • 4
    The inheritance is based on prototypes, hence the use of the variant prototypal. It is the word commonly used when discussing javascript. – Tᴚoɯɐuo Dec 15 '15 at 13:19
  • 2
    @CopperKettle I agree, I also thought "prototypal" a strange word. Perhaps he said "prototypal" rather than "prototypical" to indicate that he means related to the construct in the Java language that is called a prototype, rather than related to the general idea of a prototype. – Jay Dec 15 '15 at 14:54
  • Your version is a huge improvement on the original. The fact that it's still muddled is hardly your fault: it is the author's. – Ricky Dec 16 '15 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.