Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample algorithm steps "markdown" #3

Closed
domenic opened this issue Apr 13, 2014 · 5 comments
Closed

Sample algorithm steps "markdown" #3

domenic opened this issue Apr 13, 2014 · 5 comments

Comments

@domenic
Copy link
Member

domenic commented Apr 13, 2014

Here's an idea to get things started:

A promise reject function is an anonymous built-in function that has [[Promise]] and [[AlreadyResolved]] internal slots.

When a promise reject function _F_ is called with argument _reason_, the following steps are taken:

1. Assert: _F_ has a [[Promise]] internal slot whose value is an Object.
1. Let _promise_ be the value of _F_'s [[Promise]] internal slot.
1. Let _alreadyResolved_ by the value of _F_'s [[AlreadyResolved]] internal slot.
1. If _alreadyResolved_.[[value]] is *true*, then return *undefined*.
1. Set _alreadyResolved_.[[value]] to *true*.
1. Return [RejectPromise](_promise_, _reason_).
<p>A promise reject function is an anonymous built-in function that has [[Promise]] and [[AlreadyResolved]] internal slots.</p>

<p>When a promise reject function <var>F</var> is called with argument <var>reason</var>, the following steps are taken:</p>

<ol>
  <li><a href="#sec-algorithm-conventions">Assert</a>: <var>F</var> has a [[Promise]] <a href="#sec-object-internal-methods-and-internal-slots">internal slot</a> whose value is an Object.</li>
  <li>Let <var>promise</var> be the value of <var>F</var>'s [[Promise]] <a href="#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
  <li>Let <var>alreadyResolved</var> by the value of <var>F</var>'s [[AlreadyResolved]] <a href="#sec-object-internal-methods-and-internal-slots">internal slot</a>.</li>
  <li>If <var>alreadyResolved</var>.[[value]] is <b>true</b>, then return <b>undefined</b>.</li>
  <li>Set <var>alreadyResolved</var>.[[value]] to <b>true</b>.</li>
  <li>Return <a href="#sec-rejectpromise">RejectPromise</a>(<var>promise</var>, <var>reason</var>).</li>
</ol>

Notable:

  • _x_ translates to <var>x</var>, not <em>x</em> or <i>x</i>. Variables are by far the most common usage of italics in ES and it makes sense to prioritize them.
  • Use * for <b>, not ** or __. (I am not sure if it should be <b>true</b> or <code>true</code>...). The way Markdown allows * and _ to be used interchangeably is a bit annoying and forces you to type two **s and make sure you are consistent throughout the document. We'd be best off reserving double-punctuation for more rare things.
  • It automatically regonizes "Assert:" and "internal slot" and auto-links those.
  • The syntax [RejectPromise](_promise_, _reason_) tells it to auto-link to RejectPromise. It should be able to automatically figure that out without some kind of anchor; after all #sec-reject-promise was generated from ### RejectPromise ( promise, reason ). This will work best if there are authoring-time tools to check that the auto-linking works correctly.
  • I used 1. for steps, but we could use - or even just a leading ..
@domenic
Copy link
Member Author

domenic commented Apr 13, 2014

Upon reflection I think I would prefer the following mapping for the basic symbol sets, instead of what I have above:

  • _x_ -> <var>x</var>
  • *undefined* -> <code class="value">x</code>
  • "string" -> <code class="string">"string"</code>

@bterlson
Copy link
Member

I'll comment a bit more on the other items in #1, but regarding lists, are you against using *? I think it displays nicely in plaintext and is easy to type...

@bterlson
Copy link
Member

will using MD link syntax get us in trouble with the prevalence of [[internal]] all over? I can imagine if we utter [[foo]](bar) anywhere it would be a problem...

@domenic
Copy link
Member Author

domenic commented Sep 8, 2014

Started https://github.com/domenic/ecmarkdown/ with a tiny subset. Let's move discussion over there so this repo can focus on Ecmarkup?

@domenic
Copy link
Member Author

domenic commented Sep 26, 2014

Moving discussions over to ecmarkdown repo.

@domenic domenic closed this as completed Sep 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants