{"id":995,"date":"2019-07-01T15:48:21","date_gmt":"2019-07-01T15:48:21","guid":{"rendered":"http:\/\/www.onux.com\/jspp\/blog\/?p=995"},"modified":"2019-07-01T16:07:24","modified_gmt":"2019-07-01T16:07:24","slug":"jspp-0-9-1-bug-fixes","status":"publish","type":"post","link":"https:\/\/www.onux.com\/jspp\/blog\/jspp-0-9-1-bug-fixes\/","title":{"rendered":"JS++ 0.9.1: Bug Fixes"},"content":{"rendered":"<p>The JS++ core is now down to 9 low-priority bugs after 3.5 years of engineering and 400k+ lines of source code thanks to our lead engineer, Anton Rapetov.<\/p>\n<p>Building on top of our release of &#8220;existent types&#8221; to prevent out-of-bounds errors, we&#8217;ve had enough time for testing and feedback to discover that existent types work, and they will remain a cornerstone of JS++ going forward into the future.<\/p>\n<p>This latest release, version 0.9.1, focuses primarily on bug fixes. We value disciplined engineering, and we wanted to pay back technical debts. However, despite the bug fix theme, there are a few notable features and announcements. I&#8217;ll highlight what&#8217;s new or changed, and the list of bug fixes will be at the end.<\/p>\n<h3>Console.trace<\/h3>\n<p>While we&#8217;ve had <a href=\"https:\/\/docs.onux.com\/en-US\/Developers\/JavaScript-PP\/Standard-Library\/System\/Console\/log\" target=\"_blank\" rel=\"noopener noreferrer\">Console.log<\/a> for a long time, it doesn&#8217;t include critical information on where the log message originated from. You might find the new <a href=\"https:\/\/docs.onux.com\/en-US\/Developers\/JavaScript-PP\/Standard-Library\/System\/Console\/trace\" target=\"_blank\" rel=\"noopener noreferrer\">Console.trace<\/a> method more useful:<\/p>\n<p style=\"background:#2F3335;color:#D5D5D5;padding:4px;font-family:monospace;\">filename.js++:3:0: Now we have the original file location, line number, and column number for our logs!<\/p>\n<h3>Block Scoping<\/h3>\n<p>We&#8217;ve also had <a href=\"https:\/\/docs.onux.com\/en-US\/Developers\/JavaScript-PP\/Language-Guide\/scopes-scoping\" rel=\"noopener noreferrer\" target=\"_blank\">block scoping semantics<\/a> for a long time. JS++ brings you high-performance block scoping &mdash; even in ECMAScript 3 environments.<\/p>\n<p>In the latest version, block scoping is finalized and all corner cases should be covered. Specifically, we fixed code generation corner cases of lowering to the function scoping semantics of ECMAScript 3.<\/p>\n<p>(We are keenly aware of the block scoping available in ECMAScript 3+ &#8216;catch&#8217; blocks, which we addressed since the very first release of JS++ as being too costly in terms of performance. This is a gem of the ECMAScript specification that few people know about, and it highlights why you should trust our knowledge and experience &#8211; rather than choosing Microsoft just on brand name &#8211; going into the future.)<\/p>\n<h3>Existent Types<\/h3>\n<p>In the last version, 0.9.0, we announced existent types to prevent runtime out-of-bounds errors. In this release (0.9.1), we are doubling down on existent types and revising the rules based on experience, feedback, and re-design:<\/p>\n<ul>\n<li>If type <code>T<\/code> has an implicit conversion to <code>external<\/code>, <code>T+<\/code> also has an implicit conversion to <code>external<\/code><\/li>\n<li>The safe navigation operator (<code>??<\/code>) has a higher operator precedence. See the <a href=\"https:\/\/docs.onux.com\/en-US\/Developers\/JavaScript-PP\/Language-Guide\/operator-precedence\" rel=\"noopener noreferrer\" target=\"_blank\">operator precedence<\/a> documentation.<\/li>\n<li>Relax getter\/setter type rules for nullable and existent types<\/li>\n<li>Disallow <code>void+<\/code> and any usages of <code>void<\/code> except as a return type<\/li>\n<li>Forbid <code>external<\/code> as a common type for <code>int<\/code> and <code>string<\/code> for the safe navigation operator (<code>??<\/code>). Thanks to user @h-h in the <a href=\"https:\/\/chat.onux.io\/signup_user_complete\/?id=6eoxd4erotgwdgin8p6x9uupyc\" rel=\"noopener noreferrer\" target=\"_blank\">JS++ Community Chat<\/a> for reporting this bug.<\/li>\n<li>Fix error message when upcasting\/downcasting in the context of nullable\/existent types to make it clearer<\/li>\n<\/ul>\n<h3>Nested Generics with Generic Parameters<\/h3>\n<p>In previous releases, we had left nested generics (with generic parameters) unimplemented. Previously, the following code worked:<\/p>\n<pre class=\"brush:jspp\">\r\nArray&lt;Array&lt;int&gt;&gt; arr1; \/\/ nested, non-parametric\r\nArray&lt;T&gt; arr2; \/\/ non-nested, parametric\r\n<\/pre>\n<p>The latest version now enables nested generics with generic parameters:<\/p>\n<pre class=\"brush:jspp\">\r\nArray&lt;Array&lt;T&gt;&gt; foo; \/\/ nested *and* parametric\r\n<\/pre>\n<h3>Bug Fixes<\/h3>\n<p>Finally, here is a list of all the other bug fixes. There are a lot. The latest 0.9.1 release brings JS++ software quality to its highest level yet by addressing technical debt rather than delivering new features.<\/p>\n<p>Fixed:<\/p>\n<ul>\n<li>&#8216;foreach&#8217; looping over external &#8220;array-like objects&#8221;<\/li>\n<li>SyntaxError in generated code for generic functions\/casting<\/li>\n<li>Error message for <code>super()<\/code> on base class<\/li>\n<li>Duplicated error messages<\/li>\n<li>Line terminators in strings generated via escape sequences<\/li>\n<li>Fix segfault when casting away nullable type of non-static field<\/li>\n<li>Don&#8217;t raise a redundant error of accessing a parameter that was shadowed<\/li>\n<li>Raise a special error &#8220;Re-declaration of parameter&#8221;, if a parameter was shadowed<\/li>\n<li>Allow hoisting of static class fields across different classes in the same module<\/li>\n<li>Do parameter and arity checking on <code>new<\/code><\/li>\n<li>Wrong line number for dot operator<\/li>\n<li>Inaccurate error message for generic instanceof<\/li>\n<li>Only one error message for method overriding when inheriting from generic class with non-existent argument<\/li>\n<\/ul>\n<h3>Conclusion<\/h3>\n<p>Software quality at JS++ has always remained high, and that&#8217;s a testament to the ability of our lead engineer, Anton Rapetov, and our engineering approach. In more than 3.5 years of engineering, we currently have fewer than 10 open bug reports in the core compiler.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The JS++ core is now down to 9 low-priority bugs after 3.5 years of engineering and 400k+ lines of source code thanks to our lead engineer, Anton Rapetov. Building on top of our release of &#8220;existent types&#8221; to prevent out-of-bounds errors, we&#8217;ve had enough time for testing and feedback to discover that existent types work, &hellip; <a href=\"https:\/\/www.onux.com\/jspp\/blog\/jspp-0-9-1-bug-fixes\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;JS++ 0.9.1: Bug Fixes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/posts\/995"}],"collection":[{"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/comments?post=995"}],"version-history":[{"count":25,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/posts\/995\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/posts\/995\/revisions\/1021"}],"wp:attachment":[{"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/media?parent=995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/categories?post=995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.onux.com\/jspp\/blog\/wp-json\/wp\/v2\/tags?post=995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}