1. Some initial clarifications

Hi all,

I am going to continue the work I did some years ago in C++, and I'm trying to find the best language/environment for me. I want to implement algorithms for clustering and genetic algorithms.

At the time, I was fighting the language, more than using my brain cycles to solve the problems at hand. I was almost decided to go with Pascal, but then saw Euphoria in my bookmarks and decided to read more about it.

As I'm looking for simple things in life and oE and Phix seem to fit this initial requisite, there are some more questions I'd like some explanation.

1. In C++, I used vector (and arrays) containers as I needed to make computations between the 2D place of a element in a matrix and its eight neighbors. For that vector and arrays, as they are random access very fast fitted the necessity. Is it possible to do this in oE with equivalent speed? I don't mind 30 or 50% more execution time, but can not tolerate ten times more.

2. I've seen the most recent speed benchmark in the forum. Are there any other more intensive benchmarks comparing oE to C or C++ in respect to speed and memory use?

3. Have no experience in parallelism and in C++ looked hard for me that have no formal education in programming. I know the subject is not easy for many kinds of work. In oE, is it simpler than in C/C++?

3. Is it possible to create graphics like these: https://youtu.be/HWMJdO4klIE?t=2026

4. Is there support to load and save text files of CSV, XML and other formats?

5. I've read about the several GUI toolkits available. Later on I'll need one. Never done such thing, except in Red, is iup easy? Really didn't want to learn GTK as it seems a mammoth to me.

6. The website seems to have contents outdated. Is version 4.1 stable or beta? https://openeuphoria.org/wiki/view/DownloadEuphoria.wc seems to show 4.0.5 as stable. Is there no 4.1 for Linux x86_64? I come so?

7. After git cloning https://github.com/OpenEuphoria/euphoria.git tried to build from sources but got an error.

8. Is Phix able to execute faster and have less memory requirements than oE for the subject of my work?

9. Followed the download instruction for Phix x86_64, but got a segmentation error. Raised an issue at https://bitbucket.org/petelomax/phix Is Linux a second quality supported OS for either oE and Phix?

Many questions but I need to have these answers.

Thanks in advance.


writing c + + results in some formatting noise; while writing cxx or c++ cleans this up

_tom

new topic     » topic index » view message » categorize

2. Re: Some initial clarifications

I can only answer some of these:

5: IUP would work for the graphic intensive work you indicate, but the IUP wrapper is a "work in progress", I don't know if the graphics are complete.

EuGTK could do this using Cairo graphics, which might be fast enough for your use. GTK also supports OpenGL, which would be faster, but I haven't spent much time with that, so can't comment on the difficulty.

Have you looked at the EuGTK documentation and demos? I think you'll find GTK very easy to use. The GTK.org documentation itself is not a good place to start - they make things harder than necessary. EuGTK "wraps" many of the more tedious gtk operations so that they are easier to use.

6: While 4.1 beta 2 is still "testing", it is the one most people use. So far, I've only found one obscure bug, which involves using a built-in function (such as sin()) as a case variable. This is easily avoided.

Linux 64-bit is on the downloads page, but if you prefer an easier install, I've put a .deb package here: https://sites.google.com/site/euphoriagtk/Home

new topic     » goto parent     » topic index » view message » categorize

3. Re: Some initial clarifications

lib9 said...

I want to implement algorithms for clustering and genetic algorithms.

I've recently been wondering if oE/Phix could handle some genetic algorithms.

lib9 said...

3. Is it possible to create graphics like these: https://youtu.be/HWMJdO4klIE?t=2026

For sure. You can use either wxEuphoria or EuGTK. I'm sure both could handle it easily.

lib9 said...

4. Is there support to load and save text files of CSV, XML and other formats?

Yes.

lib9 said...

Never done such thing, except in Red, is iup easy?

Are you experienced with Red? That language has so much potential. I wish they'd hurry up and get to 1.0. grin

new topic     » goto parent     » topic index » view message » categorize

4. Re: Some initial clarifications

lib9 said...

I want to implement algorithms for clustering and genetic algorithms.

As it happens, I added https://rosettacode.org/wiki/K-means%2B%2B_clustering#Phix quite recently, not that you can run that...

lib9 said...

Is it possible to do this in oE with equivalent speed? I don't mind 30 or 50% more execution time, but can not tolerate ten times more.

