1. Very First Language to Learn: Phix or Euphoria?

I start with the idea that it would be "a good thing" to write a programing tutorial.

It looks like it is much easier to write an intro tutorial for Phix than it is for Euphoria.

Where is the best place to put one's time and energy?

Is this heresy or just a pragmatic viewpoint?

_tom

new topic     » topic index » view message » categorize

2. Re: Very First Language to Learn: Phix or Euphoria?

_tom said...

Is this heresy or just a pragmatic viewpoint?

Heretic! We'll have you, uh... burned at the stake or something! Yeah. (just kidding)

Phix is great but it has its limitations that I don't think anyone but Pete is gonna be able to improve or extend that code base.

I'd like to see the members of this community pour as many resources as possible into Euphoria itself.

Plus it's not impossible that we could implement the features unique to Phix into Euphoria over time.

I have nothing against Phix but it just doens't feel right to me.

-Greg

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

3. Re: Very First Language to Learn: Phix or Euphoria?

The light keeper! All hail G! All hail G! Oh, G, can you see by the dawn's early light.

My personal viewpoint is we all win if we promote OE and Phix. Strength in numbers.

_tom

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

4. Re: Very First Language to Learn: Phix or Euphoria?

ghaberek said...

I don't think anyone but Pete is gonna be able to improve or extend that code base.

Why on earth would you say that - oh, I see, scary assembly not C, eh?

ghaberek said...

I have nothing against Phix but it just doens't feel right to me.

That implies that modifying OE or fixing bugs in it or getting a release out is somehow easier !!!! smile

Obviously I can accept that C is theoretically more portable, and linux needs an awful lot more work, but...

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

5. Re: Very First Language to Learn: Phix or Euphoria?

Hi

I think they live side by side very happily. Getting a dual purpose library (runs in Phix and Eu) is now almost trivial, and common code runs in either edition perfectly now. IMHO Phix has enhancements that would be nice to see in Eu, but I can live without them.

I think it's more important to have one stable, easily installable (zip is good) version of Eu, that avoids confusion for installation for which version to install (3.x, 4.05, 4.1), with cutting edge being clearly marked as such, and older versions available as archives (for history rather than usefulness)

Cheers Chris

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

6. Re: Very First Language to Learn: Phix or Euphoria?

i am absolutely happy with phix - and will stay with it. at first i was kind of dismayed that there are real problems with win-gui, but i really have come to like iup, which i think is an excellent choice for a gui. the only thing i wished phix would have, is the ability to define structs with sequences.. in them. but then, considered threads and all the other neat features, i can live with that.

keep up the good work Pete

richard

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

7. Re: Very First Language to Learn: Phix or Euphoria?

petelomax said...

Why on earth would you say that - oh, I see, scary assembly not C, eh?

Hey, I didn't say that. Assembly is not scary to me, but I don't have a lot of confidence in my abilities with it, either.

But I do know most people will be turned off from contributing to the code when working knowledge of assembly is required.

petelomax said...

That implies that modifying OE or fixing bugs in it or getting a release out is somehow easier !!!! smile

I didn't say that either. In fact, the Euphoria code is a damn mess in some places.

petelomax said...

Obviously I can accept that C is theoretically more portable,

C is absolutely portable. Assembly is definitely not portable.

If we'd ever like to see the convergence of Phix and Euphoria, I'd like to see us adopt LLVM as the intermediate language. Now that's portable!

petelomax said...

and linux needs an awful lot more work, but...

A lot more work that what, Windows? I would argue Linux is the easiest to work with versus Windows or OS X.

-Greg

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

8. Re: Very First Language to Learn: Phix or Euphoria?

ChrisB said...

I think they live side by side very happily. Getting a dual purpose library (runs in Phix and Eu) is now almost trivial, and common code runs in either edition perfectly now.

I'm currently trying to make my EU4 Standard library Phix compatible and I would like to have a unique library for both OE and Phix, but I am running into problems with includes. As far as I know, Phix doesn't have compiler directives. Which is the trivial way to deal with includes in a multi-interpreter environment?

Today, I use Greg's system described in "Multiple Versions of Euphoria on Windows 10" when in console mode but I have a default path to OE4.1 (32-bit) to use WEE. When I use OE includes (as std/text.e) and I run a program via WEE I get errors with Phix because it looks into OE4.1 includes.

Jean-Marc

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

9. Re: Very First Language to Learn: Phix or Euphoria?

Hi

Have ou looked at Phix's /builtins directory. Pretty much the entire std library is there, and there are many examples of dual purpose. One of the reasons I like Phix is that I don't have to specify which includes I want - they are included as needed, unless they are not part of the standard set. You can add in other includes and specify them, and just like eu you will have to specify namespaces too.

The older way to do Phix and eu specific code was with the block comment code

