The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



Индекс форумов
Составление сообщения

Исходное сообщение
"Python опередил Java по числу проектов на GitHub"
Отправлено Anonymoustus, 09-Ноя-19 01:32 
Для исправления недостатков C++ был создан D. ;)

Я не против инноваций, прогресса и всего хорошего. Но когда я смотрю на синтаксис хруста…

Кроме того, я сомневаюсь, что вот это, например, в самом деле служит улучшению нашего мира (2 заключительных абзаца):


The Difference Between Macros and Functions

Fundamentally, macros are a way of writing code that writes
other code, which is known as metaprogramming. In Appendix
C, we discuss the derive attribute, which generates an
implementation of various traits for you. We’ve also used
the println! and vec! macros throughout the book. All of
these macros expand to produce more code than the code
you’ve written manually.

Metaprogramming is useful for reducing the amount of code
you have to write and maintain, which is also one of the
roles of functions. However, macros have some additional
powers that functions don’t.

A function signature must declare the number and type of
parameters the function has. Macros, on the other hand, can
take a variable number of parameters: we can call
println!("hello") with one argument or println!("hello {}",
name) with two arguments. Also, macros are expanded before
the compiler interprets the meaning of the code, so a macro
can, for example, implement a trait on a given type. A
function can’t, because it gets called at runtime and a
trait needs to be implemented at compile time.

The downside to implementing a macro instead of a function
is that macro definitions are more complex than function
definitions because you’re writing Rust code that writes
Rust code. Due to this indirection, macro definitions are
generally more difficult to read, understand, and maintain
than function definitions.

Another important difference between macros and functions is
that you must define macros or bring them into scope before
you call them in a file, as opposed to functions you can
define anywhere and call anywhere.


 
Это точно было жизненно нужно? Язык ещё и завоевать популярность толком не успел, как уже возрастает его внутренняя сложность. Причём это уже сразу by design, насколько я понял, а не следствие решения каких-то задач и проблем. Люди, которые начнут писать на хрусте большие сложные проекты, столкнутся с невозможностью управления их сложностью, особенно в случае, когда новым людям придётся разбирать то, что написали до них. Нет, я не прав?
 

Ваше сообщение
Имя*:
EMail:
Для отправки ответов на email укажите знак ! перед адресом, например, !user@host.ru (!! - не показывать email).
Более тонкая настройка отправки ответов производится в профиле зарегистрированного участника форума.
Заголовок*:
Сообщение*:
 
При общении не допускается: неуважительное отношение к собеседнику, хамство, унизительное обращение, ненормативная лексика, переход на личности, агрессивное поведение, обесценивание собеседника, провоцирование флейма голословными и заведомо ложными заявлениями. Не отвечайте на сообщения, явно нарушающие правила - удаляются не только сами нарушения, но и все ответы на них. Лог модерирования.



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру