[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Стабильная система?



Артём Н. -> debian-russian@lists.debian.org  @ Fri, 16 Oct 2015 16:04:15 +0300:

 АН> Хосспади, OCaml... o.O
 АН> Может, когда требуется "большой кусок в императивном стиле",
 АН> следует отказаться от использования функционального языка в сторону императивного?
 АН> Или религия не позволяет? ;-)

А смысл, если есть язык, который это позволяет прямо тут?  Ocaml,
насколько я понимаю, ничем не плох.

 >>>> 1) Позволяет более просто комбинировать функциональное и императивное
 >>>> программирование: не надо изворачиваться монадами, чтобы добиться
 >>>> последовательного выполнения команд.
 >>>>
 >>> Но зачем?
 >>
 >> "This is no matter of religion or esthetics; a priori neither style is
 >> prettier or holier than the other. On the contrary, one style may be
 >> more adequate than the other depending on the problem to be solved.
 >>
 >> The first rule to apply is the rule of simplicity. Whether the algorithm
 >> to use implemented is written in a book, or whether its seed is in the
 >> mind of the programmer, the algorithm is itself described in a certain
 >> style. It is natural to use the same style when implementing it.
 >>
 >> The second criterion of choice is the efficiency of the program. One may
 >> say that an imperative program (if well written) is more efficient that
 >> its functional analogue, but in very many cases the difference is not
 >> enough to justify complicating the code to adopt an imperative style
 >> where the functional style would be natural". [1]
 >>
 >> Бывает, что императивное программирование разумнее. Большинство
 >> алгоритмов можно писать в функциональном стиле, но бывает и так, что это
 >> порождает большой оверхед в производительности. При столкновении с
 >> подобным "узким горлом" приходится реализовывать часть функционала в
 >> императивном стиле. Например, управление большими словарями много
 >> выгоднее, если они мутабельны.
 >>
 >> [1] http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora038.html
 >>


Reply to: