From 99ebbd95bfc0f98d8402b5d94a5cacbc37a8f19b Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 18:27:20 +0300 Subject: [PATCH 01/24] Create greek files directory --- .gitignore | 1 + el/License.md | 21 ++ el/README.md | 576 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 598 insertions(+) create mode 100644 .gitignore create mode 100644 el/License.md create mode 100644 el/README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/el/License.md b/el/License.md new file mode 100644 index 0000000..1fdcde9 --- /dev/null +++ b/el/License.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Luke Hoban + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/el/README.md b/el/README.md new file mode 100644 index 0000000..eb4307f --- /dev/null +++ b/el/README.md @@ -0,0 +1,576 @@ +# ECMAScript 6 [git.io/es6features](http://git.io/es6features) + +## Introduction +ECMAScript 6, also known as ECMAScript 2015, is the latest version of the ECMAScript standard. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009. Implementation of these features in major JavaScript engines is [underway now](http://kangax.github.io/es5-compat-table/es6/). + +See the [ES6 standard](http://www.ecma-international.org/ecma-262/6.0/) for full specification of the ECMAScript 6 language. + +ES6 includes the following new features: +- [arrows](#arrows) +- [classes](#classes) +- [enhanced object literals](#enhanced-object-literals) +- [template strings](#template-strings) +- [destructuring](#destructuring) +- [default + rest + spread](#default--rest--spread) +- [let + const](#let--const) +- [iterators + for..of](#iterators--forof) +- [generators](#generators) +- [unicode](#unicode) +- [modules](#modules) +- [module loaders](#module-loaders) +- [map + set + weakmap + weakset](#map--set--weakmap--weakset) +- [proxies](#proxies) +- [symbols](#symbols) +- [subclassable built-ins](#subclassable-built-ins) +- [promises](#promises) +- [math + number + string + array + object APIs](#math--number--string--array--object-apis) +- [binary and octal literals](#binary-and-octal-literals) +- [reflect api](#reflect-api) +- [tail calls](#tail-calls) + +## ECMAScript 6 Features + +### Arrows +Arrows are a function shorthand using the `=>` syntax. They are syntactically similar to the related feature in C#, Java 8 and CoffeeScript. They support both statement block bodies as well as expression bodies which return the value of the expression. Unlike functions, arrows share the same lexical `this` as their surrounding code. + +```JavaScript +// Expression bodies +var odds = evens.map(v => v + 1); +var nums = evens.map((v, i) => v + i); +var pairs = evens.map(v => ({even: v, odd: v + 1})); + +// Statement bodies +nums.forEach(v => { + if (v % 5 === 0) + fives.push(v); +}); + +// Lexical this +var bob = { + _name: "Bob", + _friends: [], + printFriends() { + this._friends.forEach(f => + console.log(this._name + " knows " + f)); + } +} +``` + +### Classes +ES6 classes are a simple sugar over the prototype-based OO pattern. Having a single convenient declarative form makes class patterns easier to use, and encourages interoperability. Classes support prototype-based inheritance, super calls, instance and static methods and constructors. + +```JavaScript +class SkinnedMesh extends THREE.Mesh { + constructor(geometry, materials) { + super(geometry, materials); + + this.idMatrix = SkinnedMesh.defaultMatrix(); + this.bones = []; + this.boneMatrices = []; + //... + } + update(camera) { + //... + super.update(); + } + get boneCount() { + return this.bones.length; + } + set matrixType(matrixType) { + this.idMatrix = SkinnedMesh[matrixType](); + } + static defaultMatrix() { + return new THREE.Matrix4(); + } +} +``` + +### Enhanced Object Literals +Object literals are extended to support setting the prototype at construction, shorthand for `foo: foo` assignments, defining methods, making super calls, and computing property names with expressions. Together, these also bring object literals and class declarations closer together, and let object-based design benefit from some of the same conveniences. + +```JavaScript +var obj = { + // __proto__ + __proto__: theProtoObj, + // Shorthand for ‘handler: handler’ + handler, + // Methods + toString() { + // Super calls + return "d " + super.toString(); + }, + // Computed (dynamic) property names + [ 'prop_' + (() => 42)() ]: 42 +}; +``` + +### Template Strings +Template strings provide syntactic sugar for constructing strings. This is similar to string interpolation features in Perl, Python and more. Optionally, a tag can be added to allow the string construction to be customized, avoiding injection attacks or constructing higher level data structures from string contents. + +```JavaScript +// Basic literal string creation +`In JavaScript '\n' is a line-feed.` + +// Multiline strings +`In JavaScript this is + not legal.` + +// String interpolation +var name = "Bob", time = "today"; +`Hello ${name}, how are you ${time}?` + +// Construct an HTTP request prefix is used to interpret the replacements and construction +GET`http://foo.org/bar?a=${a}&b=${b} + Content-Type: application/json + X-Credentials: ${credentials} + { "foo": ${foo}, + "bar": ${bar}}`(myOnReadyStateChangeHandler); +``` + +### Destructuring +Destructuring allows binding using pattern matching, with support for matching arrays and objects. Destructuring is fail-soft, similar to standard object lookup `foo["bar"]`, producing `undefined` values when not found. + +```JavaScript +// list matching +var [a, , b] = [1,2,3]; + +// object matching +var { op: a, lhs: { op: b }, rhs: c } + = getASTNode() + +// object matching shorthand +// binds `op`, `lhs` and `rhs` in scope +var {op, lhs, rhs} = getASTNode() + +// Can be used in parameter position +function g({name: x}) { + console.log(x); +} +g({name: 5}) + +// Fail-soft destructuring +var [a] = []; +a === undefined; + +// Fail-soft destructuring with defaults +var [a = 1] = []; +a === 1; +``` + +### Default + Rest + Spread +Callee-evaluated default parameter values. Turn an array into consecutive arguments in a function call. Bind trailing parameters to an array. Rest replaces the need for `arguments` and addresses common cases more directly. + +```JavaScript +function f(x, y=12) { + // y is 12 if not passed (or passed as undefined) + return x + y; +} +f(3) == 15 +``` +```JavaScript +function f(x, ...y) { + // y is an Array + return x * y.length; +} +f(3, "hello", true) == 6 +``` +```JavaScript +function f(x, y, z) { + return x + y + z; +} +// Pass each elem of array as argument +f(...[1,2,3]) == 6 +``` + +### Let + Const +Block-scoped binding constructs. `let` is the new `var`. `const` is single-assignment. Static restrictions prevent use before assignment. + + +```JavaScript +function f() { + { + let x; + { + // okay, block scoped name + const x = "sneaky"; + // error, const + x = "foo"; + } + // error, already declared in block + let x = "inner"; + } +} +``` + +### Iterators + For..Of +Iterator objects enable custom iteration like CLR IEnumerable or Java Iterable. Generalize `for..in` to custom iterator-based iteration with `for..of`. Don’t require realizing an array, enabling lazy design patterns like LINQ. + +```JavaScript +let fibonacci = { + [Symbol.iterator]() { + let pre = 0, cur = 1; + return { + next() { + [pre, cur] = [cur, pre + cur]; + return { done: false, value: cur } + } + } + } +} + +for (var n of fibonacci) { + // truncate the sequence at 1000 + if (n > 1000) + break; + console.log(n); +} +``` + +Iteration is based on these duck-typed interfaces (using [TypeScript](http://typescriptlang.org) type syntax for exposition only): +```TypeScript +interface IteratorResult { + done: boolean; + value: any; +} +interface Iterator { + next(): IteratorResult; +} +interface Iterable { + [Symbol.iterator](): Iterator +} +``` + +### Generators +Generators simplify iterator-authoring using `function*` and `yield`. A function declared as function* returns a Generator instance. Generators are subtypes of iterators which include additional `next` and `throw`. These enable values to flow back into the generator, so `yield` is an expression form which returns a value (or throws). + +Note: Can also be used to enable ‘await’-like async programming, see also ES7 `await` proposal. + +```JavaScript +var fibonacci = { + [Symbol.iterator]: function*() { + var pre = 0, cur = 1; + for (;;) { + var temp = pre; + pre = cur; + cur += temp; + yield cur; + } + } +} + +for (var n of fibonacci) { + // truncate the sequence at 1000 + if (n > 1000) + break; + console.log(n); +} +``` + +The generator interface is (using [TypeScript](http://typescriptlang.org) type syntax for exposition only): + +```TypeScript +interface Generator extends Iterator { + next(value?: any): IteratorResult; + throw(exception: any); +} +``` + +### Unicode +Non-breaking additions to support full Unicode, including new Unicode literal form in strings and new RegExp `u` mode to handle code points, as well as new APIs to process strings at the 21bit code points level. These additions support building global apps in JavaScript. + +```JavaScript +// same as ES5.1 +"𠮷".length == 2 + +// new RegExp behaviour, opt-in ‘u’ +"𠮷".match(/./u)[0].length == 2 + +// new form +"\u{20BB7}"=="𠮷"=="\uD842\uDFB7" + +// new String ops +"𠮷".codePointAt(0) == 0x20BB7 + +// for-of iterates code points +for(var c of "𠮷") { + console.log(c); +} +``` + +### Modules +Language-level support for modules for component definition. Codifies patterns from popular JavaScript module loaders (AMD, CommonJS). Runtime behaviour defined by a host-defined default loader. Implicitly async model – no code executes until requested modules are available and processed. + +```JavaScript +// lib/math.js +export function sum(x, y) { + return x + y; +} +export var pi = 3.141593; +``` +```JavaScript +// app.js +import * as math from "lib/math"; +alert("2π = " + math.sum(math.pi, math.pi)); +``` +```JavaScript +// otherApp.js +import {sum, pi} from "lib/math"; +alert("2π = " + sum(pi, pi)); +``` + +Some additional features include `export default` and `export *`: + +```JavaScript +// lib/mathplusplus.js +export * from "lib/math"; +export var e = 2.71828182846; +export default function(x) { + return Math.log(x); +} +``` +```JavaScript +// app.js +import ln, {pi, e} from "lib/mathplusplus"; +alert("2π = " + ln(e)*pi*2); +``` + +### Module Loaders +Module loaders support: +- Dynamic loading +- State isolation +- Global namespace isolation +- Compilation hooks +- Nested virtualization + +The default module loader can be configured, and new loaders can be constructed to evaluate and load code in isolated or constrained contexts. + +```JavaScript +// Dynamic loading – ‘System’ is default loader +System.import('lib/math').then(function(m) { + alert("2π = " + m.sum(m.pi, m.pi)); +}); + +// Create execution sandboxes – new Loaders +var loader = new Loader({ + global: fixup(window) // replace ‘console.log’ +}); +loader.eval("console.log('hello world!');"); + +// Directly manipulate module cache +System.get('jquery'); +System.set('jquery', Module({$: $})); // WARNING: not yet finalized +``` + +### Map + Set + WeakMap + WeakSet +Efficient data structures for common algorithms. WeakMaps provides leak-free object-key’d side tables. + +```JavaScript +// Sets +var s = new Set(); +s.add("hello").add("goodbye").add("hello"); +s.size === 2; +s.has("hello") === true; + +// Maps +var m = new Map(); +m.set("hello", 42); +m.set(s, 34); +m.get(s) == 34; + +// Weak Maps +var wm = new WeakMap(); +wm.set(s, { extra: 42 }); +wm.size === undefined + +// Weak Sets +var ws = new WeakSet(); +ws.add({ data: 42 }); +// Because the added object has no other references, it will not be held in the set +``` + +### Proxies +Proxies enable creation of objects with the full range of behaviors available to host objects. Can be used for interception, object virtualization, logging/profiling, etc. + +```JavaScript +// Proxying a normal object +var target = {}; +var handler = { + get: function (receiver, name) { + return `Hello, ${name}!`; + } +}; + +var p = new Proxy(target, handler); +p.world === 'Hello, world!'; +``` + +```JavaScript +// Proxying a function object +var target = function () { return 'I am the target'; }; +var handler = { + apply: function (receiver, ...args) { + return 'I am the proxy'; + } +}; + +var p = new Proxy(target, handler); +p() === 'I am the proxy'; +``` + +There are traps available for all of the runtime-level meta-operations: + +```JavaScript +var handler = +{ + get:..., + set:..., + has:..., + deleteProperty:..., + apply:..., + construct:..., + getOwnPropertyDescriptor:..., + defineProperty:..., + getPrototypeOf:..., + setPrototypeOf:..., + enumerate:..., + ownKeys:..., + preventExtensions:..., + isExtensible:... +} +``` + +### Symbols +Symbols enable access control for object state. Symbols allow properties to be keyed by either `string` (as in ES5) or `symbol`. Symbols are a new primitive type. Optional `name` parameter used in debugging - but is not part of identity. Symbols are unique (like gensym), but not private since they are exposed via reflection features like `Object.getOwnPropertySymbols`. + + +```JavaScript +var MyClass = (function() { + + // module scoped symbol + var key = Symbol("key"); + + function MyClass(privateData) { + this[key] = privateData; + } + + MyClass.prototype = { + doStuff: function() { + ... this[key] ... + } + }; + + return MyClass; +})(); + +var c = new MyClass("hello") +c["key"] === undefined +``` + +### Subclassable Built-ins +In ES6, built-ins like `Array`, `Date` and DOM `Element`s can be subclassed. + +Object construction for a function named `Ctor` now uses two-phases (both virtually dispatched): +- Call `Ctor[@@create]` to allocate the object, installing any special behavior +- Invoke constructor on new instance to initialize + +The known `@@create` symbol is available via `Symbol.create`. Built-ins now expose their `@@create` explicitly. + +```JavaScript +// Pseudo-code of Array +class Array { + constructor(...args) { /* ... */ } + static [Symbol.create]() { + // Install special [[DefineOwnProperty]] + // to magically update 'length' + } +} + +// User code of Array subclass +class MyArray extends Array { + constructor(...args) { super(...args); } +} + +// Two-phase 'new': +// 1) Call @@create to allocate object +// 2) Invoke constructor on new instance +var arr = new MyArray(); +arr[1] = 12; +arr.length == 2 +``` + +### Math + Number + String + Array + Object APIs +Many new library additions, including core Math libraries, Array conversion helpers, String helpers, and Object.assign for copying. + +```JavaScript +Number.EPSILON +Number.isInteger(Infinity) // false +Number.isNaN("NaN") // false + +Math.acosh(3) // 1.762747174039086 +Math.hypot(3, 4) // 5 +Math.imul(Math.pow(2, 32) - 1, Math.pow(2, 32) - 2) // 2 + +"abcde".includes("cd") // true +"abc".repeat(3) // "abcabcabc" + +Array.from(document.querySelectorAll('*')) // Returns a real Array +Array.of(1, 2, 3) // Similar to new Array(...), but without special one-arg behavior +[0, 0, 0].fill(7, 1) // [0,7,7] +[1, 2, 3].find(x => x == 3) // 3 +[1, 2, 3].findIndex(x => x == 2) // 1 +[1, 2, 3, 4, 5].copyWithin(3, 0) // [1, 2, 3, 1, 2] +["a", "b", "c"].entries() // iterator [0, "a"], [1,"b"], [2,"c"] +["a", "b", "c"].keys() // iterator 0, 1, 2 +["a", "b", "c"].values() // iterator "a", "b", "c" + +Object.assign(Point, { origin: new Point(0,0) }) +``` + +### Binary and Octal Literals +Two new numeric literal forms are added for binary (`b`) and octal (`o`). + +```JavaScript +0b111110111 === 503 // true +0o767 === 503 // true +``` + +### Promises +Promises are a library for asynchronous programming. Promises are a first class representation of a value that may be made available in the future. Promises are used in many existing JavaScript libraries. + +```JavaScript +function timeout(duration = 0) { + return new Promise((resolve, reject) => { + setTimeout(resolve, duration); + }) +} + +var p = timeout(1000).then(() => { + return timeout(2000); +}).then(() => { + throw new Error("hmm"); +}).catch(err => { + return Promise.all([timeout(100), timeout(200)]); +}) +``` + +### Reflect API +Full reflection API exposing the runtime-level meta-operations on objects. This is effectively the inverse of the Proxy API, and allows making calls corresponding to the same meta-operations as the proxy traps. Especially useful for implementing proxies. + +```JavaScript +// No sample yet +``` + +### Tail Calls +Calls in tail-position are guaranteed to not grow the stack unboundedly. Makes recursive algorithms safe in the face of unbounded inputs. + +```JavaScript +function factorial(n, acc = 1) { + 'use strict'; + if (n <= 1) return acc; + return factorial(n - 1, n * acc); +} + +// Stack overflow in most implementations today, +// but safe on arbitrary inputs in ES6 +factorial(100000) +``` From f34c7ce67feea77dbfbfa1aae4872b7a51ea6fae Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 18:43:11 +0300 Subject: [PATCH 02/24] Translate MIT License to Greek --- el/License.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/el/License.md b/el/License.md index 1fdcde9..7c0a7b3 100644 --- a/el/License.md +++ b/el/License.md @@ -1,21 +1,22 @@ The MIT License (MIT) -Copyright (c) 2014 Luke Hoban +Πνευματικά δικαιώματα (c) 2014 Luke Hoban -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Η άδεια αυτή χορηγείται, χωρίς χρέωση, σε οποιοδήποτε άτομο αποκτά ένα αντίγραφο +αυτού του λογισμικού και των σχετικών αρχείων τεκμηρίωσης (το "Λογισμικό"), για να +χειριστεί το Λογισμικό χωρίς περιορισμούς, συμπερλιμανομένων και των χωρίς περιορισμό +δικαιωμάτων για χρήση, αντιγραφή, αλλαγή, συνένωση, δημοσίευση, διάθεση, νέα αδειοδότηση, +και/ή πώληση αντιγράφων του Λογισμικού, και να επιτρέπει στο άτομο που θα λάβει το Λογισμικό +να πράξει ομοίως, υπό τις ακόλουθες προϋποθέσεις: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +Τα παραπάνω πνευματικά δικαιώματα και αυτή η αναφορά στην άδεια θα πρέπει να συμπεριλαμβάνεται +σε όλα τα αντίγραφα ή σε σημαντικά τμήματα του Λογισμικού. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file + +ΤΟ ΛΟΓΙΣΜΙΚΟ ΠΑΡΕΧΕΤΑΙ "ΩΣ ΕΧΕΙ", ΧΩΡΙΣ ΚΑΝΕΝΟΣ ΕΙΔΟΥΣ ΕΓΓΥΗΣΗ, ΡΗΤΗ Ή +ΣΙΩΠΗΡΗ, ΣΥΜΠΕΡΙΛΑΜΒΑΝΟΜΕΝΩΝ ΕΝΔΕΙΚΤΙΚΑ ΤΩΝ ΕΓΓΥΗΣΕΩΝ ΕΜΠΟΡΕΥΣΙΜΟΤΗΤΑΣ, +ΚΑΤΑΛΛΗΛΟΤΗΤΑΣ ΓΙΑ ΕΝΑ ΣΥΓΚΕΚΡΙΜΕΝΟ ΣΚΟΠΟ ΚΑΙ ΜΗ ΠΑΡΑΒΙΑΣΗΣ. ΣΕ ΚΑΜΙΑ ΠΕΡΙΠΤΩΣΗ Η +ΣΥΝΤΑΚΤΕΣ Ή ΟΙ ΚΑΤΟΧΟΙ ΠΝΕΥΜΑΤΙΚΩΝ ΔΙΚΑΙΩΜΑΤΩΝ ΔΕΝ ΘΑ ΦΕΡΟΥΝ ΚΑΜΙΑ ΕΥΘΥΝΗ ΓΙΑ ΟΠΟΙΑΔΗΠΟΤΕ ΑΞΙΩΣΗ, ΖΗΜΙΑ Ή ΑΛΛΗ +ΕΥΘΥΝΗ, ΕΙΤΕ ΣΤΑ ΠΛΑΙΣΙΑ ΤΗΣ ΣΥΜΒΑΣΗΣ, ΑΔΙΚΗΜΑ Ή ΑΛΛΩΣ, ΠΟΥ ΠΡΟΚΥΠΤΕΙ, +ΑΠΟ Ή ΣΕ ΣΧΕΣΗ ΜΕ ΤΟ ΛΟΓΙΣΜΙΚΟ Ή ΤΗ ΧΡΗΣΗ Ή ΑΛΛΗ ΣΥΜΠΕΡΙΦΟΡΑ ΠΟΥ ΑΦΟΡΑ ΤΟ +ΛΟΓΙΣΜΙΚΟΥ. \ No newline at end of file From ed57d453cc3135a0657efd32f80ba63d1388c404 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 19:02:52 +0300 Subject: [PATCH 03/24] Introduction has been translated --- el/README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/el/README.md b/el/README.md index eb4307f..21b0bb8 100644 --- a/el/README.md +++ b/el/README.md @@ -1,32 +1,32 @@ # ECMAScript 6 [git.io/es6features](http://git.io/es6features) -## Introduction -ECMAScript 6, also known as ECMAScript 2015, is the latest version of the ECMAScript standard. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009. Implementation of these features in major JavaScript engines is [underway now](http://kangax.github.io/es5-compat-table/es6/). +## Εισαγωγή +Η ECMAScript 6, επίσης γνωστή και ως ECMAScript 2015, είναι η ποιο πρόσφατη έκδοση του προτύπου ECMAScript. Η ES6 αποτελεί μια σημαντική αναβάθμιση της γλώσσας, και η πρώτη αναβάθμιση στην γλώσσα από την ES5 τυποποιήθηκε το 2009. Υλοποίηση αυτών των χαρακτηριστικών στις σημαντικές μηχανές JavaScript είναι [τώρα σε εξέλιξη](http://kangax.github.io/es5-compat-table/es6/). -See the [ES6 standard](http://www.ecma-international.org/ecma-262/6.0/) for full specification of the ECMAScript 6 language. +Δείτε το [πρότυπο ES6](http://www.ecma-international.org/ecma-262/6.0/) για πλήρη αναφορά στις προδιαγραφές της γλώσσας ECMAScript 6. -ES6 includes the following new features: -- [arrows](#arrows) -- [classes](#classes) -- [enhanced object literals](#enhanced-object-literals) -- [template strings](#template-strings) -- [destructuring](#destructuring) +Η ES6 περιλαμβάνει τα ακόλουθα νέα χαρακτηριστικά: +- [βέλη (arrows)](#arrows) +- [κλάσεις (classes)](#classes) +- [βελτιομένα κυριολεκτικά αντικειμένων (enhanced object literals)](#enhanced-object-literals) +- [πρότυπα συμβολοσειρών (template strings)](#template-strings) +- [αποδόμηση (destructuring)](#destructuring) - [default + rest + spread](#default--rest--spread) - [let + const](#let--const) -- [iterators + for..of](#iterators--forof) -- [generators](#generators) +- [επαναλήπτες + for..of (iterators + for..of)](#iterators--forof) +- [γεννήτριες (generators)](#generators) - [unicode](#unicode) -- [modules](#modules) -- [module loaders](#module-loaders) +- [μονάδες (modules)](#modules) +- [φορτωτές μονάδων (module loaders)](#module-loaders) - [map + set + weakmap + weakset](#map--set--weakmap--weakset) - [proxies](#proxies) -- [symbols](#symbols) +- [σύμβολα (symbols)](#symbols) - [subclassable built-ins](#subclassable-built-ins) -- [promises](#promises) -- [math + number + string + array + object APIs](#math--number--string--array--object-apis) -- [binary and octal literals](#binary-and-octal-literals) -- [reflect api](#reflect-api) -- [tail calls](#tail-calls) +- [υποσχέσεις (promises)](#promises) +- [APIs για μαθηματικά + αριθμούς + συμβολοσειρές + πίνακες + αντικείμενα (math + number + string + array + object APIs)](#math--number--string--array--object-apis) +- [κυριολεκτικά δυαδικών και οκταδικών (binary and octal literals)](#binary-and-octal-literals) +- [API ανάκλασης (reflect api)](#reflect-api) +- [κλήσεις ουράς (tail calls)](#tail-calls) ## ECMAScript 6 Features From 2ceababcb3c78f004191d6af388063eac17e0c03 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 19:12:17 +0300 Subject: [PATCH 04/24] Translating the arrow feature --- el/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/el/README.md b/el/README.md index 21b0bb8..60e0194 100644 --- a/el/README.md +++ b/el/README.md @@ -28,24 +28,24 @@ - [API ανάκλασης (reflect api)](#reflect-api) - [κλήσεις ουράς (tail calls)](#tail-calls) -## ECMAScript 6 Features +## Χαρακτηριστικά της ECMAScript 6 -### Arrows -Arrows are a function shorthand using the `=>` syntax. They are syntactically similar to the related feature in C#, Java 8 and CoffeeScript. They support both statement block bodies as well as expression bodies which return the value of the expression. Unlike functions, arrows share the same lexical `this` as their surrounding code. +### Βέλη (arrow) +Τα βέλη είναι συντομογραφίες συναρτήσεων που χρησιμοποιούν το συντακτικό `=>`. Είναι συντακτικά όμοια των σχετικών χαρακτηριστικών στην C#, Java 8 και της CoffeeScript. Υποστηρίζουν τόσο δηλώσεις κορμού σε πλαίσιο όσο και δηλώσεις κορμού οι οποίες επιστρέφουν την τιμή της δήλωσης. Αντίθετα από τις συναρτήσεις, τα βέλη μοιράζονται το ίδιο λεξιλογικό `this` με αυτό του κώδικα που τα πλαισιώνει. ```JavaScript -// Expression bodies +// Κορμοί δήλωσης var odds = evens.map(v => v + 1); var nums = evens.map((v, i) => v + i); var pairs = evens.map(v => ({even: v, odd: v + 1})); -// Statement bodies +// Κορμοί δήλωσης nums.forEach(v => { if (v % 5 === 0) fives.push(v); }); -// Lexical this +// Λεξιλογικό this var bob = { _name: "Bob", _friends: [], From 386092aaaff1584accf6d79d01708bb0bc6fd69e Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 19:20:33 +0300 Subject: [PATCH 05/24] Translate classes into greek language --- el/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/el/README.md b/el/README.md index 60e0194..f22e2a6 100644 --- a/el/README.md +++ b/el/README.md @@ -56,8 +56,8 @@ var bob = { } ``` -### Classes -ES6 classes are a simple sugar over the prototype-based OO pattern. Having a single convenient declarative form makes class patterns easier to use, and encourages interoperability. Classes support prototype-based inheritance, super calls, instance and static methods and constructors. +### Κλάσεις (Classes) +Η κλάσεις στην ES6, είναι απλή ζάχαρη πάνω από τα βασισμένα σε prototypes αντικειμενοστρεφή πρότυπα. Η ύπαρξη μιας ενιαίας βολικής μορφής δήλωσης, κάνει τα πρότυπα κλάσεων ποιο εύκολα στην χρήση, και προτρέπουν την διαλειτουργικότητα. Οι κλάσεις υποστηρίζουν κληρονομικότητα βασισμένη στα prototypes, κλήσεις super, στιγμιότυπα, στατικές μεθόδους και δημιουργούς. ```JavaScript class SkinnedMesh extends THREE.Mesh { From bcacc1b2b214be7db91451159a0a0323dfd0fc5d Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 19:29:51 +0300 Subject: [PATCH 06/24] Traslation of the Enhanced object literals into greek language --- el/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/el/README.md b/el/README.md index f22e2a6..7d484f3 100644 --- a/el/README.md +++ b/el/README.md @@ -85,21 +85,21 @@ class SkinnedMesh extends THREE.Mesh { } ``` -### Enhanced Object Literals -Object literals are extended to support setting the prototype at construction, shorthand for `foo: foo` assignments, defining methods, making super calls, and computing property names with expressions. Together, these also bring object literals and class declarations closer together, and let object-based design benefit from some of the same conveniences. +### Βελτιομένα κυριολεκτικά αντικειμένων (enhanced object literals) +Τα κυριολεκτικά αντικειμένων έχουν επεκταθεί ώστε να υποστηρίζουν την ρύθμιση του prototype κατά την δημιουργία, συντομεύσεις για αναθέσεις `foo: foo`, ορισμούς μεθόδων, κλήσεις super, και υπολογισμό ονομάτων ιδιοτήτων με εκφράσεις. Μαζί, αυτά επίσης φέρνουν κυριολεκτικά αντικείμενα και δηλώσεις κλάσεων ποιο κοντά μαζί, και επιτρέπουν τα πλεονεκτήματα του βασισμένου σε αντικείμενα σχεδιασμού μερικές από τις ίδιες ανέσεις. ```JavaScript var obj = { // __proto__ __proto__: theProtoObj, - // Shorthand for ‘handler: handler’ + // Συντομογραφία του ‘handler: handler’ handler, - // Methods + // Μέθοδοι toString() { - // Super calls + // Κλήση super return "d " + super.toString(); }, - // Computed (dynamic) property names + // Δυναμική δημιουργία ονομάτων ιδιοτήτων [ 'prop_' + (() => 42)() ]: 42 }; ``` From fe0ed2c4f26fda5936dceda5f3055212d55bd95f Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Mon, 27 Jul 2015 19:43:21 +0300 Subject: [PATCH 07/24] Translate tempate string into greek language --- el/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/el/README.md b/el/README.md index 7d484f3..648dd6d 100644 --- a/el/README.md +++ b/el/README.md @@ -104,22 +104,22 @@ var obj = { }; ``` -### Template Strings -Template strings provide syntactic sugar for constructing strings. This is similar to string interpolation features in Perl, Python and more. Optionally, a tag can be added to allow the string construction to be customized, avoiding injection attacks or constructing higher level data structures from string contents. +### Πρότυπα συμβολοσειρών (template strings) +Τα πρότυπα συμβολοσειρών παρέχουν συντακτική ζάχαρη στην δημιουργία συμβολοσειρών. Αυτό είναι παρόμοιο με το χαρακτηριστικό παρεμβολής συμβολοσειρών στην Perl, την Python και άλλα. Προαιρετικά, μια ετικέτα μπορεί να προστεθεί για να επιτρέψει την δημιουργία της συμβολοσειράς να προσαρμοστεί, αποφεύγοντας τις επιθέσεις ένεσης ή την δημιουργία υψηλότερου επιπέδου δομών δεδομένων από περιεχόμενο συμβολοσειρών. ```JavaScript -// Basic literal string creation +// Βασική δημιουργία συμβολοσειράς `In JavaScript '\n' is a line-feed.` -// Multiline strings +// Συμβολοσειρά πολλαπλών γραμμών `In JavaScript this is not legal.` -// String interpolation +// Παρέμβαση συμβολοσειράς var name = "Bob", time = "today"; `Hello ${name}, how are you ${time}?` -// Construct an HTTP request prefix is used to interpret the replacements and construction +// Δόμηση ενός HTTP request prefix που χρησιμοποιείται για να ερμηνεύσει τις αντικαταστάσεις και την κατασκευή GET`http://foo.org/bar?a=${a}&b=${b} Content-Type: application/json X-Credentials: ${credentials} From a84df60f157d448f2d880e2718f6595f64bc5ae3 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:15:56 +0300 Subject: [PATCH 08/24] Translating Destructuring into greek language --- el/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/el/README.md b/el/README.md index 648dd6d..596de60 100644 --- a/el/README.md +++ b/el/README.md @@ -127,32 +127,32 @@ GET`http://foo.org/bar?a=${a}&b=${b} "bar": ${bar}}`(myOnReadyStateChangeHandler); ``` -### Destructuring -Destructuring allows binding using pattern matching, with support for matching arrays and objects. Destructuring is fail-soft, similar to standard object lookup `foo["bar"]`, producing `undefined` values when not found. +### Αποδόμηση (Destructuring) +Η αποδόμηση επιτρέπει την δέσμευση χρησιμοποιώντας μοτίβα ταιριάσματος, με υποστήριξη για ταίριασμα πινάκων και αντικειμένων. Η αποδόμηση αποτυγχάνει ομαλά, παρόμοια με το πρότυπο αναζήτησης σε αντικείμενα `foo["bar"]`, παράγοντας την τιμή `undefined` όταν δεν βρίσκει κάτι. ```JavaScript -// list matching +// Ταίριασμα λίστας var [a, , b] = [1,2,3]; -// object matching +// Ταίριασμα αντικειμένων var { op: a, lhs: { op: b }, rhs: c } = getASTNode() -// object matching shorthand -// binds `op`, `lhs` and `rhs` in scope +// Συντόμευση ταιριάσματος αντικειμένου +// Δένει τα `op`, `lhs` και `rhs` στο πεδίο εφαρμογής var {op, lhs, rhs} = getASTNode() -// Can be used in parameter position +// Μπορεί να χρησιμοποιηθεί στην θέση παραμέτρων function g({name: x}) { console.log(x); } g({name: 5}) -// Fail-soft destructuring +// Ομαλή αποτυχία κατά την αποδόμηση var [a] = []; a === undefined; -// Fail-soft destructuring with defaults +// Ομαλή αποτυχία κατά την αποδόμηση με προεπιλεγμένες τιμές var [a = 1] = []; a === 1; ``` From 1aab3ae721df172d2c3a9c86e803a4ccf97f39d5 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:24:29 +0300 Subject: [PATCH 09/24] Translating the Default + Rest + Spread into greek language --- el/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/el/README.md b/el/README.md index 596de60..750d955 100644 --- a/el/README.md +++ b/el/README.md @@ -158,18 +158,18 @@ a === 1; ``` ### Default + Rest + Spread -Callee-evaluated default parameter values. Turn an array into consecutive arguments in a function call. Bind trailing parameters to an array. Rest replaces the need for `arguments` and addresses common cases more directly. +Αξιολόγηση στις τιμές του καλούντος προγράμματος με προεπιλεγμένες τιμές. Μετατρέπει ενός πίνακα σε διαδοχικά στοιχεία κατά την κλήση μιας συνάρτησης. Δένει τις παραμέτρους που ακολουθούν σε ένα πίνακα. Το Rest αντικαθιστά την ανάγκη για `arguments` και εξετάζει τις κοινές υποθέσεις πιο άμεσα. ```JavaScript function f(x, y=12) { - // y is 12 if not passed (or passed as undefined) + // Το y είναι 12 αν δεν οριστεί από το πρόγραμμα που χρησιμοποιεί την συνάρτηση (ή αν δεν οριστεί σε undefined) return x + y; } f(3) == 15 ``` ```JavaScript function f(x, ...y) { - // y is an Array + // Το y είναι ένα πίνακας return x * y.length; } f(3, "hello", true) == 6 @@ -178,7 +178,7 @@ f(3, "hello", true) == 6 function f(x, y, z) { return x + y + z; } -// Pass each elem of array as argument +// Περνάει κάθε στοιχείο του πίνακα ως παραμέτρους στην συνάρτηση f(...[1,2,3]) == 6 ``` From a66dfc1757b5030c8e6a7c98d2966b3ab7241bd0 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:29:31 +0300 Subject: [PATCH 10/24] Translating Let + Const into greek language --- el/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/el/README.md b/el/README.md index 750d955..f6d63e1 100644 --- a/el/README.md +++ b/el/README.md @@ -183,7 +183,7 @@ f(...[1,2,3]) == 6 ``` ### Let + Const -Block-scoped binding constructs. `let` is the new `var`. `const` is single-assignment. Static restrictions prevent use before assignment. +Δημιουργία δέσμευσης σε πεδίο εφαρμογής μπλοκ. Η `let` είναι η νέα `var`. Η `const` δέχεται μόνο μια ανάθεση τιμής. Στατικοί περιορισμοί απαγορεύουν την χρήση πριν την ανάθεση τιμής. ```JavaScript @@ -191,12 +191,12 @@ function f() { { let x; { - // okay, block scoped name + // OK, Όνομα σε πεδίο εφαρμογής μπλοκ const x = "sneaky"; - // error, const + // Εσφαλμένη ανάθεση τιμής x = "foo"; } - // error, already declared in block + // Σφάλμα, έχει ήδη δηλωθεί μέσα στο ίδιο μπλοκ let x = "inner"; } } From 56c2441ce3cd4ded05b5b2f6cdb2ccb5fd3c17cb Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:38:01 +0300 Subject: [PATCH 11/24] Translating Iterators + for..of into greek language --- el/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/el/README.md b/el/README.md index f6d63e1..4c6ac31 100644 --- a/el/README.md +++ b/el/README.md @@ -202,8 +202,9 @@ function f() { } ``` -### Iterators + For..Of -Iterator objects enable custom iteration like CLR IEnumerable or Java Iterable. Generalize `for..in` to custom iterator-based iteration with `for..of`. Don’t require realizing an array, enabling lazy design patterns like LINQ. +### Επαναλήπτες + for..of (Iterators + for..of) +Τα αντικείμενα επαναλήψεων επιτρέπει τις προσαρμοσμένες επαναλήψεις όπως το CLR IEnumerable ή το Java Iterable. Γενικευμένες `for..in` για την προσαρμογή βασισμένων σε επαναλήπτες +επανάληψη με `for..of`. Δεν απαιτεί την υλοποίηση ενός πίνακα, ενεργοποιώντας τα βαρετά μοτίβα σχεδιασμού όπως το LINQ. ```JavaScript let fibonacci = { @@ -219,14 +220,14 @@ let fibonacci = { } for (var n of fibonacci) { - // truncate the sequence at 1000 + // Περικοπή της ακολουθίας στα 1000 if (n > 1000) break; console.log(n); } ``` -Iteration is based on these duck-typed interfaces (using [TypeScript](http://typescriptlang.org) type syntax for exposition only): +Η επανάληψη είναι βασισμένη στις ακόλουθες duck-typed διεπαφές (χρήση της σύνταξης τύπου του [TypeScript](http://typescriptlang.org) μόνο για έκθεση): ```TypeScript interface IteratorResult { done: boolean; From 2a7f4c2838f94af0ee168359ca59b524a4160546 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:47:36 +0300 Subject: [PATCH 12/24] Translating Generators into greek language --- el/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/el/README.md b/el/README.md index 4c6ac31..8b86d97 100644 --- a/el/README.md +++ b/el/README.md @@ -241,10 +241,11 @@ interface Iterable { } ``` -### Generators -Generators simplify iterator-authoring using `function*` and `yield`. A function declared as function* returns a Generator instance. Generators are subtypes of iterators which include additional `next` and `throw`. These enable values to flow back into the generator, so `yield` is an expression form which returns a value (or throws). +### Γεννήτριες (Generators) -Note: Can also be used to enable ‘await’-like async programming, see also ES7 `await` proposal. +Οι γεννήτριες απλοποιούν την συγγραφή επαναληπτών χρησιμοποιώντας το `function*` και `yield`. Μία συνάρτηση που έχει δηλωθεί ως function* επιστρέφει ένα στιγμιότυπο μιας γεννήτριας. Οι γεννήτριες είναι υπό-τύποι επαναληπτών που περιέχει επιπλέον τις συναρτήσεις `next` και `throw`. Αυτές επιτρέπουν στις τιμές να ολισθαίνουν πίσω στην γεννήτρια, έτσι η `yield` είναι μια δήλωση από την οποία επιστρέφει μια τιμή ( ή throws). + +Σημείωση: Μπορούν επίσης να χρησιμοποιηθούν για να ενεργοποιήσουν ασύγχρονο προγραμματισμό τύπου αναμονής, δείτε επίσης την πρόταση για το `await` της ES7. ```JavaScript var fibonacci = { @@ -260,14 +261,14 @@ var fibonacci = { } for (var n of fibonacci) { - // truncate the sequence at 1000 + // Περικοπή της ακολουθίας στα 1000 if (n > 1000) break; console.log(n); } ``` -The generator interface is (using [TypeScript](http://typescriptlang.org) type syntax for exposition only): +Η διεπαφή της γεννήτριας είναι (χρήση της σύνταξης τύπου του [TypeScript](http://typescriptlang.org) μόνο για έκθεση): ```TypeScript interface Generator extends Iterator { From 4e02ee0707c7913a7c9d52a0812d426c86ab6917 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 10:54:47 +0300 Subject: [PATCH 13/24] Translating Unicode into greek language --- el/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/el/README.md b/el/README.md index 8b86d97..dc98388 100644 --- a/el/README.md +++ b/el/README.md @@ -278,22 +278,22 @@ interface Generator extends Iterator { ``` ### Unicode -Non-breaking additions to support full Unicode, including new Unicode literal form in strings and new RegExp `u` mode to handle code points, as well as new APIs to process strings at the 21bit code points level. These additions support building global apps in JavaScript. +Προσθήκες χωρίς-διάσπαση για πλήρη υποστήριξη Unicode, συμπεριλαμβανομένων νέων κυριολεκτικών μορφών Unicode σε συμβολοσειρές και νέοι RegExp `u` τρόπου για την διαχείριση σημείων κώδικα, όπως επίσης και νέες API για την επεξεργασία συμβολοσειρών σε σημεία επιπέδου κώδικα 21bit. Αυτές οι προσθήκες υποστηρίζουν δημιουργία καθολικών (παγκόσμιων) εφαρμογών σε JavaScript. ```JavaScript -// same as ES5.1 +// Όπως και στην ES5.1 "𠮷".length == 2 -// new RegExp behaviour, opt-in ‘u’ +// Νέα συμπεριφορά της RegExp, opt-in ‘u’ "𠮷".match(/./u)[0].length == 2 -// new form +// Νέα μορφή "\u{20BB7}"=="𠮷"=="\uD842\uDFB7" -// new String ops +// Νέες επιλογές σε συμβολοσειρές "𠮷".codePointAt(0) == 0x20BB7 -// for-of iterates code points +// Επαναλήψεις σημείων κώδικα for-of for(var c of "𠮷") { console.log(c); } From d23cf620a802f6628dc9d7206db9e5964e6ddd28 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:03:19 +0300 Subject: [PATCH 14/24] Translating Modules into greek language --- el/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/el/README.md b/el/README.md index dc98388..b981b32 100644 --- a/el/README.md +++ b/el/README.md @@ -299,8 +299,8 @@ for(var c of "𠮷") { } ``` -### Modules -Language-level support for modules for component definition. Codifies patterns from popular JavaScript module loaders (AMD, CommonJS). Runtime behaviour defined by a host-defined default loader. Implicitly async model – no code executes until requested modules are available and processed. +### Μονάδες (Modules) +Υποστήριξη μονάδων σε επίπεδο κώδικα για τον ορισμών δομικών στοιχείων. Ενσωμάτωση μοτίβων από γνωστές μονάδες φόρτωσης JavaScript (AMD, CommonJS). Συμπεριφορά κατά την εκτέλεση καθορισμένη από τον προ επιλεγμένο φορτωτή που έχει ορίσει ο host. Άμεσα ασύγχρονο μοντέλο - δεν εκτελείτε κώδικας μέχρι οι απαιτούμενες μονάδες να είναι διαθέσιμες και επεξεργασμένες. ```JavaScript // lib/math.js @@ -320,7 +320,7 @@ import {sum, pi} from "lib/math"; alert("2π = " + sum(pi, pi)); ``` -Some additional features include `export default` and `export *`: +Κάποια επιπρόσθετα χαρακτηριστικά περιλαμβάνουν τα `export default` και `export *`: ```JavaScript // lib/mathplusplus.js From 69f1ce4660476d98b41e8decc7d833ee3c329a78 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:12:17 +0300 Subject: [PATCH 15/24] Translating Module Loaders into greek language --- el/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/el/README.md b/el/README.md index b981b32..c94eedf 100644 --- a/el/README.md +++ b/el/README.md @@ -336,31 +336,31 @@ import ln, {pi, e} from "lib/mathplusplus"; alert("2π = " + ln(e)*pi*2); ``` -### Module Loaders -Module loaders support: -- Dynamic loading -- State isolation -- Global namespace isolation +### Φορτωτές Μονάδων (Module Loaders) +Οι φορτωτές μονάδες υποστηρίζουν +- Δυναμικό φόρτωμα +- Απομόνωση κατάστασης +- Καθολική απομόνωση ονόματος χώρου - Compilation hooks -- Nested virtualization +- Ενθυλακωμένο virtualization -The default module loader can be configured, and new loaders can be constructed to evaluate and load code in isolated or constrained contexts. +Ο εξ ορισμού φορτωτής μονάδων μπορεί να ρυθμιστεί, και οι νέοι φορτωτές μπορούν να δημιουργηθούν να αξιολογούν και να φορτώνουν κώδικα σε απομονωμένο ή περιορισμένο περιβάλλον. ```JavaScript -// Dynamic loading – ‘System’ is default loader +// Δυναμικό φόρτωμα – Το ‘System’ είναι ο προεπιλεγμένος φορτωτής System.import('lib/math').then(function(m) { alert("2π = " + m.sum(m.pi, m.pi)); }); -// Create execution sandboxes – new Loaders +// Δημιουργία ενός κουτιού ασφαλείας για εκτέλεση – new Loaders var loader = new Loader({ - global: fixup(window) // replace ‘console.log’ + global: fixup(window) // Αντικαθιστά το ‘console.log’ }); loader.eval("console.log('hello world!');"); -// Directly manipulate module cache +// Άμεση διαχείριση της cache μονάδων System.get('jquery'); -System.set('jquery', Module({$: $})); // WARNING: not yet finalized +System.set('jquery', Module({$: $})); // ΠΡΟΣΟΧΗ: δεν έχει ολοκληρωθεί ακόμα ``` ### Map + Set + WeakMap + WeakSet From e000f80d428829effcfa4c5a80236704cf9bbcd2 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:17:15 +0300 Subject: [PATCH 16/24] Translating Map + Set + WeakMap + WeakSet into greek language --- el/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/el/README.md b/el/README.md index c94eedf..6cde8cf 100644 --- a/el/README.md +++ b/el/README.md @@ -364,7 +364,7 @@ System.set('jquery', Module({$: $})); // ΠΡΟΣΟΧΗ: δεν έχει ολο ``` ### Map + Set + WeakMap + WeakSet -Efficient data structures for common algorithms. WeakMaps provides leak-free object-key’d side tables. +Αποδοτικές δομές δεδομένων για κοινού αλγόριθμους. Το WeakMaps παρέχει χωρίς διαρροές πίνακες με κλειδιά από αντικείμενα. ```JavaScript // Sets @@ -387,7 +387,7 @@ wm.size === undefined // Weak Sets var ws = new WeakSet(); ws.add({ data: 42 }); -// Because the added object has no other references, it will not be held in the set +// Επειδή το νέο αντικείμενο δεν έχει κάποια άλλη αναφορά, δεν θα ενσωματωθεί στο σύνολο. ``` ### Proxies From 2e55637ce91d3520f7af520b04071c249a9d7e2d Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:24:30 +0300 Subject: [PATCH 17/24] Translating Proxies into greek language --- el/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/el/README.md b/el/README.md index 6cde8cf..8ce700a 100644 --- a/el/README.md +++ b/el/README.md @@ -391,10 +391,10 @@ ws.add({ data: 42 }); ``` ### Proxies -Proxies enable creation of objects with the full range of behaviors available to host objects. Can be used for interception, object virtualization, logging/profiling, etc. +Οι Proxies ενεργοποιούν την δημιουργία αντικειμένων με πλήρες εύρος συμπεριφοράς διαθέσιμη στα αντικείμενα που τους φιλοξενούν. Μπορούν να χρησιμοποιηθούν για υποκλοπή, virtualization αντικειμένων, καταγραφή/δημιουργία προφίλ, κλπ. ```JavaScript -// Proxying a normal object +// Proxying σε ένα κανονικό αντικείμενο var target = {}; var handler = { get: function (receiver, name) { @@ -407,7 +407,7 @@ p.world === 'Hello, world!'; ``` ```JavaScript -// Proxying a function object +// Proxying ένα αντικείμενο συνάρτηση var target = function () { return 'I am the target'; }; var handler = { apply: function (receiver, ...args) { @@ -419,7 +419,7 @@ var p = new Proxy(target, handler); p() === 'I am the proxy'; ``` -There are traps available for all of the runtime-level meta-operations: +Υπάρχουν διαθέσιμες παγίδες για όλες τις μέτα-λειτουργίες σε επίπεδο χρόνου εκτέλεσης: ```JavaScript var handler = From 46683f28ef24313574280b6fdb992dba45a0be9e Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:32:11 +0300 Subject: [PATCH 18/24] Translating Symbols into greek language --- el/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/el/README.md b/el/README.md index 8ce700a..2310dd5 100644 --- a/el/README.md +++ b/el/README.md @@ -441,14 +441,14 @@ var handler = } ``` -### Symbols -Symbols enable access control for object state. Symbols allow properties to be keyed by either `string` (as in ES5) or `symbol`. Symbols are a new primitive type. Optional `name` parameter used in debugging - but is not part of identity. Symbols are unique (like gensym), but not private since they are exposed via reflection features like `Object.getOwnPropertySymbols`. +### Σύμβολα (Symbols) +Τα σύμβολα ενεργοποιούν τον έλεγχο πρόσβασης στην κατάσταση των αντικειμένων. Τα σύμβολα επιτρέπουν τις ιδιότητες να έχουν κλειδιά είναι ως `string` (όπως στην ES5) ή `symbol`. Τα σύμβολα είναι νέος πρωταρχικός τύπος δεδομένων. Προαιρετικά παράμετροι `name` χρησιμοποιούνται κατά την αποσφαλμάτωση - αλλά δεν είναι μέρος της οντότητας. Τα σύμβολα είναι μοναδικά (όπως το gensym), αλλά όχι ιδιωτικά αφού μπορούν να εκτεθούν μέσω της ιδιότητας ανάκλασης όπως το `Object.getOwnPropertySymbols`. ```JavaScript var MyClass = (function() { - // module scoped symbol + // Σύμβολο μέσα σε μονάδα var key = Symbol("key"); function MyClass(privateData) { From b43ea8e9644d1d6c1ca512b63c25e94fe551e269 Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:46:32 +0300 Subject: [PATCH 19/24] Translating Subclassable Built-ins into greek language --- el/README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/el/README.md b/el/README.md index 2310dd5..d2e86cc 100644 --- a/el/README.md +++ b/el/README.md @@ -469,32 +469,32 @@ c["key"] === undefined ``` ### Subclassable Built-ins -In ES6, built-ins like `Array`, `Date` and DOM `Element`s can be subclassed. +Στην ES6, ενσωματωμένα αντικείμενα όπως τα `Array`, `Date` και τα στοιχεία του DOM μπορούν να παράγουν νέες κλάσεις. -Object construction for a function named `Ctor` now uses two-phases (both virtually dispatched): -- Call `Ctor[@@create]` to allocate the object, installing any special behavior -- Invoke constructor on new instance to initialize +Η δημιουργία αντικειμένου για μια συνάρτηση που ονομάζεται `Ctor` τώρα χρησιμοποιεί δύο φάσεις (και οι δύο με εικονική αποστολή ): +- Κλήση της `Ctor[@@create]` για να διαθέσει το αντικείμενο, εγκαθιστώντας οποιαδήποτε ειδική συμπεριφορά +- Επίκληση του δημιουργού σε ένα νέο στιγμιότυπο για την αρχικοποίηση -The known `@@create` symbol is available via `Symbol.create`. Built-ins now expose their `@@create` explicitly. +Το γνωστό σύμβολο `@@create` είναι διαθέσιμο μέσω του `Symbol.create`. Τα ενσωματωμένα αντικείμενα τώρα εκθέτουν το δικό τους `@@create` ρητά. ```JavaScript -// Pseudo-code of Array +// Ψευδοκώδικας ενός πίνακα class Array { constructor(...args) { /* ... */ } static [Symbol.create]() { - // Install special [[DefineOwnProperty]] - // to magically update 'length' + // Εγκατάσταση ειδικών [[DefineOwnProperty]] + // για την χειρωνακτική ενημέρωση της ιδιότητας 'length' } } -// User code of Array subclass +// Ο κώδικας χρήστη μιας υπό-κλάσης πίνακα class MyArray extends Array { constructor(...args) { super(...args); } } -// Two-phase 'new': -// 1) Call @@create to allocate object -// 2) Invoke constructor on new instance +// 'new' δύο φάσεων: +// 1) Κλήση της @@create για την διέθεση του αντικειμένου +// 2) Επίκληση του δημιουργού σε νέο στιγμιότυπο var arr = new MyArray(); arr[1] = 12; arr.length == 2 From fe608d91f7a493856c62b7296205f71d3843553f Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:52:17 +0300 Subject: [PATCH 20/24] Translating math + number + string + array + object APIs into greek language --- el/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/el/README.md b/el/README.md index d2e86cc..3ce852a 100644 --- a/el/README.md +++ b/el/README.md @@ -500,8 +500,8 @@ arr[1] = 12; arr.length == 2 ``` -### Math + Number + String + Array + Object APIs -Many new library additions, including core Math libraries, Array conversion helpers, String helpers, and Object.assign for copying. +### APIs για μαθηματικά + αριθμούς + συμβολοσειρές + πίνακες + αντικείμενα (math + number + string + array + object APIs) +Πολλές νέες προσθήκες βιβλιοθηκών, συμπεριλαμβανομένων των Math βιβλιοθηκών, βοηθοί μετατροπής πινάκων, βοηθοί συμβολοσειρών, και Object.assign για αντιγραφή. ```JavaScript Number.EPSILON @@ -515,15 +515,15 @@ Math.imul(Math.pow(2, 32) - 1, Math.pow(2, 32) - 2) // 2 "abcde".includes("cd") // true "abc".repeat(3) // "abcabcabc" -Array.from(document.querySelectorAll('*')) // Returns a real Array -Array.of(1, 2, 3) // Similar to new Array(...), but without special one-arg behavior +Array.from(document.querySelectorAll('*')) // Επιστρέφει ένα πραγματικό πίνακα +Array.of(1, 2, 3) // Όμοιο με το new Array(...), αλλά χωρίς την ειδική συμπεριφορά one-arg [0, 0, 0].fill(7, 1) // [0,7,7] [1, 2, 3].find(x => x == 3) // 3 [1, 2, 3].findIndex(x => x == 2) // 1 [1, 2, 3, 4, 5].copyWithin(3, 0) // [1, 2, 3, 1, 2] -["a", "b", "c"].entries() // iterator [0, "a"], [1,"b"], [2,"c"] -["a", "b", "c"].keys() // iterator 0, 1, 2 -["a", "b", "c"].values() // iterator "a", "b", "c" +["a", "b", "c"].entries() // επαναλήπτης [0, "a"], [1,"b"], [2,"c"] +["a", "b", "c"].keys() // επαναλήπτης 0, 1, 2 +["a", "b", "c"].values() // επαναλήπτης "a", "b", "c" Object.assign(Point, { origin: new Point(0,0) }) ``` From 982b0e2231b1d9df04b38dd7a26e9332f75a830c Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:54:50 +0300 Subject: [PATCH 21/24] Translating Binary and octal literals into greek language --- el/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/el/README.md b/el/README.md index 3ce852a..10e559c 100644 --- a/el/README.md +++ b/el/README.md @@ -528,8 +528,8 @@ Array.of(1, 2, 3) // Όμοιο με το new Array(...), αλλά χωρίς τ Object.assign(Point, { origin: new Point(0,0) }) ``` -### Binary and Octal Literals -Two new numeric literal forms are added for binary (`b`) and octal (`o`). +### Κυριολεκτικά δυαδικών και οκταδικών (binary and octal literals) +Δυο νέες αριθμητικές μορφές κυριολεκτικών έχουν προστεθεί για τα διάδικα (`b`) και τα οκταδικά (`o`). ```JavaScript 0b111110111 === 503 // true From 14dffec40190821f3b2a3f2c3efb3cce8743188d Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 11:58:29 +0300 Subject: [PATCH 22/24] Translating Promises into greek language --- el/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/el/README.md b/el/README.md index 10e559c..ddda42a 100644 --- a/el/README.md +++ b/el/README.md @@ -22,9 +22,9 @@ - [proxies](#proxies) - [σύμβολα (symbols)](#symbols) - [subclassable built-ins](#subclassable-built-ins) -- [υποσχέσεις (promises)](#promises) - [APIs για μαθηματικά + αριθμούς + συμβολοσειρές + πίνακες + αντικείμενα (math + number + string + array + object APIs)](#math--number--string--array--object-apis) - [κυριολεκτικά δυαδικών και οκταδικών (binary and octal literals)](#binary-and-octal-literals) +- [υποσχέσεις (promises)](#promises) - [API ανάκλασης (reflect api)](#reflect-api) - [κλήσεις ουράς (tail calls)](#tail-calls) @@ -536,8 +536,8 @@ Object.assign(Point, { origin: new Point(0,0) }) 0o767 === 503 // true ``` -### Promises -Promises are a library for asynchronous programming. Promises are a first class representation of a value that may be made available in the future. Promises are used in many existing JavaScript libraries. +### Υποσχέσεις (promises) +Οι υποσχέσεις είναι μια βιβλιοθήκη για ασύγχρονο προγραμματισμό. Οι υποσχέσεις είναι αναπαράσταση πρώτης κλάσης μια τιμής που ίσως να είναι διαθέσιμη στο μέλλον. Οι υποσχέσεις χρησιμοποιούνται σε πολλές υφιστάμενες βιβλιοθήκες JavaScript. ```JavaScript function timeout(duration = 0) { From 73a5479e354a7746884963515a9bdb3ceb8295db Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 12:03:52 +0300 Subject: [PATCH 23/24] Translating Reflect API into greek language --- el/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/el/README.md b/el/README.md index ddda42a..32471f2 100644 --- a/el/README.md +++ b/el/README.md @@ -555,11 +555,11 @@ var p = timeout(1000).then(() => { }) ``` -### Reflect API -Full reflection API exposing the runtime-level meta-operations on objects. This is effectively the inverse of the Proxy API, and allows making calls corresponding to the same meta-operations as the proxy traps. Especially useful for implementing proxies. +### API ανάκλασης (reflect api) +Η πλήρης API ανάκλασης εκθέτει σε επίπεδο χρόνου εκτέλεσης τις μέτα-εργασίες στα αντικείμενα. Αυτό ουσιαστικά είναι το αντίθετο του Proxy API, και επιτρέπει την δημιουργία κλήσεων που αντιστοιχούν στις ίδιες μέτα-εργασίες όπως οι παγίδες των proxy. Είναι ειδικά χρήσιμο για την υλοποίηση των proxies. ```JavaScript -// No sample yet +// Δεν υπάρχει ακόμα δείγμα ``` ### Tail Calls From e3296edea30bc1ad1b513ce6abd048d581c692dc Mon Sep 17 00:00:00 2001 From: Merianos Nikos Date: Tue, 28 Jul 2015 12:08:33 +0300 Subject: [PATCH 24/24] Translating Tail Calls into greek language --- el/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/el/README.md b/el/README.md index 32471f2..e441d10 100644 --- a/el/README.md +++ b/el/README.md @@ -562,8 +562,8 @@ var p = timeout(1000).then(() => { // Δεν υπάρχει ακόμα δείγμα ``` -### Tail Calls -Calls in tail-position are guaranteed to not grow the stack unboundedly. Makes recursive algorithms safe in the face of unbounded inputs. +### Κλήσεις ουράς (tail calls) +Κλήσεις στην θέση της ουράς εγγυώνται πως δεν θα μεγαλώσει η στοίβα απεριόριστα. Αυτό το χαρακτηριστικό κάνει αλγόριθμους επανάληψης ασφαλείς σε απεριόριστη είσοδο. ```JavaScript function factorial(n, acc = 1) { @@ -572,7 +572,7 @@ function factorial(n, acc = 1) { return factorial(n - 1, n * acc); } -// Stack overflow in most implementations today, -// but safe on arbitrary inputs in ES6 +// Υπερχείλιση στοίβας στις περισσότερες εφαρμογές σήμερα, +// αλλά ασφαλές σε αυθαίρετες εισόδους στην ES6 factorial(100000) ```