Probably. There are going to be some cases where C-based languages are up to 8x faster, but on the whole actually reaching that is fairly unlikely (and OE's translate to C may help), conversely there may be cases where reference counting/copy-on-write means OE/phix does not always have to make copies "just in case", and that way end up being significantly faster.

lib9 said...

3. Have no experience in parallelism and in C++ looked hard for me that have no formal education in programming. I know the subject is not easy for many kinds of work. In oE, is it simpler than in C/C++?

OE does not do parallelism. I have done multi-threading in both C++ and phix, and found the latter significantly easier, but then again I am slightly biased.
If you are meaning SSE-style parallelism, neither OE nor phix do that (yet).

lib9 said...

3. Is it possible to create graphics like these: https://youtu.be/HWMJdO4klIE?t=2026

Yes. One example I would have pointed to is boids, but while I can run that on linux, you cannot. There's probably something similar in EuGTK.

lib9 said...

4. Is there support to load and save text files of CSV, XML and other formats?

Sure, in fact I've also just written a new builtin for xml handling on phix, not yet uploaded or properly documented though.
For csv, see https://rosettacode.org/wiki/CSV_data_manipulation#Euphoria and also for both, have a look in The Archive or PCAN.

lib9 said...

is iup easy? Really didn't want to learn GTK as it seems a mammoth to me.

I think it is. Right now, at least until I get a handle on that pesky segfault, your best bet is OE + EuGTK though.

lib9 said...

8. Is Phix able to execute faster and have less memory requirements than oE for the subject of my work?

Unanswerable. Probably not much margin either way.

lib9 said...

9. Followed the download instruction for Phix x86_64, but got a segmentation error. Raised an issue at https://bitbucket.org/petelomax/phix

Looking at it, struggling a bit.

lib9 said...

Is Linux a second quality supported OS for either oE and Phix?

Re Phix: Sadly, although I try my best, it is not entirely unfair to suggest that. I am a one-man band and spend more time on Windows than Linux.
Conversely OE might actually be better supported on Linux than Windows(?)

new topic     » goto parent     » topic index » view message » categorize

5. Re: Some initial clarifications

(duplicate post)

new topic     » goto parent     » topic index » view message » categorize

6. Re: Some initial clarifications

lib9 said...

I am going to continue the work I did some years ago in Cxx, and I'm trying to find the best language/environment for me. I want to implement algorithms for clustering and genetic algorithms.

  • oE|Phix are one-based indexing languages
  • if you are fixated by off-by-one indexing your algorithms will need work
lib9 said...

As I'm looking for simple things in life and oE and Phix seem to fit this initial requisite, there are some more questions I'd like some explanation.

  • simple is our strength
  • much easier to learn oe|Phix than some conventional language
lib9 said...

1. In Cxx, I used vector (and arrays) containers as I needed to make computations between the 2D place of a element in a matrix and its eight neighbors. For that vector and arrays, as they are random access very fast fitted the necessity. Is it possible to do this in oE with equivalent speed? I don't mind 30 or 50% more execution time, but can not tolerate ten times more.

There is only the sequence type which may simulate a 2D array

s = { { 1,2,3 }, 
      { 4,5,6 }, 
      { 7,8,9 } } 

Item 9 is s[3,3] ; a row is s[1], only column thinking is a bit different in the sequence world (but we have routines that take care of this).

You may find Phix indexing to be more flexible than oE indexing because Phix allows negative values for indexes.

You would have to show us what you expect from item 5 which is s[2][2]; I am not familiar with genetic algorithms.

lib9 said...

2. I've seen the most recent speed benchmark in the forum. Are there any other more intensive benchmarks comparing oE to C or Cxx in respect to speed and memory use?

My fault. I happend to find something Python is very bad at. In general both oE|Phix are fast. The small speed gain from 'c' is not worth the extra effort. We also had someone present the case that a LUA jit compiler will have great results. Julia crunches numbers but seems to have a slow startup time--it would not be fun to develop an algorithm that way.

I have not done any memory benchmarking.

lib9 said...

3. Have no experience in parallelism and in Cxx looked hard for me that have no formal education in programming. I know the subject is not easy for many kinds of work. In oE, is it simpler than in C/C?

oE has multi-taking but not parallel programming.

lib9 said...

4. Is there support to load and save text files of CSV, XML and other formats?

Should be no big problem.

lib9 said...

5. I've read about the several GUI toolkits available. Later on I'll need one. Never done such thing, except in Red, is iup easy? Really didn't want to learn GTK as it seems a mammoth to me.

euGTK is much simpler than GTK on 'c'.

The path of least resistance is Linux plus GTK.

IUP is great for simple GUI (Windows or Linux); but I get bogged down in the graphics; but others may help with this.

lib9 said...

6. The website seems to have contents outdated. Is version 4.1 stable or beta? https://openeuphoria.org/wiki/view/DownloadEuphoria.wc seems to show 4.0.5 as stable. Is there no 4.1 for Linux x86_64? I come so?

Remind me to kill the reference to oE4.0.5 (it is the "stable" version, but we all use 4.1) oE works well for Linux 32 and 64 bit. The "holding issue" is how the interpreter can have bug in the switch statement that compiles without a problem.

lib9 said...

8. Is Phix able to execute faster and have less memory requirements than oE for the subject of my work?

Seems to be a cat and mouse game. Sometimes oE sometimes Phix. The differences are small between the two. If your data is string based then Phix will have a memory advantage.

lib9 said...

Many questions but I need to have these answers.

I have no trouble saying oE|Phix are simpler, faster, more fun, ..., and easier to learn that some popular conventional language.

For a particular algorithm/application you may find a particular language that is the "best." That means you have to present us with a benchmark based on your project which we can help translate into oE|Phix. A specialized algorithm is difficult to comment on.

_tom

new topic     » goto parent     » topic index » view message » categorize

7. Re: Some initial clarifications

First of all, I want to thank all the people that have answered and to all involved in developing and maintaining this environment. For sure it's a lot of work, but I'm also sure that you do this and feel happy doing it!

irv said...

EuGTK could do this using Cairo graphics, which might be fast enough for your use. GTK also supports OpenGL, which would be faster, but I haven't spent much time with that, so can't comment on the difficulty.

Have you looked at the EuGTK documentation and demos? I think you'll find GTK very easy to use. The GTK.org documentation itself is not a good place to start - they make things harder than necessary. EuGTK "wraps" many of the more tedious gtk operations so that they are easier to use.

I took a look and it really doesn't seem difficult to do the basic stuff, at least. Cairo? Never done anything with it, although I've seen it many times. Hope can have some help on it from knowledgeable people in this forum.

irv said...

Linux 64-bit is on the downloads page, but if you prefer an easier install, I've put a .deb package here: https://sites.google.com/site/euphoriagtk/Home

I saw it, thanks. It's not at the top, then there were older version and I didn't scrolled more downwards. It could be at the top like the other versions, no?

euphoric said...

Are you experienced with Red? That language has so much potential. I wish they'd hurry up and get to 1.0.

I'm not experienced. Did some scripts, a web scrapping once, recently have done some scripts to solve AdventOfCode puzzles. I like the language, very good potential, but for my use don't want to use it.

petelomax said...

OE does not do parallelism. I have done multi-threading in both C and phix, and found the latter significantly easier, but then again I am slightly biased.

So does multi-threading use only one core?

petelomax said...

Re Phix: Sadly, although I try my best, it is not entirely unfair to suggest that. I am a one-man band and spend more time on Windows than Linux. Conversely OE might actually be better supported on Linux than Windows(?)

I admire your work. To implement a language in assembly when almost no one does it, reveals a lot about the character of a person. It's in line with MenuetOS and asmttpd web server. There are some projects that could get a little bit more resources that could make a big difference. Instead, people herd like sheep...

_tom said...

There is only the sequence type which may simulate a 2D array

s = { { 1,2,3 },  
      { 4,5,6 },  
      { 7,8,9 } }  

Item 9 is s[3,3] ; a row is s[1], only column thinking is a bit different in the sequence world (but we have routines that take care of this).

You may find Phix indexing to be more flexible than oE indexing because Phix allows negative values for indexes.

You would have to show us what you expect from item 5 which is s[2][2]; I am not familiar with genetic algorithms.

This is for the clustering algorithm. Suppose that each of those numbers are in fact sequences, to apply a euphoria/phix nomenclature. And I have to compare some of the atoms of nr. 5 to the corresponding atoms of each of the other eight sequences around it. And this should be repeated to all of the other sequences, in reality, it could be hundreds, thousands. And if the project goes live, could be much more. Since there is no parallelism, does multi-threading help here? Are sequences implemented as C arrays, not as linked lists?

new topic     » goto parent     » topic index » view message » categorize

8. Re: Some initial clarifications

lib9 said...

... This is for the clustering algorithm. Suppose that each of those numbers are in fact sequences, to apply a euphoria/phix nomenclature. And I have to compare some of the atoms of nr. 5 to the corresponding atoms of each of the other eight sequences around it. And this should be repeated to all of the other sequences, in reality, it could be hundreds, thousands. And if the project goes live, could be much more. ...

What are the expected lengths of a sequence? Are all the same, or will they vary in length?

new topic     » goto parent     » topic index » view message » categorize

9. Re: Some initial clarifications

irv said...
lib9 said...

... This is for the clustering algorithm. Suppose that each of those numbers are in fact sequences, to apply a euphoria/phix nomenclature. And I have to compare some of the atoms of nr. 5 to the corresponding atoms of each of the other eight sequences around it. And this should be repeated to all of the other sequences, in reality, it could be hundreds, thousands. And if the project goes live, could be much more. ...

What are the expected lengths of a sequence? Are all the same, or will they vary in length?

The length is the same for each sequence. I don't remember exactly but should be between twelve and sixteen atoms.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Some initial clarifications

lib9 said...
irv said...

What are the expected lengths of a sequence? Are all the same, or will they vary in length?

The length is the same for each sequence. I don't remember exactly but should be between twelve and sixteen atoms.

Ok, that's good. Comparing sequences of equal length is one of Euphoria's strong points. And it doesn't appear that memory would be a problem, either. As we've seen when comparing languages, some do some things markedly faster than others, while being slower at other things. I guess it depends upon the algorithm being used.

Most likely, the only way to know for sure if Euphoria can do the job would be to write some code.

new topic     » goto parent     » topic index » view message » categorize

11. Re: Some initial clarifications

Holy cow there's a lot to unpack here. Everyone's provided some great answers so far; I'd just like to throw my hat in the ring as well.

lib9 said...

I am going to continue the work I did some years ago in C++, and I'm trying to find the best language/environment for me. I want to implement algorithms for clustering and genetic algorithms.

Shameless plug: if you're fluent in C++ and want to burn some brain cells knocking out some code, I sure could use some help on wxEuphoria.

lib9 said...

At the time, I was fighting the language, more than using my brain cycles to solve the problems at hand. I was almost decided to go with Pascal, but then saw Euphoria in my bookmarks and decided to read more about it.

Just curious, where did you come across Euphoria? Was it recently? I've been dropping hints over on Reddit at r/learnprogramming.

lib9 said...

As I'm looking for simple things in life and oE and Phix seem to fit this initial requisite, there are some more questions I'd like some explanation.

I appreciate the simple things in life. Alan Kay once wrote, "simple things should be simple, complex things should be possible." Words to live by.

lib9 said...

1. In C++, I used vector (and arrays) containers as I needed to make computations between the 2D place of a element in a matrix and its eight neighbors. For that vector and arrays, as they are random access very fast fitted the necessity. Is it possible to do this in oE with equivalent speed? I don't mind 30 or 50% more execution time, but can not tolerate ten times more.

You should have no problem implementing this in Euphoria. You'll find it quite fast and with the Euphoria-to-C translator, you'll get speeds equivalent to hand-written C.

If you're curious how the translator works, Rob Craig posted some excellent notes on its internals years ago: Translator Internals (Jan 27, 2007).

lib9 said...

2. I've seen the most recent speed benchmark in the forum. Are there any other more intensive benchmarks comparing oE to C or C++ in respect to speed and memory use?

Not a whole lot but there are some around. Check out Interpreter Benchmarking, Interpreter Benchmark Results and Profiling.

One thing to keep in mind is that there is a huge advantage to using high-level language like Euphoria or Python due to the safety and simplicity they offer over inherently-complex languages like C or C++.

Even though the execution speed might be a bit slower, reducing your development and debugging time is often worth the speed trade-off.

lib9 said...

3. Have no experience in parallelism and in C++ looked hard for me that have no formal education in programming. I know the subject is not easy for many kinds of work. In oE, is it simpler than in C/C++?

It doesn't look like this been adequately address yet in this thread: Euphoria has cooperative Multi-tasking, which only ever uses one thread to do some fancy context-shifting within the application.

It really just interleaves your functions, so instead of running steps A-A-A-A and then B-B-B-B, you can run A-B-A-B-A-B-A-B.

new topic     » goto parent     » topic index » view message » categorize

12. Re: Some initial clarifications

(Continued onto a second post since apparently I hit the maximum URL length for the server.)

lib9 said...

3. Is it possible to create graphics like these: https://youtu.be/HWMJdO4klIE?t=2026

Did you know you have two number threes? Just sayin'.

There are a variety of methods you could use. Pretty much all of the available GUI toolkits have some basic graphical functions. Win32Lib, wxEuphoria, IUP, GTK, etc.

IF you want something a bit closer to what's shown in that video, I would recommend using dedicated 2D graphics library like Allegro, Cairo, or SDL.

lib9 said...

4. Is there support to load and save text files of CSV, XML and other formats?

CSV can be done pretty easy by just using something like read_lines() and keyvalues().

You could also throw together a function that loads a CSV file into a map. Did I mention I really love maps?

lib9 said...

5. I've read about the several GUI toolkits available. Later on I'll need one. Never done such thing, except in Red, is iup easy? Really didn't want to learn GTK as it seems a mammoth to me.

IUP is probably the simplest way to get a widely-featured cross-platform GUI. If you want something really simple with some basic graphics primitives, check out libui.

lib9 said...

6. The website seems to have contents outdated. Is version 4.1 stable or beta? https://openeuphoria.org/wiki/view/DownloadEuphoria.wc seems to show 4.0.5 as stable. Is there no 4.1 for Linux x86_64? I come so?

To be honest, community participating has been slowing down over the past ten years since we released 4.0. We have a lot of data rot to deal with. We currently don't have any truly active developers.

I've been working diligently on Euphoria MVC in order to rewrite the website and provide some better tools for managing the whole site.

lib9 said...

7. After git cloning https://github.com/OpenEuphoria/euphoria.git tried to build from sources but got an error.

Yeah... the builds are still kind of broken. Shawn and I had been working on that but he's not been around much and as mentioned, I've been working on Euphoria MVC. I thought I had it working though. Feel free create a new thread with the error message you're receving and I'll try to help.

lib9 said...

8. Is Phix able to execute faster and have less memory requirements than oE for the subject of my work?

They're going to be more-or-less the same over all. Phix is going to be faster overall since it's written in Assembly.

Phix also saves memory when using strings because it uses a dedicated string type instead of sequences, which always uses one integer per character.

lib9 said...

9. Followed the download instruction for Phix x86_64, but got a segmentation error. Raised an issue at https://bitbucket.org/petelomax/phix Is Linux a second quality supported OS for either oE and Phix?

As Pete mentioned, he's one-man shop, but he still has one more developer than we do right now. tongue

new topic     » goto parent     » topic index » view message » categorize

13. Re: Some initial clarifications

P.S. I have a copy of the RDS Archive on my website here: https://archive.usingeuphoria.com/. They had a server crash earlier this year resulting in a lot of broken links.

-Greg

new topic     » goto parent     » topic index » view message » categorize

14. Re: Some initial clarifications

lib9 said...
petelomax said...

OE does not do parallelism. I have done multi-threading in both C++ and phix, and found the latter significantly easier, but then again I am slightly biased.

So does multi-threading use only one core?

Multiple cores. Note however that each thread deserves its own private copy of any data it is working on. (I would recommend using serialize() and deserialize() to set things up.) Here's a simple multi-core-basher:

constant nThreads = 10 
sequence results = repeat(0,nThreads) 
constant res_cs = init_cs()             -- critical section 
 
procedure mythreads(integer id) 
--  enter_cs(res_cs) 
    atom res = 0 
    for i=1 to 40000000 do 
        res += i 
    end for 
    enter_cs(res_cs) 
    results[id] = res 
    leave_cs(res_cs) 
    exit_thread(0) 
end procedure 
 
atom t0 = time() 
sequence threads = {} 
for i=1 to nThreads do 
    atom thread = create_thread(routine_id("mythreads"),{i}) 
    threads = append(threads,thread) 
end for 
 
wait_thread(threads) 
?results 
?elapsed(time()-t0) 

On my i3-2120, which I believe has 2 real cores/4 virtual, it takes 17s and TaskManager shows 100% CPU utilisation. If I move the enter_cs() call up inside mythreads() so that only one can run at a time, the execution time jumps to 53s and TaskManager never goes above 33% CPU utilisation. EDIT: on 64-bit, where the results fit in an integer, which makes it tons faster, the timings are 2.3s vs 4.6s, and trivial cases like this are precisely where I would expect C to seriously outshine OE/phix - it wouldn't surprise me in the least if some C compiler manages to replace the entire loop with a single simple algebraic expression such as 40000000*20000001.

As said often, however, if phix on linux does not work for you, the above is useless.

lib9 said...

Are sequences implemented as C arrays, not as linked lists?

arrays

new topic     » goto parent     » topic index » view message » categorize

15. Re: Some initial clarifications

ghaberek said...

Just curious, where did you come across Euphoria? Was it recently? I've been dropping hints over on Reddit at r/learnprogramming.

I don't know exactly, but I'm always all ears (and eyes) trying to find a good tool. oE was in the bookmarks, probably from the time I also found other good but uncommon programming languages, like Rebol/Red and Picolisp. It was some years ago, not now.

ghaberek said...

One thing to keep in mind is that there is a huge advantage to using high-level language like Euphoria or Python due to the safety and simplicity they offer over inherently-complex languages like C or C.

Even though the execution speed might be a bit slower, reducing your development and debugging time is often worth the speed trade-off.

I really don't mind oE to be somewhat slower. But do mind if it is similar to Python's speed. Have done two big (for me) project in Python, twelve years ago, because I loved the language at the time. After doing the projects never again wanted to code in Python. Too slow, had run-time errors that would have preferred to be caught before.

ghaberek said...

To be honest, community participating has been slowing down over the past ten years since we released 4.0. We have a lot of data rot to deal with. We currently don't have any truly active developers.

It's one of the risks to me, to do my work in an environment fading out. But we have to be positive and believe in some thing in live, don't we? oE/Phix need a killer application, no?

ghaberek said...

I've been working diligently on Euphoria MVC in order to rewrite the website and provide some better tools for managing the whole site.

Quite nice! If I may suggest something, leave the ORM to later, as people can use SQL directly in code.

ghaberek said...

Yeah... the builds are still kind of broken. Shawn and I had been working on that but he's not been around much and as mentioned, I've been working on Euphoria MVC. I thought I had it working though. Feel free create a new thread with the error message you're receving and I'll try to help.

I could also use some FreeBSD, and seems that Euphoria supported this OS, as the other BSDs. Are these OSes going to be supported as well?

ghaberek said...

P.S. I have a copy of the RDS Archive on my website here: https://archive.usingeuphoria.com/. They had a server crash earlier this year resulting in a lot of broken links.

Thank you.

One more question. Is it possible to use oE scripts or libraried in Phix? I already know that there are some differences between the two languages, but can it be done adapting those scripts to Phix, having oE side by side? Or does Phix require libraries specific done for it?

new topic     » goto parent     » topic index » view message » categorize

16. Re: Some initial clarifications

lib9 said...

I really don't mind oE to be somewhat slower. But do mind if it is similar to Python's speed. Have done two big (for me) project in Python, twelve years ago, because I loved the language at the time. After doing the projects never again wanted to code in Python. Too slow, had run-time errors that would have preferred to be caught before.

Oh no, it won't be that slow. Euphoria's interpreter is much faster than Python (in most cases). One advantage Python has though is threads, so things can be made faster through parallelization.

I will use Python as necessary because it's more popular and has a larger standard library, and people look at me funny when I offer to use Euphoria.

lib9 said...

It's one of the risks to me, to do my work in an environment fading out. But we have to be positive and believe in some thing in live, don't we?

This is basically our Catch-22: we need to attract more users if we're to survive, but if we look like we're falling apart no one will want to come.

lib9 said...

oE/Phix need a killer application, no?

Yes! We need several, actually. I'm hoping to get this website rewritten this year so that I can really demonstrate the strength of Euphoria for web applications.

lib9 said...

Quite nice! If I may suggest something, leave the ORM to later, as people can use SQL directly in code.

Thanks. Yes, the ORM stuff is further down the list. Right now I'm working on the database library and cookies and session handling. Hoping to have that pushed out soon.

lib9 said...

I could also use some FreeBSD, and seems that Euphoria supported this OS, as the other BSDs. Are these OSes going to be supported as well?

The idea is to support Windows, Linux, and BSD. I'd also like to include OS X and Haiku (BeOS). We could use one or two people maintaining the BSD and OS X builds.

lib9 said...

Is it possible to use oE scripts or libraried in Phix? I already know that there are some differences between the two languages, but can it be done adapting those scripts to Phix, having oE side by side? Or does Phix require libraries specific done for it?

Phix is based on Euphoria so it's mostly backwards-compatible. The two can both use external shared libraries, if that's what you're asking. I'm sure Pete can elaborate.

-Greg

new topic     » goto parent     » topic index » view message » categorize

17. Re: Some initial clarifications

oE compared to Phix

Euphoria

The essential skill in learning oE or Phix is atom|sequence. There is no penalty in learning one language instead of the other.

Off-by-one

oE and Phix feature one-based indexing. Off-by-one indexing in a conventional language is costly in lost grey cells.

Actions

In oE and Euphoria actions apply by default and uniformly to atoms and sequences. In Phix this rigour is relaxed; you will get a warning message about sequence operations. This allows Phix to use an equality operator when oE requires an equality function. (A great convenience to novice and lazy programmers.)

Indexing

In oE indexing more conservative:

  • only positive index values are allowed
  • assignments will never create or destroy items in a sequence list
  • assignment can only replace values of items
  • functions are needed to create or destroy items in a sequence list

In Phix indexing is more convenient:

  • positive integers index from left to right
  • negative integers index from right to left
  • assignment can be used to insert, replace, or destroy items in a sequence list

Phix will read oE indexed code but oE will not be able to read Phix indexed code.

Speed

Faster than conventional for sure. Maybe Phix is faster more often. Results can be skewed after compiling. Either choice is better than some popular language.

Parameters

Phix has "named parameters" that are more convenient than those in oE

Compiling

Phix does it all. oE needs an external C compiler

Functions

In Phix you can not "quietly" discard a value returned from a function. oE lets you discard function values the same as in many conventional languages.

Standard Library

  • oE library is larger
  • many oE routines can be used in Phix with no or minimal re-writing
  • some oE library routines are heavily interdependent and not suitable for Phix

includes

Phix has an "auto include" feature that enables the most commonly used library routines. oE requires you to manually list include libraries.

regex

oE uses the standard PCRE engine. Phix uses a simplified regex engine.

IUP

  • the IUP GUI is available for both oE and Phix
  • Phix named parameters make gui writing simpler

euGTK

For oE and Linux (Not Phix). (GTK applications can be "made" to run on Windows.)

Threads

Phix has support for threads; oE does not.

Language Internals

Phix uses assembler code. oE uses C code; that implies porting oE may be easier.

string

Phix adds the string data-type which saves bytes for UTF8 encoded strings.

comparison

The Phix equality ` == ` operator compares any objects. The oE ` = ` equality operator only compares atoms; you must use equal) or compare) functions for mixed equality tests