--/* Not required for Phix (defined in psym.e) 
-- ERROR STATUS 
global constant DB_OK = 0, 
                DB_OPEN_FAIL = -1,  
                DB_EXISTS_ALREADY = -2,                                               BLOCK IGNORED BY PHIX 
                DB_LOCK_FAIL = -3,                                                    BUT NOT BY EU 
                DB_BAD_NAME = -4, 
                DB_FATAL_FAIL = -404 
         
-- LOCK TYPES 
global constant DB_LOCK_NO = 0,         -- don't bother with file locking  
                DB_LOCK_SHARED = 1,     -- read the database 
                DB_LOCK_EXCLUSIVE = 2,  -- read and write the database 
                DB_LOCK_READ_ONLY = DB_LOCK_SHARED -- (Cover Eu4 ) 
--*/ 

but you can now use IFDEF

ifdef PHIX then  
    puts(1,"this is Phix\n")  
elsedef  
    puts(1,"this is Eu\n")  
end ifdef  

You can also put includes in these Phix / eu specific blocks

Cheers Chris

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

10. Re: Very First Language to Learn: Phix or Euphoria?

Thank you Chris, ifdef was what I expected.

Yes I had a look at builtins folder. I listed all global routines in it to get more functions available that those documented in the CHM file.

Jean-Marc

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

11. Re: Very First Language to Learn: Phix or Euphoria?

My first cross-interpreter program!

elsifdef is not recognized by Phix so I had to add a level to get it working.

ifdef not PHIX then 
  include euphoria/info.e   
  include std/convert.e   
  include std/console.e   
end ifdef 
 
global constant EU40=0, EU41=1, PHIX=2 
global integer eu_interpreter, eu_bits 
 
eu_interpreter = -1 
eu_bits = -1 
ifdef PHIX then 
  eu_bits = machine_bits() 
  eu_interpreter = PHIX 
elsedef 
  ifdef EU4_0 then 
    eu_interpreter = EU40 
    eu_bits = 32 
  elsifdef EU4_1 then 
    eu_interpreter = EU41 
    sequence s = arch_bits() 
    eu_bits = to_number(s[1..2]) 
  end ifdef 
end ifdef 
 
printf(1, "eu_interpreter = %d, eu_bits = %d\n", {eu_interpreter, eu_bits}) 
maybe_any_key() 

Tested on Phix 32 and 64-bit, OE 4.0.5, OE 4.1 32-bit and 64-bit

Jean-Marc

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

12. Re: Very First Language to Learn: Phix or Euphoria?

jmduro said...

elsifdef is not recognized by Phix

Minor correction: it is EU4_0 which is not recognised, it will be in the next release.

If you want to fix 0.7.9 yourself, there is a

                   or ttidx=T_EU4_1 

in ptok.e line 2539 which wants to become

                   or ttidx=T_EU4_0 
                   or ttidx=T_EU4_1 

and a missing

global constant T_EU4_0         = 5248  tt_stringF("EU4_0",T_EU4_0) 

in pttree.e line 1228 (just after T_shrd).

Then just run p -cp and you should be good to go.

Pete

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

13. Re: Very First Language to Learn: Phix or Euphoria?

Thank you Pete,

I will apply the modifications.

Jean-Marc

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

14. Re: Very First Language to Learn: Phix or Euphoria?

That's an interesting development to come out of this debate. A cross Phix and Euphoria program!

ifdef is like C's #if and that's the problem. It is a very uninspired way of doing things. It would be much better if we could just query directly whether something exists or not:

In C, it is common to find a program with dozens of lines of checking whether it is one version of a compiler or another when the program just wants to know whether memcpy comes with it or not. It is much better if we could ask the C compiler whether memcpy was in a header or not at program time with some builtin routine and have that routine return a boolean.

It seems we have repeated the ugliness of C in Euphoria thanks to the mechanism of ifdef getting into the front end instead of something better.

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

15. Re: Very First Language to Learn: Phix or Euphoria?

There may be a better way to do this but ifdef does the job.

global constant 
  EU_4_1_LNX_64 = 1, EU_4_1_LNX_32 = 2, EU_4_0_LNX = 3, PHIX_LNX_64 = 4, PHIX_LNX_32 = 5, 
  EU_4_1_WIN_64 = 6, EU_4_1_WIN_32 = 7, EU_4_0_WIN = 8, PHIX_WIN_64 = 9, PHIX_WIN_32 = 10 
 
global integer eu_version = 0, address_length = 0 
 
ifdef BITS64 then   
  address_length = 8 
  ifdef PHIX then 
    ifdef WINDOWS then 
      eu_version = PHIX_WIN_64 
    elsifdef LINUX then 
      eu_version = PHIX_LNX_64 
    end ifdef 
  elsedef 
    ifdef WINDOWS then 
      eu_version = EU_4_1_WIN_64 
    elsifdef LINUX then 
      eu_version = EU_4_1_LNX_64 
    end ifdef 
  end ifdef 
