1. Phix plus BzScript
- Posted by xecronix 1 week ago
- 276 views
The name of the language I'm writing is called BzScript. Today I start the port from Euphoria to Phix. I'm at around 2K lines of Euphoria. I didn't look close enough at Phix in the past. My bad, honestly. I didn't realize it had structs, classes, and a compiler. I was prototyping in Euphoria with the intention of porting to C. But now, I think Phix might just be the thing to do. And why not, if this project goes well, maybe I'll target Pete's ASM for BzScript too. Lot's of learning to do before I get there. But, looks like fun to me.
2. Re: Phix plus BzScript
- Posted by xecronix 1 week ago
- 275 views
Some of you might get a kick out of what ChatGPT has to say about the port to Phix from Euphoria.
Yeah... brace yourself.
Porting to Phix is like moving into a house with a very strict HOA. Your old stuff mostly fits, but it better follow the rules, or you're getting a letter.
On a positive note, ChatGPT highly recommends Phix for this project. FWIW.
3. Re: Phix plus BzScript
- Posted by petelomax 1 week ago
- 254 views
Some of you might get a kick out of what ChatGPT has to say about the port to Phix from Euphoria.
Yeah... brace yourself.
Porting to Phix is like moving into a house with a very strict HOA. Your old stuff mostly fits, but it better follow the rules, or you're getting a letter.
Anything I should be worried about?
Be aware there is no Android or Raspberry Pi support, otoh many things may run in a browser (just not file i/o)
On a positive note, ChatGPT highly recommends Phix for this project. FWIW.
This is what I got:
Porting from Euphoria to Phix can be an exciting journey, especially since both languages share a common heritage but have distinct features and improvements. Here are some key points to consider when making the transition:
1. Key Differences and Considerations
2. Steps to Port Your Code
3. Conclusion
If you have specific questions about certain aspects of the porting process or need help with particular code snippets, feel free to ask! 😊
4. Re: Phix plus BzScript
- Posted by xecronix 1 week ago
- 245 views
Nothing to be worried about. The port took about 20 min. for about 2K lines. (some of which I simply deleted) It's just some "opinions" I found amusing. Good opinions. But they were amusing and forced me to make some minor changes. Most of that time was spent not ignoring return values. One function in particular I called 40 times and only cared about the return value 2ce.
I had planned to use structs, but in the end, I decided to leave my fake struct in place. The . syntax only saves me 1 char of typing at design time, and it just wasn't worth "fixing", IMO. The warning in the docs that mentioned using structs comes at a performance cost sealed the deal for me. (or gave laziness an excuse... not sure which. LOL)
I did create a user-defined function named free(). That worked when running Phix interpreted. But... it failed when attempting to compile. FWIW. Maybe it should have failed if interpreted too? Not my call.
All said, I'm excited to be working with Phix. I feel like the language and the toolchain are well suited for the work ahead.
5. Re: Phix plus BzScript
- Posted by petelomax 1 week ago
- 240 views
I did create a user-defined function named free(). That worked when running Phix interpreted. But... it failed when attempting to compile. FWIW. Maybe it should have failed if interpreted too? Not my call.
Yeah, that's a known thing. The manual (Core Language/Declarations) has this to say on the matter:
Note however that none of the following (and then some) are technically reserved words, although the editor colours them differently, to give you a hint that it could be rather foolish to use them as identifiers: ... free ...I think there's a bit of code somewhere that only allows some such things to be declared within the /builtins directory, if I find it again I'll think about adding some more of the dangerous ones to it.
6. Re: Phix plus BzScript
- Posted by xecronix 1 week ago
- 215 views
Thanks for that. I'm new to Phix and so I still have docs to read. But, be assured, I'm reading them. It's the fastest way to get up to speed.
7. Re: Phix plus BzScript
- Posted by RobertS 1 week ago
- 178 views
I am far from understanding what you are working on, but from my own experience I think you made the right choice by switching to Phix. I used Euphoria since the 1990s, but a few years ago I was about to abandon my pet calculator project because I ran into some problems which I saw no way how to resolve - with Phix they immediately disappeared. To me what small differences there are between the Phix and Euphoria languages wasn't relevant, but Phix simply worked where Euphoria for whatever reasons didn't. Also, when I came across some minor issues with Phix, Pete always fixed them within a few days if not hours, which isn't what I had experienced with Euphoria. Anyway, good luck with your project!
8. Re: Phix plus BzScript
- Posted by xecronix 1 week ago
- 174 views
Thanks Robert. The switch has not been proven void yet. It was a good decision. I have identified a type checking bug though. I can work around it... I think. But overall, it's been a good experience so far.
In all fairness though, the bug I found could be user error. But, if it is user error the debugger agrees with me... It's a bug.
Either way, I can side step it.
9. Re: Phix plus BzScript
- Posted by petelomax 1 week ago
- 166 views
I have identified a type checking bug...
FYI, this bit me last month, and I haven't had a chance to delve into it yet, and tbh am not particularly keen on doing so any time soon:
type InterVertex(sequence iv) return length(iv)=2 -- and integer(iv[INTERVERTEXTYPE]) --DEV oops: and InterVertexType(iv[INTERVERTEXTYPE]) and Point(iv[POINT]) end type
So, yeah, I know udts (esp nested flavours) are not quite perfect, but in this case the commented-out version was fine.