?

Using ? for output in oE only shows numbers. Using ? for output in Phix will show strings as text, and numbers as numbers.

Novice

Phix permits ` := ` and ` = ` for assignments; saves explaining the difference between equality and assignment for absolute beginners. Phix allows ` ; ` as a spacer between statements.

Dual Code

You can do a few tricks to make code run on oE and Phix at the same time. This seems like a lot of work to me.

Include files are written in oE|Phix not C or assembler. That means you can read, understand, and adapt from one to another.

Conclusion

Phix indexing, autoinclude, `?` for output, no C dependence for compiling ... add up as great conveniences for someone starting in Euphoria programming.

For some projects euGTK and and the std/library favour choosing oE.

We still have programmers who use the original Euphoria!

_tom

new topic     » goto parent     » topic index » view message » categorize

18. Re: Some initial clarifications

Length

A number has no length.

An atom in Phix has no length.

An atom in oE has the length one.

An oE atom has "implied length" using this reasoning. An atom appended to a sequence increases the length of the sequence by one; therefore it is "convenient" to say the length of an atom is "one."

This choice can have a great impact on algorithms in oE vs Phix.

_tom

new topic     » goto parent     » topic index » view message » categorize

19. Re: Some initial clarifications

Hi @_tom,

Very nice comparison between the two languages. This deserves a wiki page for itself! Thank you very much!

Coming from the outside of the community, it seems that right now Phix is moving more than oE, and this was confirmed by Greg. Since the two languages are so similar, I'll start with oE and compare speed of execution with Phix later, after Pete works on the bug(s) that are affecting Phix on (my) Linux systems.

oE/Phix have at least two things that I thought were useful many times but have never seen in any other language that I know: the labeling of each loop and the words after 'end ...' that really help not to depend on indentation only.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu