Code inclusion rework #58

Закрыто
открыта 2019-11-02 11:39:22 +01:00 belliash · 1 комментарий
belliash прокомментировал(а) 2019-11-02 11:39:22 +01:00
Владелец

Actually, we got 2 builtin function: include() and require(). Both of them are available only inside methods body. The proposition is to:

  • make 'require' available only on the global scope in order to include source files containing classes.
  • make 'include()' available only inside methods body, to include a part of code that will be executed during method call. Such code should be a valid AerScript code that can be executed inside method body (just like using 'eval()')

Thus 'include()' would be still a builtin function, while 'require' would become a language construct. Having that, 'include()' should allow to include code several times (i.e. in loop), while require should work as 'require_once'.

Actually, we got 2 builtin function: include() and require(). Both of them are available only inside methods body. The proposition is to: * make 'require' available only on the global scope in order to include source files containing classes. * make 'include()' available only inside methods body, to include a part of code that will be executed during method call. Such code should be a valid AerScript code that can be executed inside method body (just like using 'eval()') Thus 'include()' would be still a builtin function, while 'require' would become a language construct. Having that, 'include()' should allow to include code several times (i.e. in loop), while require should work as 'require_once'.
belliash добавил(а) метки
bug
enhancement
2019-11-02 11:39:22 +01:00
belliash добавил(а) метки
idea
и удалил(а)
bug
2019-11-02 11:49:27 +01:00
belliash прокомментировал(а) 2019-11-02 11:53:09 +01:00
Автор
Владелец

Additionally, 'import()' allows to load a shared AerScript module. Actually it is implemented as a built-in function returning TRUE on success, or FALSE otherwise. This gives the control to the software developer on potential fallback or throwing an exception it module is not available, when called from constructor for example. If we decide to rewrite it as language construct it would need to throw exception without ability to catch it from global scope.

Decision? I vote for having 'include()' and 'import()' builtin methods and 'require' language construct.

Additionally, 'import()' allows to load a shared AerScript module. Actually it is implemented as a built-in function returning TRUE on success, or FALSE otherwise. This gives the control to the software developer on potential fallback or throwing an exception it module is not available, when called from constructor for example. If we decide to rewrite it as language construct it would need to throw exception without ability to catch it from global scope. Decision? I vote for having 'include()' and 'import()' builtin methods and 'require' language construct.
belliash закрыл(а) эту задачу 2019-12-14 23:30:48 +01:00
Войдите, чтобы присоединиться к обсуждению.
Нет этапа
Нет назначенных лиц
1 участников
Уведомления
Срок выполнения
Срок действия недействителен или находится за пределами допустимого диапазона. Пожалуйста, используйте формат 'гггг-мм-дд'.

Срок выполнения не установлен.

Зависимости

Зависимостей нет.

Ссылка: aerscript/Aer#58
Описание отсутствует.