Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: docs/language/informal/generic-function-type-alias.md

Issue 2841483003: Added informal generic method syntax and generic function type specs. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | docs/language/informal/generic-method-syntax.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/language/informal/generic-function-type-alias.md
diff --git a/docs/language/informal/generic-function-type-alias.md b/docs/language/informal/generic-function-type-alias.md
new file mode 100644
index 0000000000000000000000000000000000000000..52048b55b7e8eaead65d7a8b893a2847af53c0fa
--- /dev/null
+++ b/docs/language/informal/generic-function-type-alias.md
@@ -0,0 +1,765 @@
+
+
+
+
+
+
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+
Lasse Reichstein Nielsen 2017/04/24 13:02:05 The document has extension .md, but contains HTML.
eernst 2017/04/25 11:57:15 Fixed.
+
+
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-d7b19415c108234b91acac0d0c02091c860993c13687a757ee345cc1ecd3a9d1.css" media="all" rel="stylesheet" />
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-678c6c9fa597e3eabad2135736d58fe40e2ef37d8e272589d7d39d7c1c0f9056.css" media="all" rel="stylesheet" />
+
+
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-537c466d44a69d38c4bd60c2fd2955373ef96d051bd97b2ad30ed039acc97bff.css" media="all" rel="stylesheet" />
+
+
+ <meta name="viewport" content="width=device-width">
+
+ <title>INFORMAL SPECIFICATION: Generic Function Type Alias · GitHub</title>
+ <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
+ <link rel="fluid-icon" href="https://gist.github.com/fluidicon.png" title="GitHub">
+ <meta property="fb:app_id" content="1401488693436528">
+
+
+ <meta content="https://avatars3.githubusercontent.com/u/9606994?v=3&amp;s=400" property="og:image" /><meta content="Gist" property="og:site_name" /><meta content="object" property="og:type" /><meta content="INFORMAL SPECIFICATION: Generic Function Type Alias" property="og:title" /><meta content="https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa" property="og:url" /><meta content="INFORMAL SPECIFICATION: Generic Function Type Alias" property="og:description" />
+
+ <link rel="assets" href="https://assets-cdn.github.com/">
+
+ <meta name="pjax-timeout" content="1000">
+
+ <meta name="request-id" content="CE98:2758B:2C00754:46C66AC:58FDDC27" data-pjax-transient>
+
+
+ <meta name="selected-link" value="gist_code" data-pjax-transient>
+
+ <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
+<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
+ <meta name="google-analytics" content="UA-3769691-4">
+
+<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="gist" name="octolytics-app-id" /><meta content="https://collector.githubapp.com/github-external/browser_event" name="octolytics-event-url" /><meta content="CE98:2758B:2C00754:46C66AC:58FDDC27" name="octolytics-dimension-request_id" />
+<meta content="/&lt;user-name&gt;/&lt;gist-id&gt;" data-pjax-transient="true" name="analytics-location" />
+
+
+
+
+ <meta class="js-ga-set" name="dimension1" content="Logged Out">
+
+
+
+ <meta content="true" name="octolytics-dimension-public" /><meta content="42910666" name="octolytics-dimension-gist_id" /><meta content="ffc7bd281974e9018f10f0cb6cfee4aa" name="octolytics-dimension-gist_name" /><meta content="false" name="octolytics-dimension-anonymous" /><meta content="9606994" name="octolytics-dimension-owner_id" /><meta content="eernstg" name="octolytics-dimension-owner_login" /><meta content="false" name="octolytics-dimension-forked" />
+
+ <meta class="js-ga-set" name="dimension5" content="public">
+ <meta class="js-ga-set" name="dimension6" content="owned">
+ <meta class="js-ga-set" name="dimension7" content="markdown">
+
+
+ <meta name="hostname" content="gist.github.com">
+ <meta name="user-login" content="">
+
+ <meta name="expected-hostname" content="gist.github.com">
+ <meta name="js-proxy-site-detection-payload" content="Zjg3ZjIwNTUyZjZhOWY0NjcxZWQzZDkyOWRmNGE5ZmMxYWE4ZDhhZTQ4NTc3MmFhZjYzNjM2ZmY2MGUwM2Y2MXx7InJlbW90ZV9hZGRyZXNzIjoiMTA0LjEzMi4xODAuMTk4IiwicmVxdWVzdF9pZCI6IkNFOTg6Mjc1OEI6MkMwMDc1NDo0NkM2NkFDOjU4RkREQzI3IiwidGltZXN0YW1wIjoxNDkzMDMxOTc1LCJob3N0IjoiZ2l0aHViLmNvbSJ9">
+
+
+ <meta name="html-safe-nonce" content="641be3c5eee41a088cf23e80ff9618ddc83c8f54">
+
+ <meta http-equiv="x-pjax-version" content="2e017d75c6ea5cb7f0c7e24d0a0382b8">
+
+
+ <link href="/eernstg.atom" rel="alternate" title="atom" type="application/atom+xml">
+
+ <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/gist-67dd5139d22e4e9921ef362b5458f51e5973a20db04a54c9d74116748f852917.css" media="all" rel="stylesheet" />
+
+
+
+
+ <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
+
+ <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
+
+ <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
+ <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
+
+<meta name="theme-color" content="#1e2327">
+
+
+
+ </head>
+
+ <body class="logged-out env-production">
+
+
+
+ <div class="position-relative js-header-wrapper ">
+ <a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>
+ <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
+
+
+
+
+
+
+
+ <div class="header gist-header header-logged-out" role="banner">
+ <div class="container clearfix">
+
+ <a href="/" aria-label="Gist Homepage" class="header-logo-wordmark" data-hotkey="g d">
+ <svg aria-hidden="true" class="octicon octicon-logo-github" height="28" version="1.1" viewBox="0 0 45 16" width="78"><path fill-rule="evenodd" d="M18.53 12.03h-.02c.009 0 .015.01.024.011h.006l-.01-.01zm.004.011c-.093.001-.327.05-.574.05-.78 0-1.05-.36-1.05-.83V8.13h1.59c.09 0 .16-.08.16-.19v-1.7c0-.09-.08-.17-.16-.17h-1.59V3.96c0-.08-.05-.13-.14-.13h-2.16c-.09 0-.14.05-.14.13v2.17s-1.09.27-1.16.28c-.08.02-.13.09-.13.17v1.36c0 .11.08.19.17.19h1.11v3.28c0 2.44 1.7 2.69 2.86 2.69.53 0 1.17-.17 1.27-.22.06-.02.09-.09.09-.16v-1.5a.177.177 0 0 0-.146-.18zm23.696-2.2c0-1.81-.73-2.05-1.5-1.97-.6.04-1.08.34-1.08.34v3.52s.49.34 1.22.36c1.03.03 1.36-.34 1.36-2.25zm2.43-.16c0 3.43-1.11 4.41-3.05 4.41-1.64 0-2.52-.83-2.52-.83s-.04.46-.09.52c-.03.06-.08.08-.14.08h-1.48c-.1 0-.19-.08-.19-.17l.02-11.11c0-.09.08-.17.17-.17h2.13c.09 0 .17.08.17.17v3.77s.82-.53 2.02-.53l-.01-.02c1.2 0 2.97.45 2.97 3.88zm-8.72-3.61H33.84c-.11 0-.17.08-.17.19v5.44s-.55.39-1.3.39-.97-.34-.97-1.09V6.25c0-.09-.08-.17-.17-.17h-2.14c-.09 0-.17.08-.17.17v5.11c0 2.2 1.23 2.75 2.92 2.75 1.39 0 2.52-.77 2.52-.77s.05.39.08.45c.02.05.09.09.16.09h1.34c.11 0 .17-.08.17-.17l.02-7.47c0-.09-.08-.17-.19-.17zm-23.7-.01h-2.13c-.09 0-.17.09-.17.2v7.34c0 .2.13.27.3.27h1.92c.2 0 .25-.09.25-.27V6.23c0-.09-.08-.17-.17-.17zm-1.05-3.38c-.77 0-1.38.61-1.38 1.38 0 .77.61 1.38 1.38 1.38.75 0 1.36-.61 1.36-1.38 0-.77-.61-1.38-1.36-1.38zm16.49-.25h-2.11c-.09 0-.17.08-.17.17v4.09h-3.31V2.6c0-.09-.08-.17-.17-.17h-2.13c-.09 0-.17.08-.17.17v11.11c0 .09.09.17.17.17h2.13c.09 0 .17-.08.17-.17V8.96h3.31l-.02 4.75c0 .09.08.17.17.17h2.13c.09 0 .17-.08.17-.17V2.6c0-.09-.08-.17-.17-.17zM8.81 7.35v5.74c0 .04-.01.11-.06.13 0 0-1.25.89-3.31.89-2.49 0-5.44-.78-5.44-5.92S2.58 1.99 5.1 2c2.18 0 3.06.49 3.2.58.04.05.06.09.06.14L7.94 4.5c0 .09-.09.2-.2.17-.36-.11-.9-.33-2.17-.33-1.47 0-3.05.42-3.05 3.73s1.5 3.7 2.58 3.7c.92 0 1.25-.11 1.25-.11v-2.3H4.88c-.11 0-.19-.08-.19-.17V7.35c0-.09.08-.17.19-.17h3.74c.11 0 .19.08.19.17z"/></svg>
+ <svg aria-hidden="true" class="octicon octicon-logo-gist" height="28" version="1.1" viewBox="0 0 25 16" width="40"><path fill-rule="evenodd" d="M4.7 8.73h2.45v4.02c-.55.27-1.64.34-2.53.34-2.56 0-3.47-2.2-3.47-5.05 0-2.85.91-5.06 3.48-5.06 1.28 0 2.06.23 3.28.73V2.66C7.27 2.33 6.25 2 4.63 2 1.13 2 0 4.69 0 8.03c0 3.34 1.11 6.03 4.63 6.03 1.64 0 2.81-.27 3.59-.64V7.73H4.7v1zm6.39 3.72V6.06h-1.05v6.28c0 1.25.58 1.72 1.72 1.72v-.89c-.48 0-.67-.16-.67-.7v-.02zm.25-8.72c0-.44-.33-.78-.78-.78s-.77.34-.77.78.33.78.77.78.78-.34.78-.78zm4.34 5.69c-1.5-.13-1.78-.48-1.78-1.17 0-.77.33-1.34 1.88-1.34 1.05 0 1.66.16 2.27.36v-.94c-.69-.3-1.52-.39-2.25-.39-2.2 0-2.92 1.2-2.92 2.31 0 1.08.47 1.88 2.73 2.08 1.55.13 1.77.63 1.77 1.34 0 .73-.44 1.42-2.06 1.42-1.11 0-1.86-.19-2.33-.36v.94c.5.2 1.58.39 2.33.39 2.38 0 3.14-1.2 3.14-2.41 0-1.28-.53-2.03-2.75-2.23h-.03zm8.58-2.47v-.86h-2.42v-2.5l-1.08.31v2.11l-1.56.44v.48h1.56v5c0 1.53 1.19 2.13 2.5 2.13.19 0 .52-.02.69-.05v-.89c-.19.03-.41.03-.61.03-.97 0-1.5-.39-1.5-1.34V6.94h2.42v.02-.01z"/></svg>
+</a>
+ <div class="site-search js-site-search" role="search">
+ <div class="header-search" role="search">
+
+<!-- '"` --><!-- </textarea></xmp> --></option></form><form accept-charset="UTF-8" action="/search" class="position-relative" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
+ <label class="header-search-wrapper form-control js-chromeless-input-container">
+ <input type="text"
+ class="form-control js-site-search-focus header-search-input"
+ data-hotkey="s"
+ name="q"
+ placeholder="Search…"
+ tabindex="1"
+ autocorrect="off"
+ autocomplete="off"
+ autocapitalize="off">
+ </label>
+
+</form></div>
+
+ </div>
+ <ul class="header-nav float-left" role="navigation">
+ <li class="header-nav-item">
+ <a href="/discover" class="header-nav-link" data-ga-click="Header, go to all gists, text:all gists">All gists</a>
+ </li>
+
+ <li class="header-nav-item">
+ <a href="https://github.com" class="header-nav-link" data-ga-click="Header, go to GitHub, text:GitHub">GitHub</a>
+ </li>
+ </ul>
+
+ <div class="header-actions" role="navigation">
+ <a href="/join?source=header-gist" class="btn btn-primary" data-ga-click="Header, sign up">Sign up for a GitHub account</a>
+ <a href="https://gist.github.com/auth/github?return_to=gist" class="btn" data-ga-click="Header, sign in">Sign in</a>
+ </div>
+ </div>
+</div>
+
+
+
+ </div>
+
+ <div id="start-of-content" class="accessibility-aid"></div>
+
+ <div id="js-flash-container">
+</div>
+
+
+
+ <div role="main">
+ <div itemscope itemtype="http://schema.org/Code">
+ <div id="gist-pjax-container" class="gist-content-wrapper" data-pjax-container>
+
+
+
+ <div class="gist-detail-intro gist-banner">
+ <div class="container">
+ <a href="/" class="btn btn-outline float-right">Create a gist now</a>
+ <p class="lead">
+ Instantly share code, notes, and snippets.
+ </p>
+ </div>
+ </div>
+
+
+<div class="gisthead pagehead repohead instapaper_ignore readability-menu experiment-repo-nav mb-4">
+ <div class="container">
+
+
+<div class="container repohead-details-container">
+
+ <ul class="pagehead-actions">
+
+
+ <li>
+ <a href="/login?return_to=https%3A%2F%2Fgist.github.com%2Feernstg%2Fffc7bd281974e9018f10f0cb6cfee4aa" aria-label="You must be signed in to star a gist" class="btn btn-sm btn-with-count tooltipped tooltipped-n" rel="nofollow">
+ <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg>
+ Star
+</a>
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/stargazers" aria-label="0 users starred this gist" class="social-count">
+ 0
+</a>
+ </li>
+
+ <li>
+ <a href="/login?return_to=https%3A%2F%2Fgist.github.com%2Feernstg%2Fffc7bd281974e9018f10f0cb6cfee4aa" aria-label="You must be signed in to fork a gist" class="btn btn-sm btn-with-count tooltipped tooltipped-n" rel="nofollow">
+ <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
+ Fork
+</a>
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/forks" aria-label="0 users forked this gist" class="social-count">
+ 0
+</a>
+ </li>
+
+ </ul>
+
+ <h1 class="public css-truncate">
+ <img alt="@eernstg" class="avatar gist-avatar" height="26" src="https://avatars1.githubusercontent.com/u/9606994?v=3&amp;s=52" width="26" />
+ <span class="author"><a href="/eernstg" class="url fn" rel="author"><span itemprop="author">eernstg</span></a></span><!--
+ --><span class="path-divider">/</span><!--
+ --><strong itemprop="name" class="gist-header-title css-truncate-target"><a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa">GenericFunctionTypeAlias.md</a></strong>
+
+ <div class="gist-timestamp">Last active <time-ago datetime="2017-01-04T11:41:57Z">Jan 4, 2017</time-ago></div>
+ </h1>
+</div>
+
+<div class="container gist-file-navigation">
+ <div class="float-right file-navigation-options" data-multiple>
+
+ <div class="file-navigation-option">
+ <input type="hidden" name="protocol_type" value="clone">
+
+ <div class="select-menu js-menu-container js-select-menu">
+ <div class="input-group js-select-button js-zeroclipboard-container">
+ <div class="input-group-button">
+ <button type="button" class="btn btn-sm select-menu-button js-menu-target" data-ga-click="Repository, clone Embed, location:repo overview">
+ Embed
+ </button>
+</div>
+<input type="text" class="form-control input-monospace input-sm js-zeroclipboard-target js-url-field" value="&lt;script src=&quot;https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa.js&quot;&gt;&lt;/script&gt;" aria-label="Clone this repository at &lt;script src=&quot;https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa.js&quot;&gt;&lt;/script&gt;" readonly>
+<div class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg></button>
+</div>
+
+ </div>
+
+ <div class="select-menu-modal-holder">
+ <div class="select-menu-modal js-menu-content">
+ <div class="select-menu-header">
+ <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
+ <span class="select-menu-title">What would you like to do?</span>
+ </div>
+
+ <div class="select-menu-list js-navigation-container" role="menu">
+ <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
+ <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
+ <div class="select-menu-item-text">
+ <input type="radio" name="protocol_selector" value="embed" checked>
+ <span class="select-menu-item-heading">
+
+ Embed
+ </span>
+ <span class="description">
+ Embed this gist in your website.
+ </span>
+ <span class="js-select-button-text hidden-select-button-text">
+ <div class="input-group-button">
+ <button type="button" class="btn btn-sm select-menu-button js-menu-target" data-ga-click="Repository, clone Embed, location:repo overview">
+ Embed
+ </button>
+</div>
+<input type="text" class="form-control input-monospace input-sm js-zeroclipboard-target js-url-field" value="&lt;script src=&quot;https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa.js&quot;&gt;&lt;/script&gt;" aria-label="Clone this repository at &lt;script src=&quot;https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa.js&quot;&gt;&lt;/script&gt;" readonly>
+<div class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg></button>
+</div>
+
+ </span>
+ </div>
+ </div>
+ <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
+ <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
+ <div class="select-menu-item-text">
+ <input type="radio" name="protocol_selector" value="share" >
+ <span class="select-menu-item-heading">
+
+ Share
+ </span>
+ <span class="description">
+ Copy sharable URL for this gist.
+ </span>
+ <span class="js-select-button-text hidden-select-button-text">
+ <div class="input-group-button">
+ <button type="button" class="btn btn-sm select-menu-button js-menu-target" data-ga-click="Repository, clone Share, location:repo overview">
+ Share
+ </button>
+</div>
+<input type="text" class="form-control input-monospace input-sm js-zeroclipboard-target js-url-field" value="https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa" aria-label="Clone this repository at https://gist.github.com/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa" readonly>
+<div class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg></button>
+</div>
+
+ </span>
+ </div>
+ </div>
+ <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
+ <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
+ <div class="select-menu-item-text">
+ <input type="radio" name="protocol_selector" value="http" >
+ <span class="select-menu-item-heading">
+ Clone via
+ HTTPS
+ </span>
+ <span class="description">
+ Clone with Git or checkout with SVN using the repository's web address.
+ </span>
+ <span class="js-select-button-text hidden-select-button-text">
+ <div class="input-group-button">
+ <button type="button" class="btn btn-sm select-menu-button js-menu-target" data-ga-click="Repository, clone HTTPS, location:repo overview">
+ HTTPS
+ </button>
+</div>
+<input type="text" class="form-control input-monospace input-sm js-zeroclipboard-target js-url-field" value="https://gist.github.com/ffc7bd281974e9018f10f0cb6cfee4aa.git" aria-label="Clone this repository at https://gist.github.com/ffc7bd281974e9018f10f0cb6cfee4aa.git" readonly>
+<div class="input-group-button">
+ <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"/></svg></button>
+</div>
+
+ </span>
+ </div>
+ </div>
+ </div>
+ <div class="select-menu-list" role="menu">
+ <a class="select-menu-item select-menu-action" href="https://help.github.com/articles/which-remote-url-should-i-use" target="_blank">
+ <svg aria-hidden="true" class="octicon octicon-question select-menu-item-icon" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M6 10h2v2H6v-2zm4-3.5C10 8.64 8 9 8 9H6c0-.55.45-1 1-1h.5c.28 0 .5-.22.5-.5v-1c0-.28-.22-.5-.5-.5h-1c-.28 0-.5.22-.5.5V7H4c0-1.5 1.5-3 3-3s3 1 3 2.5zM7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7z"/></svg>
+ <div class="select-menu-item-text">
+ Learn more about clone URLs
+ </div>
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+
+ <div class="file-navigation-option">
+</div>
+
+
+ <div class="file-navigation-option">
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/archive/99158a070435c0ef7a13abd49b04de53248ef82b.zip"
+ class="btn btn-sm"
+ rel="nofollow"
+ data-ga-click="Gist, download zip, location:gist overview">
+ Download ZIP
+ </a>
+ </div>
+ </div>
+
+ <div class="float-left">
+ <nav class="reponav js-repo-nav js-sidenav-container-pjax"
+ role="navigation"
+ data-pjax="#gist-pjax-container">
+
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa" aria-label="Code" class="js-selected-navigation-item selected reponav-item" data-hotkey="g c" data-pjax="true" data-selected-links="gist_code /eernstg/ffc7bd281974e9018f10f0cb6cfee4aa">
+ <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg>
+ Code
+</a>
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/revisions" aria-label="Revisions" class="js-selected-navigation-item reponav-item" data-hotkey="g r" data-pjax="true" data-selected-links="gist_revisions /eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/revisions">
+ <svg aria-hidden="true" class="octicon octicon-git-commit" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"/></svg>
+ Revisions
+ <span class="Counter">35</span>
+</a>
+
+</nav>
+
+ </div>
+</div>
+
+
+ </div>
+</div>
+
+<div class="container new-discussion-timeline experiment-repo-nav">
+ <div class="repository-content gist-content">
+
+ <div>
+ <div class="repository-meta js-details-container Details">
+ <div class="repository-meta-content" itemprop="about">
+ INFORMAL SPECIFICATION: Generic Function Type Alias
+ </div>
+</div>
+
+
+ <div class="js-gist-file-update-container js-task-list-container file-box">
+ <div id="file-genericfunctiontypealias-md" class="file">
+ <div class="file-header">
+ <div class="file-actions">
+
+ <a href="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/raw/99158a070435c0ef7a13abd49b04de53248ef82b/GenericFunctionTypeAlias.md" class="btn btn-sm ">Raw</a>
+ </div>
+ <div class="file-info">
+ <span class="icon">
+ <svg aria-hidden="true" class="octicon octicon-gist" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.5 5L10 7.5 7.5 10l-.75-.75L8.5 7.5 6.75 5.75 7.5 5zm-3 0L2 7.5 4.5 10l.75-.75L3.5 7.5l1.75-1.75L4.5 5zM0 13V2c0-.55.45-1 1-1h10c.55 0 1 .45 1 1v11c0 .55-.45 1-1 1H1c-.55 0-1-.45-1-1zm1 0h10V2H1v11z"/></svg>
+ </span>
+ <a class="tooltipped tooltipped-s css-truncate" aria-label="Permalink" href="#file-genericfunctiontypealias-md">
+ <strong class="user-select-contain gist-blob-name css-truncate-target">
+ GenericFunctionTypeAlias.md
+ </strong>
+ </a>
+ </div>
+ </div>
+
+ <div id="readme" class="readme blob instapaper_body">
+ <article class="markdown-body entry-content" itemprop="text"><h1><a id="user-content-feature-generic-function-type-alias" class="anchor" href="#feature-generic-function-type-alias" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Feature: Generic Function Type Alias</h1>
+<p><strong>Status</strong>: Under implementation.</p>
+<p><strong>This document</strong> is an informal specification of a feature supporting the
+definition of function type aliases using a more expressive syntax than the
+one available today, such that it also covers generic function types. The
+feature also introduces syntax for specifying function types directly, such
+that they can be used in type annotations etc. without going via a
+<code>typedef</code>. This feature is being introduced into Dart starting Q4, 2016.</p>
+<p><strong>This feature</strong> introduces a new syntactic form of typedef declaration
+which includes an identifier and a type, connecting the two with an equals
+sign, <code>=</code>. The effect of such a declaration is that the name is declared to
+be an alias for the type. Type parameterization may occur in the
+declaration itself, as well as in the declared type. This feature also
+introduces syntax for specifying function types directly, using a syntax
+which is similar to the header of a function declaration.</p>
+<p>The <strong>motivation</strong> for adding this feature is that it allows developers to
+specify generic function types everywhere a type is expected, including
+type annotations, return types, actual type arguments, and formal type
+parameter bounds. Currently there is no way to specify a generic function
+type in these situations. Even in the case where a generic function type
+<em>can</em> be specified (such as a type annotation for a formal parameter) it
+may be useful for readability to declare a name as an alias of a complex
+type, and use that name instead of the type.</p>
+<h2><a id="user-content-examples" class="anchor" href="#examples" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Examples</h2>
+<p>Using the new syntax, a function type alias may be declared as follows:</p>
+<div class="highlight highlight-source-dart"><pre><span class="pl-k">typedef</span> F = List&lt;T&gt; Function&lt;T&gt;(T);</pre></div>
+<p>This declares <code>F</code> to be the type of a function that accepts one type
+parameter <code>T</code> and one value parameter of type <code>T</code> whose name is
+unspecified, and returns a result of type <code>List&lt;T&gt;</code>. It is possible to use
+the new syntax to declare function types that we can already declare using
+the existing typedef declaration. For instance, <code>G</code> and <code>H</code> both declare
+the same type:</p>
+<div class="highlight highlight-source-dart"><pre><span class="pl-k">typedef</span> G = List&lt;int&gt; Function(<span class="pl-k">int</span>); <span class="pl-c">// New form.</span>
+<span class="pl-k">typedef</span> List&lt;int&gt; H(<span class="pl-k">int</span> i); <span class="pl-c">// Old form.</span></pre></div>
+<p>Note that the name of the parameter is required in the old form, but the
+type may be omitted. In contrast, the type is required in the new form, but
+the name may be omitted.</p>
+<p>The reason for having two ways to express the same thing is that the new
+form seamlessly covers non-generic functions as well as generic ones, and
+developers might prefer to use the new form everywhere, for improved
+readability.</p>
+<p><em>We may deprecate the old form after a while, or we may choose
+to keep it, because it is more concise. We may even change the old form to
+allow omitting the name and not the type when only one identifier is
+specified, if this is not too much of a breaking change. As an intermediate
+step we could change the old form to always require both the type and the
+name, such that no type expressions will silently change meaning.</em></p>
+<p>There is a difference between declaring a generic function type and
+declaring a typedef which takes a type argument. The former is a
+declaration of a single type which describes a certain class of runtime
+entities: Functions that are capable of accepting some type arguments as
+well as some value arguments, both at runtime. The latter is a type-level
+function: It accepts a type argument at compile time and returns a type,
+which may be used, say, as a type annotation. Dart has had support for
+parameterized typedefs for a while, and the new syntax supports
+parameterized typedefs as well. Here is an example of a parameterized
+typedef, and a usage thereof:</p>
+<div class="highlight highlight-source-dart"><pre><span class="pl-k">typedef</span> I&lt;T&gt; = List&lt;T&gt; Function(T); <span class="pl-c">// New form.</span>
+<span class="pl-k">typedef</span> List&lt;T&gt; J&lt;T&gt;(T t); <span class="pl-c">// Old form.</span>
+I<span class="pl-k">&lt;</span><span class="pl-k">int</span><span class="pl-k">&gt;</span> myFunction(J<span class="pl-k">&lt;</span><span class="pl-k">int</span><span class="pl-k">&gt;</span> f) <span class="pl-k">=</span><span class="pl-k">&gt;</span> f;</pre></div>
+<p>Here, we have declared two equivalent parameterized typedefs <code>I</code> and <code>J</code>,
+and we have used an instantiation of each of them in the type annotations
+on <code>myFunction</code>. Note that the type of <code>myFunction</code> does not include <em>any</em>
+generic types, it is just a function that accepts an argument and returns a
+result, both of which have a non-generic function type that we have
+obtained by instantiating a parameterized typedef. The argument type might
+as well have been declared using the traditional function signature syntax,
+and the return type (and the argument type, by the way) might as well have
+been declared using a regular, non-parameterized typedef:</p>
+<div class="highlight highlight-source-dart"><pre><span class="pl-k">typedef</span> List&lt;int&gt; K(<span class="pl-k">int</span> i); <span class="pl-c">// Old form, non-generic.</span>
+K myFunction2(<span class="pl-k">List</span><span class="pl-k">&lt;</span><span class="pl-k">int</span><span class="pl-k">&gt;</span> f(<span class="pl-k">int</span> i)) <span class="pl-k">=</span><span class="pl-k">&gt;</span> f; <span class="pl-c">// Same as myFunction.</span></pre></div>
+<p>The new syntax allows for using the two kinds of type parameters together:</p>
+<div class="highlight highlight-source-dart"><pre><span class="pl-k">typedef</span> L&lt;T&gt; = List&lt;T&gt; Function&lt;S&gt;(S, {T Function(<span class="pl-k">int</span>, S) factory});</pre></div>
+<p>This declares <code>L</code> to be a parameterized typedef; when instantiating <code>L</code>
+with an actual type argument as in <code>L&lt;String&gt;</code>, it becomes the type of a
+generic function that accepts a type argument <code>S</code> and two value arguments:
+one required positional argument of type <code>S</code>, and one named optional
+argument with name <code>factory</code> and type <code>String Function(int, S)</code>; finally,
+it returns a value of type <code>List&lt;String&gt;</code>.</p>
+<h2><a id="user-content-syntax" class="anchor" href="#syntax" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Syntax</h2>
+<p>The new form of <code>typedef</code> declaration uses the following syntax (there are
+no deletions from the grammar; addition of a new rule or a new alternative
+in a rule is marked with NEW and modified rules are marked CHANGED):</p>
+<pre><code>typeAlias:
+ metadata 'typedef' typeAliasBody |
+ metadata 'typedef' identifier typeParameters? '=' functionType ';' // NEW
+functionType: // NEW
+ returnType? 'Function' typeParameters? parameterTypeList
+parameterTypeList: // NEW
+ '(' ')' |
+ '(' normalParameterTypes ','? ')' |
+ '(' normalParameterTypes ',' optionalParameterTypes ')' |
+ '(' optionalParameterTypes ')'
+normalParameterTypes: // NEW
+ normalParameterType (',' normalParameterType)*
+normalParameterType: // NEW
+ type | typedIdentifier
+optionalParameterTypes: // NEW
+ optionalPositionalParameterTypes | namedParameterTypes
+optionalPositionalParameterTypes: // NEW
+ '[' normalParameterTypes ','? ']'
+namedParameterTypes: // NEW
+ '{' typedIdentifier (',' typedIdentifier)* ','? '}'
+typedIdentifier: // NEW
+ type identifier
+type: // CHANGED
+ typeWithoutFunction |
+ functionType
+typeWithoutFunction: // NEW
+ typeName typeArguments?
+typeWithoutFunctionList: // NEW
+ typeWithoutFunction (',' typeWithoutFunction)*
+mixins: // CHANGED
+ 'with' typeWithoutFunctionList
+interfaces: // CHANGED
+ 'implements' typeWithoutFunctionList
+superclass: // CHANGED
+ 'extends' typeWithoutFunction
+mixinApplication: // CHANGED
+ typeWithoutFunction mixins interfaces?
+newExpression: // CHANGED
+ 'new' typeWithoutFunction ('.' identifier)? arguments
+constObjectExpression: // CHANGED
+ 'const' typeWithoutFunction ('.' identifier)? arguments
+redirectingFactoryConstructorSignature: // CHANGED
+ 'const'? 'factory' identifier ('.' identifier)?
+ formalParameterList '=' typeWithoutFunction ('.' identifier)?
+</code></pre>
+<p>The syntax relies on treating <code>Function</code> as a fixed element in a function
+type, similar to a keyword or a symbol (many languages use symbols like
+<code>-&gt;</code> to mark function types).</p>
+<p><em>The rationale for using this form is that it makes a function type very
+similar to the header in a declaration of a function with that type: Just
+replace <code>Function</code> by the name of the function, and add missing parameter
+names and default values.</em></p>
+<p><em>The syntax differs from the existing function type syntax
+(<code>functionSignature</code>) in that the existing syntax allows the type of a
+parameter to be omitted, but the new syntax allows parameter names to be
+omitted. The rationale for this change is that a function type where a
+parameter has a specified name and no type is very likely to be a
+mistake. For instance, <code>int Function(int)</code> should not be the type of a
+function that accepts an argument named "int" of type <code>dynamic</code>, it should
+specify <code>int</code> as the parameter type and allow the name to be
+unspecified. It is still possible to opt in and specify the parameter name,
+which may be useful as documentation, e.g., if several arguments have the
+same type.</em></p>
+<p>The modification of the rule for the nonterminal <code>type</code> may cause parsing
+ambiguities. We intend to handle them by the following disambiguation rule
+in the parser: If the parser is at a location L where the tokens starting
+at L may be a <code>type</code> or some other construct (e.g., in the body of a
+method, when parsing something that may be a statement and may also be a
+declaration), the parser can commit to parsing a type by detecting that it
+is looking at the identifier <code>Function</code> followed by <code>&lt;</code> or <code>(</code>, or that it
+is looking at a type followed by the identifier <code>Function</code> followed by <code>&lt;</code>
+or <code>(</code>.</p>
+<p><em>Note that this disambiguation rule does require parsers to have unlimited
+lookahead. However, if a "diet parsing" strategy is used where the token
+stream already contains references from each opening bracket (such as <code>&lt;</code>
+or <code>(</code>) to the corresponding closing bracket then the decision can be
+taken in a fixed number of steps: If the current token is <code>Function</code> then
+check the immediate successor (<code>&lt;</code> or <code>(</code> means yes, we are looking at
+a <code>type</code>, everything else means no) and we're done; if the first token is
+an <code>identifier</code> other than <code>Function</code> then we can check whether it is a
+<code>qualified</code> by looking at no more than the two next tokens, and we may then
+check whether the next token again is <code>&lt;</code>; if it is not then we look for
+<code>Function</code> and the token after that, and if it is <code>&lt;</code> then look for the
+corresponding <code>&gt;</code> (we have now skipped a generic class type), and then
+the successor to that token again must be <code>Function</code>, and we finally check
+its successor (looking for <code>&lt;</code> or <code>(</code> again). This skips over the
+presumed type arguments to a generic class type without checking that they
+are actually type arguments, but we conjecture that there are no
+syntactically correct alternatives (for example, we conjecture that there
+is no syntactically correct statement, not a declaration, starting with
+<code>SomeIdentifier&lt;...&gt; Function(...</code> where the angle brackets are balanced).</em></p>
+<p><em>Note that this disambiguation rule will prevent parsing some otherwise
+correct programs. For instance, the declaration of an asynchronous function
+named <code>Function</code> with an omitted return type (meaning <code>dynamic</code>) and an
+argument named <code>int</code> of type <code>dynamic</code> using <code>Function(int) async {}</code> will
+be a parse error, because the parser will commit to parsing a type after
+having seen "<code>Function(</code>" as a lookahead. However, we do not expect that it
+will be a serious problem for developers to be unable to write such
+programs.</em></p>
+<h2><a id="user-content-scoping" class="anchor" href="#scoping" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Scoping</h2>
+<p>Consider a typedef declaration as introduced by this feature, i.e., a
+construct on the form</p>
+<pre><code>metadata 'typedef' identifier typeParameters? '=' functionType ';'
+</code></pre>
+<p>This declaration introduces <code>identifier</code> into the enclosing library scope.</p>
+<p>Consider a parameterized typedef, i.e., a construct on the form</p>
+<pre><code>metadata 'typedef' identifier typeParameters '=' functionType ';'
+</code></pre>
+<p>Note that in this case the <code>typeParameters</code> are present, not optional. This
+construct introduces a scope known as the <em>typedef scope</em>. Each typedef
+scope is nested inside the library scope of the enclosing library. Every
+formal type parameter declared by the <code>typeParameters</code> in this construct
+introduces a type variable into its enclosing typedef scope. The typedef
+scope is the current scope for the <code>typeParameters</code> themselves, and for the
+<code>functionType</code>.</p>
+<p>Consider a <code>functionType</code> specifying a generic function type, i.e., a
+construct on the form</p>
+<pre><code>returnType? 'Function' typeParameters parameterTypeList
+</code></pre>
+<p>Note again that <code>typeParameters</code> are present, not optional. This construct
+introduces a scope known as a <em>function type scope</em>. The function type
+scope is nested inside the current scope for the associated <code>functionType</code>.
+Every formal type parameter declared by the <code>typeParameters</code> introduces a
+type variable into its enclosing function type scope. The function type
+scope is the current scope for the entire <code>functionType</code>.</p>
+<p><em>This implies that parameterized typedefs and function types are capable of
+specifying F-bounded type parameters, because the type parameters are in
+scope in the type parameter list itself.</em></p>
+<h2><a id="user-content-static-analysis" class="anchor" href="#static-analysis" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Static Analysis</h2>
+<p>Consider a typedef declaration as introduced by this feature, i.e., a
+construct on the form</p>
+<pre><code>metadata 'typedef' identifier typeParameters? '=' functionType ';'
+</code></pre>
+<p>It is a compile-time error if a name <em>N</em> introduced into a library scope by
+a typedef has an associated <code>functionType</code> which depends directly or
+indirectly on <em>N</em>. It is a compile-time error if a bound on a formal type
+parameter in <code>typeParameters</code> is not a type. It is a compile-time error if
+a typedef has an associated <code>functionType</code> which is not a type when
+analyzed under the assumption that every identifier resolving to a formal
+type parameter in <code>typeParameters</code> is a type. It is a compile-time error if
+an instantiation <em>F&lt;T1..Tk&gt;</em> of a parameterized typedef is mal-bounded.</p>
+<p><em>This implies that a typedef cannot be recursive. It can only introduce a
+name as an alias for a type which is already expressible as a
+<code>functionType</code>, or a name for a type-level function F where every
+well-bounded invocation <code>F&lt;T1..Tk&gt;</code> denotes a type which could be expressed
+as a <code>functionType</code>. Following
+<a href="https://en.wikipedia.org/wiki/Kind_(type_theory)">common terminology</a>, we
+could say that a typedef can define entities of kind <code>*</code> and of kind
+<code>* -&gt; *</code>, and, when it is assumed that every formal type parameter of the
+typedef (if any) has kind <code>*</code>, it is an error if the right hand side of the
+declaration denotes an entity of any other kind than <code>*</code>; in particular,
+declarations of entities of kind <code>* -&gt; *</code> cannot be curried.</em></p>
+<p>It is a compile-time error if a name declared in a typedef, with or without
+actual type arguments, is used as a superclass, superinterface, or mixin.</p>
+<h2><a id="user-content-dynamic-semantics" class="anchor" href="#dynamic-semantics" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Dynamic Semantics</h2>
+<p>The addition of this feature does not change the dynamic semantics of
+Dart.</p>
+<h2><a id="user-content-changes" class="anchor" href="#changes" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Changes</h2>
+<p>2017-Jan-04: Adjusted the grammar to require named parameter types to have
+a type (previously, the type was optional).</p>
+<p>2016-Dec-21: Changed the grammar to prevent the new function type syntax
+in several locations (for instance, as a super class or as a mixin). The
+main change in the grammar is the introduction of <code>typeWithoutFunction</code>.</p>
+<p>2016-Dec-15: Changed the grammar to prevent the old style function types
+(derived from <code>functionSignature</code> in the grammar) from occurring inside
+the new style (<code>functionType</code>).</p>
+</article>
+ </div>
+
+ </div>
+
+</div>
+
+
+ <a name="comments"></a>
+ <div class="discussion-timeline gist-discussion-timeline js-quote-selection-container ">
+ <div class="js-discussion js-socket-channel" data-channel="marked-as-read:gist:42910666">
+
+
+
+
+
+<!-- Rendered timeline since 2017-01-04 03:41:57 -->
+<div id="partial-timeline-marker"
+ class="js-timeline-marker js-updatable-content"
+ data-url="/eernstg/ffc7bd281974e9018f10f0cb6cfee4aa/show_partial?partial=gist%2Ftimeline_marker&amp;since=1483530117"
+ data-last-modified="Wed, 04 Jan 2017 11:41:57 GMT"
+ >
+</div>
+
+
+ <div class="discussion-timeline-actions">
+ <div class="flash flash-warn mt-3">
+ <a href="/join?source=comment-gist" class="btn btn-primary" rel="nofollow">Sign up for free</a>
+ <strong>to join this conversation on GitHub</strong>.
+ Already have an account?
+ <a href="/login?return_to=https%3A%2F%2Fgist.github.com%2Feernstg%2Fffc7bd281974e9018f10f0cb6cfee4aa" rel="nofollow">Sign in to comment</a>
+</div>
+
+ </div>
+ </div>
+ </div>
+</div>
+ </div>
+
+ <div class="modal-backdrop js-touch-events"></div>
+</div><!-- /.container -->
+
+ </div>
+ </div>
+
+ </div>
+
+ <div class="container site-footer-container">
+ <div class="site-footer" role="contentinfo">
+ <ul class="site-footer-links float-right">
+ <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
+ <li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li>
+ <li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li>
+ <li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li>
+ <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
+ <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li>
+
+ </ul>
+
+ <a href="https://github.com" aria-label="Homepage" class="site-footer-mark" title="GitHub">
+ <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
+</a>
+ <ul class="site-footer-links">
+ <li>&copy; 2017 <span title="0.21418s from github-fe134-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
+ <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
+ <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
+ <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
+ <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
+ <li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li>
+ </ul>
+ </div>
+</div>
+
+
+
+
+
+ <div id="ajax-error-message" class="ajax-error-message flash flash-error">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
+ <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
+ </button>
+ You can't perform that action at this time.
+ </div>
+
+
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-8a4318ffea09a0cdb8214b76cf2926b9f6a0ced318a317bed419db19214c690d.js"></script>
+ <script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-6d109e75ad8471ba415082726c00c35fb929ceab975082492835f11eca8c07d9.js"></script>
+ <script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-55316b70ec9eb5a4dd5cd168f8f8da4d5fe20c53564512dd5aace9898aed70c5.js"></script>
+
+
+
+
+ <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
+ <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>
+ <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
+ </div>
+ <div class="facebox" id="facebox" style="display:none;">
+ <div class="facebox-popup">
+ <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
+ </div>
+ <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal">
+ <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
+ </button>
+ </div>
+</div>
+
+
+ </body>
+</html>
+
« no previous file with comments | « no previous file | docs/language/informal/generic-method-syntax.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698