tag:blogger.com,1999:blog-34454975.post5099229932411392779..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: What Books Didn't Tell You About ES5 Descriptors - Part 3Andrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-34454975.post-692052657550886422014-03-28T16:05:21.343+01:002014-03-28T16:05:21.343+01:00Peter I don't understand what is it that looks...Peter I don't understand what is it that looks bad ... if you are talking about implementing the lazy assignment then a) you have no other way in ES6 to do that via syntax and b) it'a specific pattern not widely adopted that really should never be there if you don't need it.<br /><br /><b>The lazy assignment is not how you should write any getter or setter</b>, is instead a very specify meant behavior that, if compatibility with old browsers is needed, needs some knowledge about how these behave.<br /><br />What you should rather focus in here, is <a href="http://webreflection.blogspot.com/2014/03/what-books-didnt-tell-you-about-es5_28.html#descriptors-vs-readability" rel="nofollow">descriptors vs readability</a> chapter classes examples, which is very clean and looks closer to what ES6 will come up with.<br /><br />Last, but not least, if you want to write beautiful ES6 code like via ES5 and without needing to even think about these problems, <a href="https://github.com/WebReflection/redefine" rel="nofollow">redefine</a> is just one options out of many.<br /><br />I will underline that last snippet is absolutely not how we should write code though, it's very sad that's all you have left from these posts.Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-52071044477527700042014-03-28T09:36:04.415+01:002014-03-28T09:36:04.415+01:00I have read all 3 parts and to tell you the truth ...I have read all 3 parts and to tell you the truth it does look bad. <br /><br />What you came up at the end of part 3 (the Class function) is really really not what I have been expecting from JS. Looks exactly like the hacks from MooTools time (dead now, thank God). <br /><br />I know you are strongly opinionated and do not give s*** about other's opinions, but just looking at that code you have used as example gives headache to everyone I show it to, including JS developers, let alone devs with other languages. <br /><br />I have been using JS for the last 5 years exclusively. However for the last 3 months I had to write PHP (bad choice as well) and Dart. I am not looking back. Ever. Which means something coming from a person who deals exclusively with it and is consulting JS for living...PeterStJhttps://www.blogger.com/profile/04425523630769302410noreply@blogger.com