Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Not understanding OOP stuff Date: Sun, 23 Jul 2017 22:03:53 +0100 Organization: A noiseless patient Spider Lines: 55 Message-ID: <87379msw5i.fsf@bsb.me.uk> References: <1914438.irdbgypaU6@PointedEars.de> <02ec6752-8a2d-4116-9396-71d36dcbd579@googlegroups.com> <87k22zrmtj.fsf@bsb.me.uk> <3298850e-dce6-4384-af58-8bb58830960f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="964fdf7e903e77d2a3835607e95d0da8"; logging-data="26118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tZAj4lnKyDIWfOJaTq5O8g+g6UjzFC4c=" Cancel-Lock: sha1:AiEMw/3TstGGOg5GEJI8pI5ftxc= sha1:z1DjVpjcPMkhLqsEkRnzmRMSXCU= X-BSB-Auth: 1.42ef0a95f5cca7ad70a6.20170723220353BST.87379msw5i.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:33628 Julio Di Egidio writes: > On Sunday, July 23, 2017 at 9:10:58 PM UTC+2, Ben Bacarisse wrote: >> Julio Di Egidio writes: >> > On Sunday, July 23, 2017 at 6:12:22 PM UTC+2, Thomas 'PointedEars' Lahn wrote: >> >> Stefan Ram wrote: >> > >> >> > (At least, this is the common metaphor.) >> >> >> >> Programming is _not_ philosophy. >> > >> > Agreed: and, crucially, JavaScript is _not_ an object-oriented >> > language. >> >> From ECMA 262: >> >> "ECMAScript is an object-oriented programming language..." >> >> Maybe one could call the point "debatable"? (Not that I want to debate >> it.) > > It may be debatable, it certainly is debated, but I think it's total > nonsense and essentially a consequence of the so called "OO uber alles". > Also, you have already been warned that the JS standard does have few > problems: supporting confusion on the very paradigm is one of them. The interesting things are the concepts not the names. ECMAScript supports many of the concepts that people like Alan Kay would say are essential to being object-oriented. It supports local retention and hiding of state along with extreme late binding, but it does not use message passing as the communication between objects. (And the hiding of state is not enforced.) > JavaScript is a *functional* language, just with specific support for > "objects" and prototypal inheritance: some call it "object-based" instead > of "object-oriented" in order to name that distinction. Taking a cue from you, I'd rather say that it supports functional programming. A language that has mutable state, and in which that state is so often used in idiomatic code, has a rather weak claim to be called a functional language. > In fact, that one can build a fully OO abstraction on top of JS means that > the language is super-powerful, not that anyone should really go for any > such aberrations. Right, but that's always going end up in a logical hole. What matters is what is directly supported by the language and what typical code really does. For example, F# and SML both have mutable "variables", but they are so rarely used in idiomatic code that this does not usually prevent them from being called "functional". -- Ben.