Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 28, 2013
- 2111 views
OMG. You don't understand. Emails and OS was analogy. You can shutdown part of Erlang-program and install new version. All the other parts did not notice.
I understood - like I said, I do this all the time in Euphoria. I was extending your analogy further - even though you can do this, I question if you really need this capability. Why overcomplicate things? Whatever happened to KISS?
WHAT??? HOW??? For example, I create ineffective function Factorial. When i=1000, I noticed it and create effective version. How to change contents of Factorial() on the fly, that the program has continued to work and previous calculations are not lost?
export function Factorial(integer x) ... end function for i = 1 to 1_000_000 do puts(1, Factorial(i)) end for
It looks like this:
-- fact.ex include std/get.e include std/sequence.e function inner_Factorial(integer x) integer fact_file = open("fact_file.get", "r") sequence factorial_memory = "" if (fact_file != -1) then factorial_memory = get(fact_file) close(fact_file) end if ... fact_file = open("fact_file.get", "w") print(fact_file, factorial_memory) close(fact_file) end function printf(1, "%d\n", Factorial(fetch(value(fetch(command_line(), {3})),{2}))) -- main.ex include std/pipeio.e export function Factorial(integer x) object p = pipeio:exec(sprintf("eui fact.ex %d", {x}), pipeio:create()) sequence s = pipeio:read(p[STDOUT], 4096) pipeio:kill(p) s = value(s) return s[2] end function for i = 1 to 1_000_000 do puts(1, Factorial(i)) end for
Complex program can be developed in any language. Cobol is ugly, but many large cobol-applications are still living, and even continue to grow.
True. Of course, that's a problem for any complex program, regardless of language - even the most elegant of all, Lisp.
Either I do not understand documentation, or you do not understand what I meant. Please indicate appropriate chapter of manual by your finger.
I used that finger to type this. That counts, right?
http://openeuphoria.org/wiki/view/UsingDLLs.wc
http://openeuphoria.org/docs/std_dll.html#_5465_define_c_func