1. Prototype-Based Programming
- Posted by TheresNoTime Sep 25, 2013
- 2448 views
I saw in the Archive several extensions, which injected OOP to Euphoria. However, the creators of Euphoria, apparently, are the enemies of this paradigm. So I'm not sure OOP appears in the fifth version. So, what about Prototype-Based Programming? AFAIK, it is easier to implement, easier to grasp, easier to code.
2. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 25, 2013
- 2422 views
I saw in the Archive several extensions, which injected OOP to Euphoria. However, the creators of Euphoria, apparently, are the enemies of this paradigm.
Yes! I fight to the death against OOP. No, actually, this isn't true. In fact, there are vague plans to add OOP programming paradigms to euphoria. This would be a pretty massive undertaking, and would certainly be a new major version (e.g., eu5).
So I'm not sure OOP appears in the fifth version. So, what about Prototype-Based Programming? AFAIK, it is easier to implement, easier to grasp, easier to code.
In fact, prototype based programming is just one way to implement OOP. There are no firm plans on how OOP could be introduced into euphoria. There have been discussions, and they generally turn very contentious between OOP supporters and detractors and between proponents of different OOP implementation ideas.
I'd be interested to hear if you have an idea about how to put prototype based OOP into euphoria.
Matt
3. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 25, 2013
- 2351 views
I saw in the Archive several extensions, which injected OOP to Euphoria. However, the creators of Euphoria, apparently, are the enemies of this paradigm.
Yes! I fight to the death against OOP.
I myself is not a OOP-fan[atic]. On the contrary, this paradigm is alien to me. But how else to develop a program consisting of several large pieces? In principle, it is possible to realize the communication between parts in pure Euphoria (stuffing maps in the stack). But it is the invention of bicycles.
No, actually, this isn't true. In fact, there are vague plans to add OOP programming paradigms to euphoria. This would be a pretty massive undertaking, and would certainly be a new major version (e.g., eu5).
Even so, I can not wait. I have three ways:
1. Add one of the OOP-extensions in the Euphoria. The main drawback of this approach: I do not know what extension to choose. And all of a sudden it will not work?
2. Choose mainstream OOP-language such as C#.
3. Find another way of splitting the program into parts. For example, dissect it to independent programs that communicate through files (in 21th century!).
I'd be interested to hear if you have an idea about how to put prototype based OOP into euphoria.
Matt
Unfortunately, I can provide such information only in Russian. Search about what's inside the PBP in JavaScript, Lua or other PBP-language. In short, the PBP is programming with objects, but without classes. Each object is unique. Thus, we can not inherit classes (because they are not). It's not so bad. Many believe that the inheritance is the evil. In the GO language (by Google!) no inheritance. As far as I know, this is called "anemic OOP". (But I'm not sure I understand correctly this term.) This is not the first example, where the improvement is to avoid something. For example, the avoid of the operator GOTO improves the structure of the programs. So, what we have instead of inheritance? Cloning! We can clone any object. It is possible to do in almost any language, that have some structure, which capable to store data and pointers (routine_id). For example, PBP in Lua is just syntactic sugar for it's tables.
4. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 25, 2013
- 2321 views
I myself is not a OOP-fan[atic]. On the contrary, this paradigm is alien to me. But how else to develop a program consisting of several large pieces? In principle, it is possible to realize the communication between parts in pure Euphoria (stuffing maps in the stack). But it is the invention of bicycles.
This is nothing new. Euphoria is a procedural language, like C. It is possible to write independent modules or libraries that can be used in concert, just like you could design a system of classes using OOP to do so.
No, actually, this isn't true. In fact, there are vague plans to add OOP programming paradigms to euphoria. This would be a pretty massive undertaking, and would certainly be a new major version (e.g., eu5).
Even so, I can not wait. I have three ways:
1. Add one of the OOP-extensions in the Euphoria. The main drawback of this approach: I do not know what extension to choose. And all of a sudden it will not work?
2. Choose mainstream OOP-language such as C#.
3. Find another way of splitting the program into parts. For example, dissect it to independent programs that communicate through files (in 21th century!).
I guess your user name is appropriate, then.
I don't see why OOP is really necessary. I also don't know why, if you picked one of the existing libraries, it might stop working (aside from it possibly using something that becomes a reserved word in a future version).
I think dissecting your program into independent programs is a step farther than you need to go. Why can't they just be separate parts of the same program? Can you give a summary of what you're trying to do? Someone might be able to help give you ideas. It's not at all clear to me why OOP is the only way to solve your problem.
I'd be interested to hear if you have an idea about how to put prototype based OOP into euphoria.
Unfortunately, I can provide such information only in Russian.
Well...I was thinking more along the lines of an example of euphoria code in a hypothetical euphoria with PBP.
Matt
5. Re: Prototype-Based Programming
- Posted by useless_ Sep 25, 2013
- 2308 views
I'd be interested to hear if you have an idea about how to put prototype based OOP into euphoria.
Unfortunately, I can provide such information only in Russian.
Didn't Karl do OOP for Eu in Russian? Check archives. Matt did Eu OOP too, but it slowed to a stop eventually. I am not a fan for OOP either, but i did write posts supporting Matt's version of OOP for Eu.
useless
6. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 25, 2013
- 2329 views
Well...I was thinking more along the lines of an example of euphoria code in a hypothetical euphoria with PBP.
Matt
prototype person = clone() properties(person) sequence name integer age procedure greet() puts(1, "Hello, my name is " & name & "!\n") end procedure end properties ----------------------- prototype worker = clone(person) properties(worker) procedure work(prototype self) puts(1, "I am " & sprint(self.age) & "years old and I need a job.\n") if self.age < 18 then puts(1, "The exploitation of children is prohibited.") else puts(1, "Now " & self.name "makes some money!") end if end procedure end properties ----------------------- Mike = clone(worker) Mike.name = "Mike" Mike.age = 99 -- :) Mike.greet() Mike.work() -- output: Hello, my name is Mike! I am 99 years old and I need a job! Now Mike makes some money!
7. Re: Prototype-Based Programming
- Posted by EUWX Sep 25, 2013
- 2384 views
According to the URL supplied: "Prototype-based programming is a style of object-oriented programming".
I thoroughly dislike OOP. I agree with the following:-
"Paul Graham has suggested that the purpose of OOP is to act as a "herding mechanism" that keeps mediocre programmers in mediocre organizations from "doing too much damage". This is at the expense of slowing down productive programmers who know how to use more powerful and more compact techniques.".... source wikipaedia.
8. Re: Prototype-Based Programming
- Posted by ghaberek (admin) Sep 25, 2013
- 2355 views
According to the URL supplied: "Prototype-based programming is a style of object-oriented programming".
I thoroughly dislike OOP. I agree with the following:-
"Paul Graham has suggested that the purpose of OOP is to act as a "herding mechanism" that keeps mediocre programmers in mediocre organizations from "doing too much damage". This is at the expense of slowing down productive programmers who know how to use more powerful and more compact techniques.".... source wikipaedia.
I've felt the same way for the longest time, but OOP certainly has its place in programming. I think it's important to consider Graham's initial comment as well:
Paul Graham also programs in Lisp, so what does he know?
-Greg
9. Re: Prototype-Based Programming
- Posted by EUWX Sep 25, 2013
- 2354 views
"You should be able to define new types, but you shouldn't have to express every program as the definition of new types."
Well I like, symmetrical matrices i.e. matrices with same shape throughout (2 and 3 dimensions filled fully); I can define them once and use the same code to define in all my programs.
In short, oop is not useful at all.
10. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 25, 2013
- 2398 views
"You should be able to define new types, but you shouldn't have to express every program as the definition of new types."
Well I like, symmetrical matrices i.e. matrices with same shape throughout (2 and 3 dimensions filled fully); I can define them once and use the same code to define in all my programs.
In short, oop is not useful at all.
What?
http://www.youtube.com/watch?v=Qtqp-RUw87M
Matt
11. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 25, 2013
- 2302 views
"You should be able to define new types, but you shouldn't have to express every program as the definition of new types."
Well I like, symmetrical matrices i.e. matrices with same shape throughout (2 and 3 dimensions filled fully); I can define them once and use the same code to define in all my programs.
In short, oop is not useful at all.
What?
Matt
Actually, though it's possible I'm misunderstanding or something, this appears to make sense to me.
Basically, using the example of custom matrices, OP points out that OP can make new types without having to resort to OOP to do it. In other words, OOP is not necessary even if you want to be able to define new types - so that's one OOP-only use case that can be crossed off the list. Or something like that, anyways.
12. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 25, 2013
- 2284 views
Actually, though it's possible I'm misunderstanding or something, this appears to make sense to me.
Basically, using the example of custom matrices, OP points out that OP can make new types without having to resort to OOP to do it. In other words, OOP is not necessary even if you want to be able to define new types - so that's one OOP-only use case that can be crossed off the list. Or something like that, anyways.
Yeah...except that's not what he said, even if it's what he meant. His statement about OOP was just a non sequitur. At best, a statement of personal preference.
Matt
13. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 25, 2013
- 2330 views
Yes, OOP isn't silver bullet. There are other techniques. Lisp is functional language. Component Pascal (created by OOP-hater Niklaus Wirth) is component-oriented. The most understandable explanation of component paradigm (if you familiar with .NET a bit, like me). Imagine that you have made several class libraries (possibly in different languages) and compiled them in a separate DLLs. Then you glue them using PowerShell. But how to glue DLLs writed in Euphoria? Get and send parameters by win32lib? Thanks, but I know easier ways to commit suicide.
Euphoria is pure (poor) procedural language. I started the program in Euphoria, it was very simple, but now simplicity prevent me to continue. Erlang based on unique paradigm, where each part of program is independent process (with it's own memory, data flow, garbage collector). Processes can send messages similar to e-mail. Processes receive the messages sent to them (as well as broadcast messages). What will they do with them - it depends on the process, on nothing else. This allows you to do these tricks, as an update of the program during its operation. So you can reinstall the operating system, and then proceed to answer your interlocutors by e-mail. These will look like you were late with a response, but communication is not interrupted.
Yes, all of them possible to organize in the Euphoria. Instead of messages - stack of maps. Instead of prototypes - maps containing not only data, but also pointers. You can organize the stack of messages. Not necessarily between several programs, even though it is possible (via sockets, for example).
I'm not saying that we should implement this paradigm. I was just demonstrating the flexibility of different approaches. No matter what the approach. Maybe later I will demonstrate a prototype implementation of a prototype paradigm. :) But what do you propose to Euphoria? Why Wirth did not stop at the stage of Modula-2, if modularity is enough? By the way, modern (I mean, younger than 20 years, haha) Pascals is not improved Pascal, but degraded Modula-2.
What is Euphoria in such sense? I think it is somewhere between modern Pascal and Modula-2. Maybe I'm wrong, and it is placed below. But not above, sure.
14. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 26, 2013
- 2243 views
Actually, though it's possible I'm misunderstanding or something, this appears to make sense to me.
Basically, using the example of custom matrices, OP points out that OP can make new types without having to resort to OOP to do it. In other words, OOP is not necessary even if you want to be able to define new types - so that's one OOP-only use case that can be crossed off the list. Or something like that, anyways.
Yeah...except that's not what he said, even if it's what he meant.
Agreed. I took it more liberally than literally (e.g. "Conclusion: this is not a case where OOP is particularly useful.") but OP's follow-on posts suggests I was wrong to do so.
His statement about OOP was just a non sequitur. At best, a statement of personal preference.
Matt
Agreed.
15. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 26, 2013
- 2243 views
But how to glue DLLs writed in Euphoria? Get and send parameters by win32lib?
No, there are much easier ways. Read the documentation.
Euphoria is pure (poor) procedural language.
Actually, this is less true of 4.0 than of earlier versions. We have a couple of features that are not exactly purely procedural now.
I started the program in Euphoria, it was very simple, but now simplicity prevent me to continue.
Why? Nothing in Euphoria prevents complex programs from being developed.
Erlang based on unique paradigm, where each part of program is independent process (with it's own memory, data flow, garbage collector). Processes can send messages similar to e-mail. Processes receive the messages sent to them (as well as broadcast messages). What will they do with them - it depends on the process, on nothing else. This allows you to do these tricks, as an update of the program during its operation.
Yes, I do this all the time with Euphoria.
So you can reinstall the operating system, and then proceed to answer your interlocutors by e-mail. These will look like you were late with a response, but communication is not interrupted.
Or you could reinstall a more conventional/traditional operating system without these features, then proceed to answer your e-mail. E-mail is not meant to be real-time, there's no need to use any of Erlang's tricks or novel features to do what you are describing here.
What is Euphoria in such sense? I think it is somewhere between modern Pascal and Modula-2. Maybe I'm wrong, and it is placed below. But not above, sure.
You lack a sufficient grasp of the language to make that determination, based on your inaccurate explanations on the uses and pitfalls of Euphoria thus far. Even if you did however, you haven't adaquately explained why this is the case or what you'd want to do about it.
16. Re: Prototype-Based Programming
- Posted by BRyan Sep 26, 2013
- 2264 views
Don't spend so much time debating and deciding what a user can do
and not do with Euphoria.
Try using the basic features of the language.
17. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 26, 2013
- 2247 views
I whipped up a really simple framework for doing prototype based programming in euphoria. This probably duplicates some of the old OOP libraries in the archive, except that it uses euphoria's maps and it has no error checking.
-- prototype.e namespace proto include std/map.e public type prototype( object p ) return map( p ) end type public function new( object p = "" ) if prototype( p ) then return map:copy( p ) else return map:new() end if end function public function call( prototype p, object method, object args = {}) if atom( args ) then args = { p, args } else args = prepend( args, p ) end if return call_func( map:get( p, method ), args ) end function public function get( prototype p, object property ) return map:get( p, property ) end function public procedure set( prototype p, object property, object value ) map:put( p, property, value ) end procedure
...and then it could be used like so:
-- prototype.ex include prototype.e enum NAME, LIFEPOINTS, GREET prototype creature = proto:new() proto:set( creature, NAME, "" ) proto:set( creature, LIFEPOINTS, 100 ) function person_greeter( prototype p ) printf(1, "Hello, my name is %s\n", { proto:get( p, NAME ) }) return 0 end function prototype person = proto:new( creature ) proto:set( person, GREET, routine_id("person_greeter") ) prototype bob = proto:new( person ) proto:set( bob, NAME, "Bob" ) function hispanic_greeting( prototype p ) printf(1, "Hola, me llamo %s\n", { proto:get( p, NAME ) }) return 0 end function prototype juan = proto:new( person ) proto:set( juan, GREET, routine_id("hispanic_greeting" ) ) proto:set( juan, NAME, "Juan" ) prototype luis = proto:new( juan ) proto:set( luis, NAME, "Luis" ) proto:call( bob, GREET ) proto:call( juan, GREET ) proto:call( luis, GREET )
$ eui prototype.ex Hello, my name is Bob Hola, me llamo Juan Hola, me llamo Luis
Obviously, any method needs to have the prototype object be its first parameter. Method / property identifiers can be whatever you want. I used an enum, but you could have sequences or whatever there. If you try to "get" something meant as a method, you'll get the routine id, of course. If you try to call a property, you'll likely get an error, unless the value is a valid routine id and your arguments match the signature of the target.
Matt
18. Re: Prototype-Based Programming
- Posted by jaygade Sep 26, 2013
- 2244 views
I'm skimming through the map info in the manual, do we have a good tutorial on using Euphoria's maps?
I think that it would tie into this very well.
Question: would it be useful for each class file have its own map, or array of maps, or map of maps, to keep track of its own objects?
Or is each new map its own self-contained entity? (No, I haven't studied the code yet.)
19. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 26, 2013
- 2235 views
I'm skimming through the map info in the manual, do we have a good tutorial on using Euphoria's maps?
I don't think that we do. I think that they're mostly pretty straight forward. For most uses, new/put/get with default options will probably be enough.
I think that it would tie into this very well.
Obviously, I agree.
Question: would it be useful for each class file have its own map, or array of maps, or map of maps, to keep track of its own objects?
Or is each new map its own self-contained entity? (No, I haven't studied the code yet.)
If you're talking about "class" files, then you've left prototype based programming, where I think the answers are pretty simple and obvious: each object has its own map of properties and methods (this is pretty much what javascript objects are). In my library, objects are really just maps, along with some helper functions to make them nicer to work with. They're not as syntactically sweet as using typical dot notation.
One interesting thing about this is that a map is really an index (i.e., a pointer) so you aren't passing a map's data around, but passing a reference to the map's data. So a method could alter a map without you having to assign the result like you would if the object were a sequence. Also, different prototype objects could share references to prototype objects. This saves a lot on performance due to reduced copy on write operations that you'd need if you were passing sequences around and changing them. The map library goes to a lot of trouble to avoid copy on write where possible.
For a class based approach, you probably need to have each class with its own map, and objects keep a reference to their class type so that the framework can reference the map to get work done.
Matt
20. Re: Prototype-Based Programming
- Posted by ghaberek (admin) Sep 26, 2013
- 2250 views
For a class based approach, you probably need to have each class with its own map, and objects keep a reference to their class type so that the framework can reference the map to get work done.
I like how we're practically having two ends of the same conversation: Procedural design patterns?.
-Greg
21. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 28, 2013
- 2104 views
But how to glue DLLs writed in Euphoria? Get and send parameters by win32lib?
No, there are much easier ways. Read the documentation.
Either I do not understand documentation, or you do not understand what I meant. Please indicate appropriate chapter of manual by your finger.
I started the program in Euphoria, it was very simple, but now simplicity prevent me to continue.
Why? Nothing in Euphoria prevents complex programs from being developed.
Complex program can be developed in any language. Cobol is ugly, but many large cobol-applications are still living, and even continue to grow.
Erlang based on unique paradigm, where each part of program is independent process (with it's own memory, data flow, garbage collector). Processes can send messages similar to e-mail. Processes receive the messages sent to them (as well as broadcast messages). What will they do with them - it depends on the process, on nothing else. This allows you to do these tricks, as an update of the program during its operation.
Yes, I do this all the time with Euphoria.
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
So you can reinstall the operating system, and then proceed to answer your interlocutors by e-mail. These will look like you were late with a response, but communication is not interrupted.
Or you could reinstall a more conventional/traditional operating system without these features, then proceed to answer your e-mail. E-mail is not meant to be real-time, there's no need to use any of Erlang's tricks or novel features to do what you are describing here.
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.
22. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 28, 2013
- 2112 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
23. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 28, 2013
- 2131 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?
I did not say I need it. It was an example of the Erlang's versatility. Perhaps this complication in the form in which you are using it. Because there is no Euphoria means to do so, and your solution - it's a crutch. When the partition of the program into independent modules supported on the design level, it is a huge help. Manner dosn't matter - Erlang's messages, PowerShell's cmdlets, Zonnon's components... Euphoria's C-like DLLs are in a different row.
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?
It looks like this:
It looks completely different. The closest analogy - two (or more) programs that operate in parallel and communicate via sockets.
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.
Concatenative programming languages do not have this problem because the scalability, in fact, the only element of the language. :)
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
I knew all this before. As I suspected, you do not understand me.
24. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 28, 2013
- 2271 views
Manner dosn't matter - Erlang's messages, PowerShell's cmdlets, Zonnon's components... Euphoria's C-like DLLs are in a different row.
Agreed. That's because they do something entirely different and are meant for a different purpose. Don't compare apples to oranges.
Take a look at what it takes to wrap a C library for Python http://docs.python.org/2/extending/extending.html or Java http://www.ibm.com/developerworks/java/tutorials/j-jni/
I did not say I need it. It was an example of the Erlang's versatility.
This sounds plausible.
However, based on your serious and significant misunderstands of Euphoria, I'm reluctant to take your word for this. Instead, show me an example Erlang program which uses this capability and demonstrates Erlang's versatility.
It looks completely different. The closest analogy - two (or more) programs that operate in parallel and communicate via sockets.
There is no communication via socket in my example. I contend that my example is essentially the same as PowerShell's cmdlets - both execute a helper script (akak a cmdlet), passing arguments via the command line: http://www.powershellpro.com/powershell-tutorial-introduction/tutorial-powershell-cmdlet/
Perhaps this complication in the form in which you are using it. Because there is no Euphoria means to do so, and your solution - it's a crutch. When the partition of the program into independent modules supported on the design level, it is a huge help.
Agreed. Although you can effectively write and use cmdlets-like scripts in Euphoria, you have to write a bit of crutch-like code to do so. Perhaps there is room in the standard library for a cmdlet library - or even a preprocessor, if you want syntax sugar - to make this easier and more elegant looking.
Concatenative programming languages do not have this problem because the scalability, in fact, the only element of the language. :)
All programming languages have their warts. E.g. http://www.erlang.org/faq/academic.html#id56798
http://mylazycoding.blogspot.com/2011/04/my-love-hate-relationship-with-erlang.html
and so on.
But how to glue DLLs writed in Euphoria? Get and send parameters by win32lib?
Either I do not understand documentation, or you do not understand what I meant. Please indicate appropriate chapter of manual by your finger.
I knew all this before. As I suspected, you do not understand me.
Clearly. You knew how to use dlls before, but thought you should have gotten and sent parameters by win32lib instead of the simpler dll interface?
Very well. Please explain how to glue DLLs writed (sic) in Euphoria via getting and sending parameters by win32lib.
25. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 28, 2013
- 2256 views
Manner dosn't matter - Erlang's messages, PowerShell's cmdlets, Zonnon's components... Euphoria's C-like DLLs are in a different row.
Agreed. That's because they do something entirely different and are meant for a different purpose. Don't compare apples to oranges.
So, I want cocktail. ;)
Take a look at what it takes to wrap a C library for Python http://docs.python.org/2/extending/extending.html or Java http://www.ibm.com/developerworks/java/tutorials/j-jni/
You did not want to understand the context in which the library is referenced. Python and Java not required C-DLLs in the sense in which I mentioned them. Python is possible to expand the standard means of Python. C-DLLs are used for speed or for access nonexistent features. But how to expand Euphoria? C-DLL?
I did not say I need it. It was an example of the Erlang's versatility.
This sounds plausible.
However, based on your serious and significant misunderstands of Euphoria, I'm reluctant to take your word for this. Instead, show me an example Erlang program which uses this capability and demonstrates Erlang's versatility.
It looks completely different. The closest analogy - two (or more) programs that operate in parallel and communicate via sockets.
There is no communication via socket in my example. I contend that my example is essentially the same as PowerShell's cmdlets - both execute a helper script (akak a cmdlet), passing arguments via the command line: http://www.powershellpro.com/powershell-tutorial-introduction/tutorial-powershell-cmdlet/
Very funny. You found the manual, which says that the car can emit beeps and decided that the car - it's a hunting decoy.
Perhaps this complication in the form in which you are using it. Because there is no Euphoria means to do so, and your solution - it's a crutch. When the partition of the program into independent modules supported on the design level, it is a huge help.
Agreed. Although you can effectively write and use cmdlets-like scripts in Euphoria,
NO. You don't understand, what is cmdlets really. They are not programs, they are classes. Cmdlet is run not in a separate process, but inside PowerShell. This makes it possible to object exchange (in the sense of OOP) between cmdlets.
Concatenative programming languages do not have this problem because the scalability, in fact, the only element of the language. :)
All programming languages have their warts. E.g. http://www.erlang.org/faq/academic.html#id56798
http://mylazycoding.blogspot.com/2011/04/my-love-hate-relationship-with-erlang.html
and so on.
If I have to cross the terrain with sharp stones, I'd rather ditch the Ferrari, but do not go barefoot.
But how to glue DLLs writed in Euphoria? Get and send parameters by win32lib?
Either I do not understand documentation, or you do not understand what I meant. Please indicate appropriate chapter of manual by your finger.
I knew all this before. As I suspected, you do not understand me.
Clearly. You knew how to use dlls before, but thought you should have gotten and sent parameters by win32lib instead of the simpler dll interface?
Very well. Please explain how to glue DLLs writed (sic) in Euphoria via getting and sending parameters by win32lib.
OMG. Do not cling to the words. I do not remember such things, preferring every time specify in the documentation. Explain otherwise. It would be great if there was a standard way to establish communication between the two programs at Euphoria. For example, I pass the map to function and get a sequence. I can send to DLL a few numbers only. That's enough to send signals or memory addresses. You can make a loop and pass numbers one by one, then restore original format and order, but it is ugly. You can save to file, but it is fraught with collisions. And so on. There is no easy way. PowerShell have such way. Actually, this is how it works. When you send picture from one program to another by unix-pipeline, it seems like you put picture and get picture, but internally it is just bytes flow. When you send picture from one cmdlet to another cmdlet, it is picture internally.
26. Re: Prototype-Based Programming
- Posted by jimcbrown (admin) Sep 28, 2013
- 2248 views
You did not want to understand the context in which the library is referenced. Python and Java not required C-DLLs in the sense in which I mentioned them.
Then Euphoria shouldn't either.
Python is possible to expand the standard means of Python. C-DLLs are used for speed or for access nonexistent features. But how to expand Euphoria? C-DLL?
I think the usage of C-DLLs between Python and Euphoria is the same.
Unlike Python, Euphoria includes a built-in preprocessor. This makes it very easy to expand.
That's a pretty good anecdote. I was expecting example code, however.
Still, I'd rather take Francesco Cesarini's word for it than yours.
There is no communication via socket in my example. I contend that my example is essentially the same as PowerShell's cmdlets - both execute a helper script (akak a cmdlet), passing arguments via the command line: http://www.powershellpro.com/powershell-tutorial-introduction/tutorial-powershell-cmdlet/
Very funny. You found the manual, which says that the car can emit beeps and decided that the car - it's a hunting decoy.
No, I figured out how to take apart a ship and turn it into a coral reef. I didn't need to use a manual, either, but that's irrevelant here.
Agreed. Although you can effectively write and use cmdlets-like scripts in Euphoria,
NO. You don't understand, what is cmdlets really. They are not programs, they are classes. Cmdlet is run not in a separate process, but inside PowerShell. This makes it possible to object exchange (in the sense of OOP) between cmdlets.
Ok, I'll give you that. If you want all this AND it must be inside the same process/thread/etc (but why?) - that's not supported. There are versions of Euphoria that support this (http://openeuphoria.org/forum/m/30957.wc) but it's not standard.
If I have to cross the terrain with sharp stones, I'd rather ditch the Ferrari, but do not go barefoot.
I think this goes right in line with KISS.
OMG. Do not cling to the words. I do not remember such things, preferring every time specify in the documentation.
The last sentence is grammatically incorrect to the extent that I am not able to understand what you mean. (Normally, I don't care about such things as I can figure out what is meant anyways so it's not a problem.)
Explain otherwise. It would be great if there was a standard way to establish communication between the two programs at Euphoria.
Agreed. At the moment, there is not a "standard" one. We have standard methods of IPC (pipeio and sockets), which work with any kind of program, not just specifically Euphoria ones.
For example, I pass the map to function and get a sequence. I can send to DLL a few numbers only.
This is simply false. This is especially false if the DLL is written in Euphoria itself. Not only that, I pointed you to the documentation that explains how to pass things like complex sequences to an Euphoria DLL, and you said you already knew it Who is misunderstanding now?
You can save to file, but it is fraught with collisions. And so on.
Euphoria supports file locking, which should help mitigate this and make it managable. Not saying that file sharing is the best way, but if someone really wanted to do it this way using files, it can be done.
There is no easy way. PowerShell have such way. Actually, this is how it works. When you send picture from one program to another by unix-pipeline, it seems like you put picture and get picture, but internally it is just bytes flow. When you send picture from one cmdlet to another cmdlet, it is picture internally.
Agreed. The only exception to this is with Euphoria DLLs, where you can send the picture (represented by a sequence) internally. Otherwise, the technique used generally will invoke something like http://www.tutorialspoint.com/java/java_serialization.htm - simply because it's easier to do it this way in Euphoria.
But the exception to the rule does away with the rule entirely! It's possible to write a C DLL that would take a "picture" from one Euphoria program and make it accessible to another Euphoria program, without any sort of serialization. This is really hard, which is why Pete Lomax's Phix is the only one to do anything like this. But such a DLL would only need to be written once.
27. Re: Prototype-Based Programming
- Posted by mattlewis (admin) Sep 28, 2013
- 2162 views
Explain otherwise. It would be great if there was a standard way to establish communication between the two programs at Euphoria.
Agreed. At the moment, there is not a "standard" one. We have standard methods of IPC (pipeio and sockets), which work with any kind of program, not just specifically Euphoria ones.
Yes, there's a lot of potential there, but we haven't capitalized on it much. I started an RPC library a few months that I plan to use with wxIDE to implement remote debugging:
https://bitbucket.org/mattlewis/euphoria-rpc
It's fairly simple right now, but it basically works. Also, the std library has serialize.e, so we can serialize and deserialize euphoria objects (which my RPC library uses).
Matt
28. Re: Prototype-Based Programming
- Posted by useless_ Sep 28, 2013
- 2105 views
Explain otherwise. It would be great if there was a standard way to establish communication between the two programs at Euphoria.
Agreed. At the moment, there is not a "standard" one. We have standard methods of IPC (pipeio and sockets), which work with any kind of program, not just specifically Euphoria ones.
http://rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=shared+memory
useless
29. Re: Prototype-Based Programming
- Posted by useless_ Sep 28, 2013
- 2121 views
Explain otherwise. It would be great if there was a standard way to establish communication between the two programs at Euphoria.
Agreed. At the moment, there is not a "standard" one. We have standard methods of IPC (pipeio and sockets), which work with any kind of program, not just specifically Euphoria ones.
http://rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=shared+memory
useless
Also, we can now load and kill DLLs at will, so if you don't like the code in one, write a new one, kill the old one, load the new one. Save data somewhere in between.
useless
30. Re: Prototype-Based Programming
- Posted by TheresNoTime Sep 29, 2013
- 2088 views
Here's what I found. - http://www.rapideuphoria.com/ipc.zip It's funny that I came across it while looking for another thing (finite states machine).
It seems to be something similar to the prototypes. - http://www.rapideuphoria.com/oop.zip