2018-11-30

Work

1.Submit saas4.1 tests
1.Add crm-privilege script

TC39

Standard Library Proposal
Status: Stage 1
1.Protected namespace

  • "std:foo:bar"
  • "std://foo/bar"
  • std.Foo.Bar

2.Import Semantics
Using a features from the standard library can be done through a regular import from protected namespace:

import { Date } from "std:Date";
import { Date } from "std:Date+2.1.6-alpha.1";

const d = new Date(2018, 7, 1);

3.Generic Functions
The advantage of using regular imports is that it allows the development of more generic functions in the standard library. Examples that could be thought of (and exist in other languages like Python) could be:

  • len
  • map
import { len, map } from "std:builtins";

const ar = [1, 2, 3];
const st = new Set([4, 5, 6, 7]);
const mp = new Map([["e", 8], ["n", 9], ["z", 0], ["o", 1], ["t", 2]);

len(ar); // => 3
len(st); // => 4
len(mp); // => 4

map(ar, (val, idx) => val * 2); // => Array {2, 4, 6}
map(st, (val, idx) => val * 2); // => Set {8, 10, 12, 14}
map(mp, (val, key) => val * 2); // => Map { e: 16, n: 18, z: 0, o: 2 }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,486评论 0 10
  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 2,734评论 0 3
  • 氓之蚩蚩,与我识之。匪来识之,来即我谋。送子涉淇,至于城门。非是良媒,何以为期。 将子无言,暗以为计。朝赠五谷,夕...
    琴汐阅读 425评论 0 0
  • 张宇,从接通电话开始,你就说个不停,一直到你挂掉电话,我都没有来得及说上话。 你和你最喜欢的姑娘吵架了,曾经,你是...
    重剑无锋a阅读 239评论 0 1
  • 自动化养鸡设备主要是由笼养系统、自动化集蛋系统、自动化清粪系统、自动化供料设备、自动化照明系统、环境控制系统装置组...
    养鸡参谋长翁山农夫阅读 3,135评论 0 1