You write objects. You.

 
Roscigno: Ah Polish notation was invented by a Polish guy in the 20’s

Buzzi: Sl33k: for your sake I hope you’re not talking about the library prototypejs

Blumer: Prohobo, it was trivial to p****

Reidhaar: Prohobo: only usually infix stuff aka math looks unfamiliar in lisp

Trivette: Prohobo, same for APL syntax

Lysne: Otherwise it is the same amount of parens as java

Griesinger: Funcarg1, arg2, arg3 vs func arg1 arg2 arg3

Liggans: Why didnt we merge the construction function and the prototype into one big function, so we have: var Circle = functionname{this.name = name; this.printName = function{console.log”My name is: ” + this.name}};

Haggarty: In APL you read expressions right-to-left

Mcevoy: Zomg: why is prototypejs first thing that comes to your mind? _

Shanker: Deniska: pretty sure there are S-expression-based languages that use { } instead of , or

Mccrossin: So above question is it a language bad design or restriction?

Buzzi: Sl33k: well that’s how your message read without the proper grammar ;

Mozak: Dolby: clojure mixes them for different kind of primitives.

Fecko: Sl33k: bad design on your part.

Flintroy: Sl33k: you’re not even using prototypes there

Puhuyaoma: Sl33k: a prototype is just a regular object. But it’s a regular object that happens to share its properties with one or more other objects. If your object isn’t inherited by anything, it’s not a prototype

Tuthill: Hey Dolby. i’ll put uit up on jsfiddle now. i think i understand prototype better now. i second

Pfefferle: Sl33k: a constructor function is just a regular function. There’s nothing special about it. At all. Nothing. Not a thing.

Vanheel: Sl33k: the only thing special is new, which calls any regular function with a fresh object, created by cloning the object pointed by thatFunction.prototype. This regular function which is not special at all may, then, either mutate that object to initialise it, or ignore the object entirely and return something else completely

Sadler: Yes, constructor functions are bad

Romano: Dolby: https://jsfiddle.net/4rg26zkw/

Senseney: Dolby: so given my codes? i was wondering why i couldnt do the magic in Animal prototype while declaring the constructor function itself

Gaer: Sl33k: I explained it above. There’s no magic involved here anyway. And constructor functions are just *regular* functions.

Rendina: Dolby: i am asking if javascript allows me merge it all into one block.

Gogerty: Sl33k: the idea of prototypes is that you inherit from objects directly, and work only with objects: var a = { foo: 1 }; var b = { __proto__: a, bar: 2 }. The existence of new and functions that can be called with new at all was a mistake in the language.

Cruzan: Sl33k: it doesn’t make sense to ask that.

Grantland: Sl33k: and what is “one block” anyway?

Koback: Would, e.g.: { function A{}; A.prototype = { . } } be one block?

Gerlock: Somethng more similar to java* public cl*** Animal{//everything goes in here}

Wheelen: Let the new go in there to pick its magic

Bibiano: Instead of having a Animal function declaration and another Animal.prototype definition

Seals: Sl33k: JS and Java have fundamentally different OO models. JS’s model has nothing of declaration in it. In fact, you shouldn’t be using constructor functions and new *AT ALL*, because those are *incompatible* with the OO model JS has.

Barbrick: Var Clonable = { clone: functionp{ p = p {}; var r = Object.createthis; forvar k in p rk = pk; return r }}; var Human = Clonable.clone{ speak: functionm{ printthis.name + ‘: ‘ + m }}; var Alice = Human.clone{ name: ‘Alice’ }; Alice.speak’Hello’;

Konopacki: Dolby: undefined; Console: ‘Alice: Hello’

Hogon: Sl33k: that’s what JS’s OO model is all about

Skanes: You write objects. You clone objects. You modify the objects you’ve cloned to make them do what you want. That’s all.