You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: upsert-tutorial/index.html
+72-50Lines changed: 72 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -1064,6 +1064,7 @@ <h3 id="testing-the-implementation">Testing the Implementation</h3>
1064
1064
</section>
1065
1065
1066
1066
<sectionclass="collapsible" id="issues">
1067
+
1067
1068
<h2>Issues With the Original Proposal</h2>
1068
1069
<p>The proposal we have implemented provides a flexible solution by allowing both an <code>update</code> and an <code>insert</code> function. While flexibility is generally a good thing, here it adds unnecessary complexity to the usage of <code>upsert</code>. In other words, flexibility comes here at the expense of simplicity and ease of use which are very important for widespread adoption in programming languages.</p>
1069
1070
<p>The most likely primary, in-demand use case of the <code>upsert</code> method is when a developer wants to check whether a <code>key</code> exists and, if it doesn't, to insert it into the map.
@@ -1268,14 +1269,13 @@ <h3 id="step-5--6---insert-the-new-key-value-pair">Step 5 & 6 - Insert the n
1268
1269
</section>
1269
1270
1270
1271
<sectionclass="collapsible" id="ecmarkup">
1271
-
<h2>Writing the Specification in Ecmarkup</h2>
1272
+
<h2>Rendering the New Specification Text Using _Ecmarkup_</h2>
1272
1273
<divclass="content-body">
1273
-
<p>In this section, we will cover how to install and use Ecmarkup to write specifications for proposals.
1274
-
Ecmarkup is a markup language that is designed for technical specifications.
1275
-
This allows the authors to visualize and format complex algorithms, clauses and terms in a way that is both readable and structured.
1276
-
Regarding JavaScript-proposals, Ecmarkup provides a solid framework to document new algorithms or implementations so they align with the ECMAScript®-standards. </p>
1277
-
<p> We will start with setting up the necessary tools to be able to use Ecmarkup, such as Node.js and Ecmarkup itself.
1278
-
Furthermore, we will check out how to format specification using Ecmarkup before guiding you through how to build your specification into an HTML document. </p>
1274
+
<p>In this section, we will explain how to use <ahref="https://github.com/tc39/ecmarkup"><em>Ecmarkup</em></a>, which is a specialized markup language, to write and format <strong>specification documents</strong> for ECMAScript® and other web standards, so that they align with the formatting of these standards documents.
1275
+
<em>Ecmarkup</em> is specifically designed for technical specifications, and allows authors to visualize and format complex algorithms, clauses and terms in a way that is both readable and structured. If you visit the <ahref="https://tc39.es/ecma262/" target="_blank">ECMA-262 official webpage</a>, you can read the ECMAScript® specification with hyperlinks to used terms, algorithms, and syntax definitions. This enables easy navigation between different sections and components of the specification. These specifications are made with <em>Ecmarkup</em>.</p>
1276
+
<p>We will explain how to install and use <em>Ecmarkup</em> to render proposal specifications, and will write our updated <code>upsert</code> proposal specification using <em>Ecmarkup</em>.
1277
+
We will start with setting up the necessary tools to be able to use <em>Ecmarkup</em>: Node.js and <em>Ecmarkup</em> itself. </p>
1278
+
1279
1279
<ul>
1280
1280
<li><p><strong>Installing Node.js and Node Package Manager</strong></p>
1281
1281
<divclass="tab-container">
@@ -1286,27 +1286,27 @@ <h2>Writing the Specification in Ecmarkup</h2>
<li><p>First go to Node.js official website (<ahref="https://nodejs.org/en">https://nodejs.org/en</a>), and download the Windows Installer (recommended version).</p>
1289
+
<li><p>Download the Windows installer from the <ahref="https://nodejs.org/en">Node.js webpage</a>.</p>
1290
1290
</li>
1291
-
<li><p>Run the installer and follow the instructions (make sure to check the box that says "Automatically install necessary tools").</p>
1291
+
<li><p>Run the installer and follow the instructions. Make sure to check the box that says <i>Automatically install necessary tools</i>.</p>
1292
1292
</li>
1293
-
<li><p>Verify installation by opening Command Prompt and typing:</p>
1293
+
<li><p>Verify the installation by executing the following in the command prompt:</p>
1294
1294
</li>
1295
1295
</ol>
1296
1296
<pre><codeclass="language-sh">node -v
1297
1297
npm -v
1298
1298
</code></pre>
1299
-
<p>This should return the versions of Node.js and npm.</p>
1299
+
<p>This should output the versions of Node.js and npm.</p>
1300
1300
</div>
1301
1301
<divclass="tab-content" id="ecmarkup-mac-tab">
1302
1302
<ol>
1303
1303
<li>Open Terminal</li>
1304
-
<li>Install Node.js via Homebrew by running the following command:</li>
1304
+
<li>Install Node.js via <ahref="https://brew.sh/">Homebrew</a> by running the following command:</li>
1305
1305
</ol>
1306
1306
<pre><codeclass="language-sh">brew install node
1307
1307
</code></pre>
1308
1308
<olstart="3">
1309
-
<li>Verify installation by typing:</li>
1309
+
<li>Verify installation by executing:</li>
1310
1310
</ol>
1311
1311
<pre><codeclass="language-sh">node -v
1312
1312
npm -v
@@ -1315,12 +1315,12 @@ <h2>Writing the Specification in Ecmarkup</h2>
<li>Verify that Ecmarkup has been installed by typing:</li>
1346
+
<li>Verify that <em>Ecmarkup</em> has been installed by executing:</li>
1347
1347
</ol>
1348
1348
<pre><codeclass="language-sh">ecmarkup --version
1349
1349
</code></pre>
1350
-
<p>You have now installed Ecmarkup.</p>
1350
+
<p>You have now successfully installed <em>Ecmarkup</em>.</p>
1351
1351
</li>
1352
1352
</ul>
1353
1353
</li>
1354
-
<li><p><strong>How to write ecmarkup</strong></p>
1355
-
<p>Ecmarkup is a markup language used for writing technical specifications. It has a syntax similar to <code>HTML</code>, making it intuitive for those familiar with web development. Here's a simple example of what an algorithm in a <code>.emu</code> file looks like (<code>.emu</code> is the file ending of an ecmarkup file):</p>
1354
+
<li><p><strong>How to write specifications using Ecmarkup</strong></p>
1355
+
<p><em>Ecmarkup</em>'s syntax is similar to HTML - this makes it intuitive for most web developers.
1356
+
Files written using <em>Ecmakup</em> have extension <code>.emu</code>; here is a simple example of such a file.</p>
<p>When the greaterThanFive method is called, the following steps are taken:</p>
1369
1370
<emu-alg>
1370
1371
1. Let _x_ be _value_.
@@ -1377,28 +1378,48 @@ <h2>Writing the Specification in Ecmarkup</h2>
1377
1378
</emu-alg>
1378
1379
</emu-clause>
1379
1380
</code></pre>
1380
-
<p><strong>Note:</strong> This is just an example of how an Ecmarkup file should be structured. The algorithm itself is illustrative and not a real-world example.</p>
1381
+
<p><ahref="https://bldl.github.io/upsert-tutorial/greaterThanFiveExample-spec/out.html">Here</a> is how this document will look like when "compiled" to an HTML presentation.</p>
1382
+
<p>Please note that this is just an example of how an <em>Ecmarkup</em> file should be structured. The algorithm itself is illustrative and is not a real-world example.</p>
1381
1383
</li>
1382
-
<li><p><strong>How to format spec text using Ecmarkup</strong></p>
1383
-
<p>Formatting spec text using Ecmarkup involves understanding the differences between what each reperesents. ECMAScript® is a scripting language specification, while Ecmarkup is a specialized markup language used to write and format <strong>specification documents</strong> for ECMAScript® and other web standards.</p>
1384
-
<ol>
1385
-
<li><p><strong>Understanding why we need Ecmarkup</strong></p>
1386
-
<p>Ecmarkup combines HTML-like tags with specific syntactic constructs to write formal specifications. If you visit the <ahref="https://tc39.es/ecma262/" target="_blank">TC39 official website</a> for ECMA-262, you can read ECMAScript® with hyperlinks to used terms, algorithms, and syntax definitions, allowing for easy navigation between different sections and components of the specification. These specifications are made with Ecmarkup.</p>
<li><code><emu-alg></code>: Defines an algorithm.</li>
1391
-
<li><code><emu-clause></code>: Defines a clause/section in the specification.</li>
1392
-
<li>Underscores are used to refer to variables (<code>_varname_</code>).</li>
1393
-
<li><code><emu-xref></code>: Link to other sections, clauses or algorithms within the specification.</li>
1394
-
<li><code>*someBoldText*</code>: Make bold text with <code>*</code>.</li>
1395
-
<li>Use double square brackets (<code>[[...]]</code>) when documenting or referring to the internal, hidden mechanisms of objects that are not directly accessible in the JavaScript™ language but are crucial for the implementation and behavior of the object.</li>
1396
-
</ul>
1397
-
</li>
1398
-
</ol>
1384
+
<li><p><strong>How to Format Specification Text Using <em>Ecmarkup</em></strong></p>
1399
1385
</li>
1400
-
<li><p>The function <code>upsert(key, callbackfn)</code> in ecmarkup (can also be found under the spec-folder in this proposal)</p>
<td>when documenting or referring to the internal hidden mechanisms of objects that are not directly accessible in the JavaScript™ language but are crucial for the implementation and behavior of the object</td>
<p>The following is a demonstration of how we can write the new specification of the method <code>upsert(key, callbackfn)</code> using <em>Ecmarkup</em>. </p>
<li><code>spec.emu</code> is the source file where you have written your specification using Ecmarkup.</li>
1434
-
<li><code>out.html</code> is the output file, which is a runnable HTML document.
1435
-
To verify that your specification has been built correctly, simply drag-and-drop the <code>out.html</code> file into a web browser.</li>
1455
+
<li><code>spec.emu</code> is the source file where we have written our specification using <em>Ecmarkup</em>,</li>
1456
+
<li><code>out.html</code> is the output file, which is an HTML document. To verify that our specification has been built correctly, we can open the <ahref="https://bldl.github.io/upsert-tutorial/callbackfn-spec/specCallbackfn.html"><code>out.html</code></a> file in a web browser and visually inspect it.</li>
1436
1457
</ul>
1437
1458
</li>
1438
1459
</ul>
1460
+
<p>Note that you can find the official <em>Ecmarkup</em> user guide <ahref="https://tc39.es/ecmarkup/">here</a>.</p>
0 commit comments