Note 1. ECMAScript. Bound functions.

As we know, ECMA-262-5 standardized bind method of the Function.prototype. The source of the current version of this method is “Prototype.js” library, although, the standardized version has several differences. This approach is well known and was successfully used in ES3, so the main purpose of the current note is to show the technical details and differences (which can cause confusing) of the ES5 implementation. Continue reading

ECMA-262-5 in detail. Chapter 2. Strict Mode.

Introduction

In this chapter we will concentrate on another feature of the ECMA-262-5. The topic of the discussion is a strict variant (or strict mode) of an ECMAScript program. We’ll discuss the reasons for providing this feature, how it affects on some already existing semantic aspects and what can it restrict. Continue reading

ECMA-262-5 in detail. Chapter 1. Properties and Property Descriptors.

Read this article in: Russian.

Introduction

This chapter is devoted generally to one of new concepts of the ECMA-262-5 specification — to property attributes and mechanism of their handling — property descriptors.

Usually saying that “an object has some property” we mean an association between a property name and its value. But as we know from the ES3 analysis, a property structure is more complex than just a string name. It also has set of attributes — those which we already discussed in ES3, e.g. {ReadOnly}, {DontEnum} and other. So from this viewpoint a property is as an object itself. Continue reading

Тонкости ECMA-262-5. Часть 1. Свойства и дескрипторы свойств

Read this article in: English.

Введение

Эта глава посвященна одной из новых концепций в спецификации ECMA-262-5 — атрибутам свойств и механизму работы с ними, дескрипторам свойств.

Обычно, говоря, что объект имеет какие-то свойства, мы имеем ввиду связь между именем свойства и его значением. Но, как мы знаем из анализа ES3, структура свойства несколько сложнее, чем просто строковое имя. Оно также имеет набор атрибутов — те, которые мы уже обсудили в статьях об ES3, например {ReadOnly}, {DontEnum} и другие. С этой точки зрения свойство само по себе является объектом. Continue reading

ECMA-262-3 in detail. Chapter 5. Functions.

Read this article in: Russian, French.

Introduction

In this article we will talk about one of the general ECMAScript objects — about functions. In particular, we will go through various types of functions, will define how each type influences variables object of a context and what is contained in the scope chain of each function. Continue reading

ECMA-262-3 in detail. Chapter 7.2. OOP: ECMAScript implementation.

Read this article in: Russian, French.

Introduction

This is the second part of article about object-oriented programming in ECMAScript. In the first part we discussed the general theory and drew parallels with ECMAScript. Before reading of the current part, if it is necessary, I recommend reading the first part as in this article we will actively use the passed terminology. You can find the first part here: ECMA-262-3 in detail. Chapter 7.1. OOP: The general theory.
Continue reading

ECMA-262-3 in detail. Chapter 7.1. OOP: The general theory.

Read this article in: Russian, French.

Introduction

In this article we consider major aspects of object-oriented programming in ECMAScript. That the article has not turned to “yet another” (as this topic already discussed in many articles), more attention will be given, besides, to theoretical aspects to see these processes from within. In particular, we will consider algorithms of objects creation, see how relationships between objects (including the basic relationship — inheritance) are made, and also give accurate definitions which can be used in discussions (that I hope will dispel some terminological and ideological doubts and messes arising often in articles on OOP in JavaScript). Continue reading