elsedef   
  address_length = 4 
  ifdef PHIX then 
    ifdef WINDOWS then 
      eu_version = PHIX_WIN_32 
    elsifdef LINUX then 
      eu_version = PHIX_LNX_32 
    end ifdef 
  elsedef 
    ifdef WINDOWS then 
      ifdef EU4_0 then 
        eu_version = EU_4_0_WIN 
      elsifdef EU4_1 then 
        eu_version = EU_4_1_WIN_32 
      end ifdef 
    elsifdef LINUX then 
      ifdef EU4_0 then 
        eu_version = EU_4_0_LNX 
      elsifdef EU4_1 then 
        eu_version = EU_4_1_LNX_32 
      end ifdef 
    end ifdef 
  end ifdef 
end ifdef 

This can be reduced by applying Pete's patch for EU4_0.

Jean-Marc

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

16. Re: Very First Language to Learn: Phix or Euphoria?

SDPringle said...

ifdef is like C's #if and that's the problem. It is a very uninspired way of doing things. It would be much better if we could just query directly whether something exists or not:

In C, it is common to find a program with dozens of lines of checking whether it is one version of a compiler or another when the program just wants to know whether memcpy comes with it or not. It is much better if we could ask the C compiler whether memcpy was in a header or not at program time with some builtin routine and have that routine return a boolean.

I am not sure i understand exactly what you mean, but if i do understand, i'd like to respectfully submit this is a feature i have asked for in OE for years: the ability to test for existance of a function:

$isalias(name,[N]) 
 
Returns $true if the specified name is an alias command that exists in your aliases or scripts. 
 
Properties: fname, alias, ftype 
 
$isalias(join)        returns $true if you have an alias for /join 
 
$isalias(join).fname        returns the filename in which the alias exists 
 
$isalias(join).alias        returns the alias definition for /join 
 
$isalias(join).ftype        returns alias or remote 
 
 
As you see, stopping at one boolean return is too unimaginative. A corresponding feature would be to get the full list of what is available (functions, libs, or variables). A workaround i have used is to have the code simply open and read the code. Adding features like this is far from being a "kitchen sink syndrome", it's more like "stop copying the languages you are trying to overtake, because they have already beat you".

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

17. Re: Very First Language to Learn: Phix or Euphoria?

CoJaBo3 said...

This functionality has been in Euphoria 4.1 for a number of years already. What the hell are you complaining about?

Thank you for your respectful and non-aggressive response, CoJaBo3.

Could you show me how a running OE program can tell me if function xyz(object a,sequence b) exists within the running program, what include file it's in, and what parameters it accepts, and the type of the return value?

Thank you.

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

18. Re: Very First Language to Learn: Phix or Euphoria?

Just for a laugh, I quickly whipped up a new include file.

include builtins/reflections.e 
?reflect("nonsense")    -- shows -1 
?reflect("reflect")     -- shows {"reflect","func","C:\\Program Files (x86)\\Phix\\builtins\\","reflections.e",{"F","string"}} 

Not that you should imply that in any way do I think that this might actually be useful, you understand.

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

19. Re: Very First Language to Learn: Phix or Euphoria?

petelomax said...

Just for a laugh, I quickly whipped up a new include file.

include builtins/reflections.e 
?reflect("nonsense")    -- shows -1 
?reflect("reflect")     -- shows {"reflect","func","C:\\Program Files (x86)\\Phix\\builtins\\","reflections.e",{"F","string"}} 

Not that you should imply that in any way do I think that this might actually be useful, you understand.

I have goose bumps. No joking. My only concern at this time is it is too much work on you to keep it functioning from now on?

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

20. Re: Very First Language to Learn: Phix or Euphoria?

All you have to do is convince me that this is actually useful, enough for me to add something short but meaningful to p -test, and long term support is guaranteed.

In all fairness, I should perhaps warn you that I suspect that convincing me is unlikely to be easy, and will most likely require concrete, runnable, and genuinely useful examples.

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

21. Re: Very First Language to Learn: Phix or Euphoria?

petelomax said...

All you have to do is convince me that this is actually useful,

Ive got some work to do then lol

petelomax said...

enough for me to add something short but meaningful to p -test,

Would it help if we came up with the short but meaningful test?

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

22. Re: Very First Language to Learn: Phix or Euphoria?

apeto3 said...

Would it help if we came up with the short but meaningful test?

You can do that as well if you like, but I have to document it, and that cannot start with "I cannot think of any practical use for this".

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

Search



Quick Links

User menu

Not signed in.

Misc Menu