# Foreword
Edge cases! My life as the project editor of the ES6 specification has been all about edge cases. Like most software, the design of a programming language feature is typically driven by specific use cases. But programmers can and often do use language features in novel ways that are well outside the scope of those original use cases. In addition, no language feature stands alone. Every feature potentially interacts with every other feature. Those unexpected uses and feature interactions are the realm of edge cases.
For example, consider a function that has a parameter default value initialization expression that uses the eval function to first declare a local variable that has the same name as a local variable declared in the function body and then returns, as the parameter value, an arrow function that references that name. What happens if code in the function body accesses the parameter value and calls the arrow function? Which variable is accessed? Is there an error that should be detected and reported? It鈥檚 edge cases like this that kept me up at night while ES6 was being designed.
A good language design must at least consider such edge cases. The specification of a massively popular language that will have multiple implementations must pin down what happens for all the edge cases. Otherwise, different implementation of the language will handle edge cases differently and programs won鈥檛 work the same everywhere.
If you really want to understand ES6, you have to understand how each feature works, even when you鈥檙e dealing with unusual situations and edge cases. What sets Axel Rauschmayer鈥檚 Exploring ES6 apart from other books is that it really cares about the inner workings of ECMAScript. It doesn鈥檛 just describe the common use cases that you probably already understand. It digs deep into the semantics and, where necessary, wallows in the edge cases. It explains why features work the way that they work and how they are used in realistic code. Assimilate the material in this book and you will be an ES6 expert.
Allen Wirfs-Brock
ECMAScript 2015 (ES6) Specification Editor
Next: [Preface](ch_preface.html)
- 关于本书
- 目录简介
- 关于这本书你需要知道的
- 序
- 前言
- I 背景
- 1. About ECMAScript 6 (ES6)
- 2. 常见问题:ECMAScript 6
- 3. 一个JavaScript:在 ECMAScript 6 中避免版本化
- 4. 核心ES6特性
- II 数据
- 5. New number and Math features
- 6. 新的字符串特性
- 7. Symbol
- 8. Template literals
- 第9章 变量与作用域
- 第10章 解构
- 第11章 参数处理
- III 模块化
- 12. ECMAScript 6中的可调用实体
- 13. 箭头函数
- 14. 除了类之外的新OOP特性
- 15. 类
- 16. 模块
- IV 集合
- 17. The for-of loop
- 18. New Array features
- 19. Maps and Sets
- 20. 类型化数组
- 21. 可迭代对象和迭代器
- 22. 生成器( Generator )
- V 标准库
- 23. 新的正则表达式特性
- 24. 异步编程 (基础知识)
- 25. 异步编程的Promise
- VI 杂项
- 26. Unicode in ES6
- 27. 尾部调用优化
- 28 用 Proxy 实现元编程
- 29. Coding style tips for ECMAScript 6
- 30. 概述ES6中的新内容
- 注释
- ES5过时了吗?
- ==个人笔记==