Any programming language needs a forum...

by shian ⌂, Monday, August 10, 2020, 13:22 (50 days ago)
edited by shian, Monday, August 31, 2020, 09:36

I've made it again (probably the tenth time...).

Although I'm not crazy about forums and "social life" - I guess that Any programming language needs a forum, and it's fundamental for programming these days.

If you feel like posting an interesting Euphoria 3 code, asking a question, or teaching me some tricks in trigonometry (what a shame... I can't even explain how to use sin() properly, although I'm a great sinner!) - just register and post.

This time (for a change), I'll try to keep this site and forum alive. Without expectations.
Hopefully, I will still have an Internet connection.

Thank you, shian.

[image]
[image]







Tags:
welcome, shian, forum

Why don't I use Open Euphoria version 4.x?

by shian ⌂, Wednesday, August 12, 2020, 09:03 (48 days ago) @ shian

It's the first question anybody asks, secretly, so I'll answer once, publicly,

Although Open Euphoria version 4.x is based on Robert Craig's work - it's NOT Rob's work.

Open Euphoria group could only improve the Euphoria programming language under the leadership of Robert Craig and his vision. Yet their pride and blindness leaded them to bang their heads against the wall.

Row, row, row your boat
Gently Down the stream.
Merrily, merrily, merrily, merrily,
Life is but a dream...

Row, row, row your boat
Gently Down the stream.
If you see a crocodile
Don't forget to scream...

Chorus:
If you see a crocodile
Don't forget to scream...

Tags:
OpenEuphoria

Can Euphoria 3.1.1 be converted to 64-bit language?

by shian ⌂, Thursday, August 13, 2020, 07:06 (47 days ago) @ shian
edited by shian, Saturday, August 15, 2020, 08:38

Yes.
A professional C/C++ programmer can do it. According to Rob - it is fairly straightforward.


I want to say another thing:

Most of you probably don't know that a 8-bit CPU is able to process 32-bit, 64-bit, 128-bit, or even 1024-bit numbers - easily. And efficiently.

Yet, once you design a 8-bit CPU that will process 1024-bit numbers (which is no big deal) - the tech giants will lose their money.


So they put us in a race for "new" hardware, "new" software and "new" technology forever, for the sole purpose of making money. Although 8-bit CPU is the right way to go. Any other component in the computer's world is based on streams of 8-bit values (including Hard Drives, RAM Memory, Internet, Cellphones - Everything). The only exception is the CPU.

A 8-bit CPU which is able to process a stream of 8-bit values is the most natural and the right way to design a CPU - just like any other computer related component or protocol.


The bottom line: personally I will continue to use Euphoria 3.1.1 even inside an emulator if necessary (as I do with 16-bit applications), I will keep my sanity - and leave the insanity. Leave the race for money by multi-trillions tech giants.

Goodby lies. 8-Bit CPU can do (and should do) the job much better then 32-bit/64-bit or 128-bit CPU.

I will continue to use Euphoria 32-bit which is able to calculate precise integers of 50 (actually 51) bits. Do you really need more then 50-bit integer? It is a huge number: 1,125,899,906,842,623 - do you need more then this? Not really. Yet if you do, then a software library for big-numbers can do it for you (this is how Python language works, as far as I remember, and this how other programming languages worked with 8-bit and 16-bit CPUs).

Big numbers were already processed by CPUs in the 60s I guess, yet now, in 2020, it is considered to be a problem? Let me out of this madness please.

And about the limitation of file size: currently Euphoria 3.1.1 supports file size up to 2GB, also on DOS system. Do you need more then this? If you do, then change the logic of your application, i.e. create a new database for each year or each month - simply put: grow up.

Tags:
64-bit

cboard Thread - Euphoria version 3.1.1: 32-bit to 64-bit

by shian ⌂, Monday, August 31, 2020, 13:00 (29 days ago) @ shian
edited by shian, Monday, August 31, 2020, 13:09

I had a chat on 10-31-2019 with two people on cboard, they were nice. Anyway, I'm not sure that it's relevant.

Some key points for compiling Euphoria 3 as it is (copied from cboard):

  • 1. When you download Euphoria 3.1.1 it includes the entire source code in euphoria/source directory (interpreter, binder, translator, everything).

  • 2. gcc version 6.0+ will not compile the source code without modifications to the command line arguments.

  • 3. Remember that Euphoria 3.1.1 must be installed correctly before you run any of the build files (see source/readme.txt), and the two environment variables, EUDIR and PATH, must be set correctly.

  • 4. Make sure that you are compiling on a 32-bit Linux (with gcc) - it's not going to work on a 64-bit system, the build files are for i386.

  • 5. The file source/readme.txt will tell you the steps to compile Euphoria 3. (Don't run 'make').

  • 6. You should compile with gcc version less then 6.0. I've used gcc 4.8.4 with -Wall -Wpedantic without a single error or warning. I also commented out a C macro for Assembly PUSH/ADD which is needed to be recalculated for 64-bit CPU. (this macro adds a single feature to the language: calling a C shared library or machine code).

  • 7. To compile Euphoria 3 on Linux without much headache: Download Linux Mint 17.3 "Rosa" Xfce (32-bit), it should already include gcc version 4.8.4 32-bit; Install Linux Mint on a USB stick (32GB), or in a Virtual Machine, then, inside Linux Mint, install also sudo apt install build-essential for the C libraries... and follow the instructions in source/readme.txt.

Tags:
64-bit, Euphoria 3, gcc

How can I run Euphoria 3.1.1 on a 64-bit operating system?

by shian ⌂, Monday, August 31, 2020, 15:32 (29 days ago) @ shian

  • DOS is a 16-bit operating system, so Euphoria 3 runs on DOS in 32-bit protected mode, using a built-in DOS extender.

  • 64-bit Windows has a built-in layer that supports 32-bit applications, so both 32-bit and 64-bit applications are running the same way (most Windows applications are 32-bit anyway).

  • 64-bit Linux requires you to install the 32-bit libraries. I'll give examples for Linux Mint - other Linux and BSD/Mac OSX distributions should work similar to Linux Mint (do a little search for the exact syntax if needed):

    • If you just wanna run Euphoria 3 then install libc6 for i386 architecture:
      sudo apt-get install libc6-i386

    • If you wanna install the entire i386 architecture support, for other cases, install:
      sudo apt-get install ia32-libs-multiarch

      ...Or try this syntax:
      sudo apt-get install ia32-libs

    • If you wanna install support for creating 32-bit C shared library (.so), install gcc libraries:
      sudo apt-get install build-essential

      ...Then install gcc 32-bit libraries:
      sudo apt-get install gcc-multilib

      ...Then use the -m32 flag to compile your file into a shared library, for example:
      gcc -m32 -shared Mylib.c -o mylib.so

Tags:
64-bit, Euphoria 3

How to run Euphoria 3.1.1 on 64-bit & 32-bit FreeBSD?

by shian ⌂, Thursday, September 17, 2020, 00:00 (13 days ago) @ shian

FreeBSD and its derivatives, such as DesktopBSD, GhostBSD, MidnightBSD, TrueOS, NomadBSD & others is similar to Linux distributions yet different.

The instructions here are tested on GhostBSD-20.08.04 but should work on FreeBSD and its other derivatives more or less the same.

Remember that you have to set the PATH and EUDIR environment variables before you can use Euphoria 3.1.1, i.e. append the following code to "~/.profile" or "~/.bash_profile" or "~/.shrc" file, (depends on your system):

 
    # Set PATH so it includes the euphoria 3 bin directory (if it exists),
    # and user's private bin directory; and set EUDIR as well:
    if [ -d "$HOME/euphoria" ] ; then
        EUDIR="$HOME/euphoria"
        PATH="$EUDIR/bin:$HOME/bin:$PATH"
        export EUDIR PATH
    fi


When you install 64-bit FreeBSD you may have the choice to install "lib32", if so - then enabling it will install the 32-bit libraries in '/usr/lib32' directory by default. Otherwise you should install "lib32" as follows:

On a 64-bit FreeBSD system (or derivatives), type in Bash shell (you can choose to use Bash shell also on FreeBSD):

 
    uname -a


The output will tell you what version of FreeBSD you are using, and whether it is a 32-bit or 64-bit system, for example:

 
    FreeBSD NomadBSD 12.1-RELEASE-p6 FreeBSD 12.1-RELEASE-p6 #0
    r362946M: Sun Jul  5 20:05:48 UTC 2020
    ich@riara.uni.cx:/usr/obj/usr/src/i386.i386/sys/NOMADBSD  i386


or...

 
    FreeBSD shian-ghostbsd-pc 12.1-STABLE FreeBSD 12.1-STABLE GENERIC  amd64


Look at the above examples: the FreeBSD version is "12.1".


So let's download "lib32" to the current directory; Type in Bash (Replace "12.1" with YOUR version):

 
    sudo fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/lib32.txz


Now let's extract 'lib32.txz' (it contains lots of 32-bit libraries, for gcc compiler as well); Type in Bash shell:

 
    sudo tar -xvpJf lib32.txz -C /


Now the 32-bit libraries are installed on 64-bit FreeBSD system, and in particular 'libm' and 'libc' which are necessary for Euphoria 3.1.1.


Problem (on 32-bit and 64-bit FreeBSD):
--------------------------------------------

When you try to run Euphoria 3.1.1 on 32-bit or 64-bit FreeBSD (with "lib32" installed) you may get similar error messages:

 
   ld-elf32.so.1: Shared object "libm.so.2" not found, required by "exu"


and...

 
    ld-elf32.so.1: Shared object "libc.so.4" not found, required by "exu"

This is because 'libm' and 'libc' are newer versions then the versions that Euphoria 3.1.1 needs (2 and 4).


Solution:
---------

Let's create links to these newer libraries (whatever number they may have on your system):


On Bash type two commands:

 
    cd /usr/lib32
 
    ls lib?.so.*

The ls command on Bash shows us the following libraries in '/usr/lib32':

 
    libm.so.5    libc.so.7    libz.so.6
 


So now that we know the newer version (5 and 7), let's create links to them using the version numbers that Euphoria 3.1.1 needs (2 and 4):

 
    cd /usr/lib32
 
    sudo ln -s libm.so.5 libm.so.2
 
    sudo ln -s libc.so.7 libc.so.4
 


Done.

Now that "lib32" is installed and we created links to the newer versions in '/usr/lib32' directory, you can run 'exu'. :-)


For C programmers...

How to compile a c file into a 32-bit shared library, on a 64-bit FreeBSD and Derivatives, for Euphoria 3.1.1 open_dll():
===================================================================


Problem:
----------

When you try to compile 'euphoria/demo/linux/Mylib.c' into a shared library, on a 64-bit FreeBSD, with:

 
     gcc -shared Mylib.c -o mylib.so


you may get the following or a similar message:

 
    /usr/local/bin/ld: /tmp//ccd5jjqG.o:
    relocation R_X86_64_PC32 against symbol `extra' can not
    be used when making a shared object; recompile with -fPIC
    /usr/local/bin/ld: final link failed: bad value
    collect2: error: ld returned 1 exit status

This is because gcc needs the 32-bit libraries for 64-bit FreeBSD system.


Solution:
----------

First, install gcc (if not already installed...), type in Bash:

 
    sudo pkg install gcc

or...

 
    sudo pkg install lang/gcc


Now you have to install the gcc 32-bit libraries... for this you should install "lib32" as described above (on top).


Then use the -m32 flag to compile your file into a shared library:

 
    gcc -m32 -shared Mylib.c -o mylib.so


Now you can run 'euphoria/demo/linux/mylib.exu' using mylib.so.

Tags:
64-bit, Euphoria 3, gcc, FreeBSD, BSD

How to run the *Linux* version of Euphoria 3.1.1 on FreeBSD?

by shian ⌂, Thursday, September 17, 2020, 14:54 (12 days ago) @ shian

How to run the *Linux* version of Euphoria 3.1.1 on 64-bit & 32-bit FreeBSD and Derivatives

FreeBSD and its derivatives, such as DesktopBSD, GhostBSD, MidnightBSD, TrueOS, NomadBSD & others is similar to Linux distributions yet different.

These days the FreeBSD kernel (and its derivatives) also supports Linux applications natively, therefore you can choose to run the FreeBSD version of Euphoria 3.1.1 on a FreeBSD system or the Linux version of Euphoria 3.1.1 on a FreeBSD system. It's up to you, yet the installation of the 32-bit libraries for Linux (on FreeBSD) is different then for FreeBSD.


Note:
To install the native FreeBSD version of Euphoria 3.1.1 on FreeBSD system, see the previous post.


The instructions here are tested on GhostBSD-20.08.04 but should work on FreeBSD and its other derivatives more or less the same.


Remember that you have to set the PATH and EUDIR environment variables before you can use Euphoria 3.1.1, i.e. append the following code to "~/.profile" or "~/.bash_profile" or "~/.shrc" file, (depends on your system):

 
    # Set PATH so it includes the euphoria 3 bin directory (if it exists),
    # and user's private bin directory; and set EUDIR as well:
    if [ -d "$HOME/euphoria" ] ; then
        EUDIR="$HOME/euphoria"
        PATH="$EUDIR/bin:$HOME/bin:$PATH"
        export EUDIR PATH
    fi


OK,
If you try to run the Linux version of Euphoria 3.1.1 'exu' on 64-bit FreeBSD you will get an error message similar to this one:

 
    ELF interpreter ╱lib╱ld-linux.so.2 not found, error 2
    Abort trap


So you must add support for 32-bit Linux applications on FreeBSD.


To install support for 32-bit Linux applications on FreeBSD, do the following steps (See also the handbook):


1. First you must load the 32-bit Linux kernel module (if it's not already loaded by default), type on bash shell:

 
    sudo kldload linux


BTW, for 64-bit compatibility you had to type: 'kldload linux64'.


2. To verify that the Linux module is loaded type:

 
    kldstat


The output will be similar:

 
 Id Refs Address                Size Name
 ...
 12    1 0xffffffff8353f000    3cfc0 linux.ko
 13    3 0xffffffff8357c000     3308 linux_common.ko
 14    1 0xffffffff83580000    34e60 linux64.ko
 ...


3. Install a *base* set of Linux libraries and binaries on a FreeBSD system, using the 'emulators/linux_base-c7' package (a big package); Type in bash:

 
    sudo pkg install emulators/linux_base-c7


3.1. Now you may get a "Message from linux_base-c7-7.8.2003_1:" after the installation of 'linux_base-c7' package, so please use 'sudo' to open an editor and add the following lines where or if needed (this is just an example message):

 
    --
    Some programs need linprocfs mounted on ╱compat╱linux╱proc.  Add the
    following line to ╱etc╱fstab:
 
    linprocfs   ╱compat╱linux╱proc linprocfs rw 0 0
 
    Then run "mount ╱compat╱linux╱proc".
 
    Some programs need linsysfs mounted on ╱compat╱linux╱sys.  Add the
    following line to ╱etc╱fstab:
 
    linsysfs    ╱compat╱linux╱sys linsysfs rw 0 0
 
    Then run "mount ╱compat╱linux╱sys".
 
    Some programs need tmpfs mounted on ╱compat╱linux╱dev╱shm.  Add the
    following line to ╱etc╱fstab:
 
    tmpfs    ╱compat╱linux╱dev╱shm tmpfs rw,mode=1777 0 0
 
    Then run "mount ╱compat╱linux╱dev╱shm".
 


4. For Linux compatibility to be enabled at boot time, add this line to ╱etc╱rc.conf (using 'sudo' to open the editor as admin):

 
   linux_enable="YES"


Note:
On 64-bit machines, ╱etc╱rc.d╱abi will automatically load the module for 64-bit emulation. (Yet we need 32-bit emulation for Euphoria 3.1.1).


5. Logout and Login again to apply the new changes.


Done.

Now you can run the Linux version of Euphoria 3.1.1 on a 64-bit FreeBSD system :-). No additional Linux libraries are necessary for Euphoria 3.1.1 (Euphoria 3.1.1 for Linux/FreeBSD is based on libc & libm libraries, right?).


P.s.
In case that you must install additional Linux libraries, please read in handbook the section "10.2.1. Installing Additional Libraries Manually".


For C programmers...

How to compile a c file into a 32-bit *Linux* shared library, on a 64-bit FreeBSD and Derivatives, for Euphoria 3.1.1 open_dll():

You could probably install gcc for Linux on FreeBSD, yet I guess that it's better to create your Linux program on a Linux system, including any shared library, and then run it on 32-bit/64-bit FreeBSD as described above. :-D

See also 'euphoria/doc/linux64.doc' (from Lib2 1.41) to understand how to create a 32-bit shared library on 64-bit Linux.


P.s. I should add this information in the next version of Lib2.

Tags:
64-bit, Euphoria 3, gcc, FreeBSD, BSD

Can Euphoria 3.1.1 be converted to 64-bit language?

by achury, Monday, September 21, 2020, 02:52 (9 days ago) @ shian

On the C forum you said that you have translated-compiled the Eu source to 64bits binary?

May be share such binary?

Would be nice to have a 64 bits binary for win. (Even if slower than original RDS binary)

Regards

Marco Achury

Can Euphoria 3.1.1 be converted to 64-bit language?

by shian ⌂, Monday, September 21, 2020, 09:36 (8 days ago) @ achury

On the C forum you said that you have translated-compiled the Eu source to 64bits binary?

May be share such binary?

Would be nice to have a 64 bits binary for win. (Even if slower than original RDS binary)

I've used the 64-bit Euphoria version 4.x of OpenEuphoria to compile Euphoria 3.1.1... And as you can guess, I don't really like OpenEuphoria, It was just an experiment, so I deleted the compiled binary.

You can still use the 64-bit OpenEuphoria 4.x version if you want.
But 64-bit Windows-10 runs 32-bit applications natively (including programs which are part of the Windows system itself).

Tags:
64-bit, gcc

Can Euphoria 3.1.1 be converted to 64-bit language?

by achury, Monday, September 21, 2020, 03:31 (9 days ago) @ shian

Just an opinion.

I share your opinion about the senseless hardware updates.

I can live using old hardware and software on my computer, but the web browser is a key piece of software that become your window to the world.

Some day ago I check on windows task manager that my firefox browser is taking 2Gb ram. I really can't believe a program may need so much ram to present web pages on my screen.

I was forced to change my last computer when browser become unable to keep running well, and I suspect that the same will happen with the current one.

Can Euphoria 3.1.1 be converted to 64-bit language?

by shian ⌂, Monday, September 21, 2020, 10:08 (8 days ago) @ achury

Some day ago I check on windows task manager that my firefox browser is taking 2Gb ram. I really can't believe a program may need so much ram to present web pages on my screen.

I was forced to change my last computer when browser become unable to keep running well, and I suspect that the same will happen with the current one.

The amount of used RAM reported by the OS is not "real", especially on Linux system. On Linux it may report that ALL RAM is used... that's the way that the OS is managing the memory.

I'll be honest to you. I've worked as a PC technician for a while, I've installed and used MS-DOS 3/4/5/6/7, Windows 95/98/98se/ME/2000/XP/7/8/10, and of course Linux.

As a technician I know that Windows is extremely vulnerable to malware. Windows cannot run fast for more then few months without reinstalling the system (usually). Reinstalling the system is the only solution. Lots of "Antivirus" programs are similar to insurance companies... you pay monthly fee and die by car accident... They do it for profit.

So, again, Windows is not designed for security to begin with. A single malware can slow down your system to the point that you cannot use your PC.
Windows is also not designed for efficiency. Windows is designed for profit. Just like the Intel i386 CPU and the AMD64 CPU.

If you don't mind to try Linux Mint then do so. Linux in general is far more robust then Windows, from all aspects. And once you get used to Linux you'll probably like it more then Windows anyway. I guess.

BTW, I only use old, second hand or third hand laptops, with Linux installed on them... and Firefox works great for Years.

Tags:
64-bit, Linux

No "string" type in Euphoria 3.1.1?

by shian ⌂, Thursday, August 13, 2020, 17:11 (47 days ago) @ shian
edited by shian, Monday, August 24, 2020, 09:27

Some are "complaining" that there is no string type in Euphoria. Well, Euphoria does not need it at all.

Yet since all I/O (Input/Output) operations in programming must be done with the string type, Euphoria 3.1.1 and Lib2 are providing all you need for manipulating strings easily, the traditional way.

Behind the scenes, it's a different story - as I said before, in Euphoria there is no "traditional" string type, only sequence type, which is a way more powerful concept.

BTW, remember that "string-sequence" in Euphoria is made of 31-bit integers, not with 8-bit integers, which means that strings in Euphoria are by default Unicode strings rather than ASCII strings - yet, why should you care?

Here is a short example code, with only few traditional "string" functions, to calm the storm...:

 
include machine2.e -- string() type, from Lib2 version 1.41
 
constant SCREEN = 1, EOL = '\n'  -- EOL is End Of Line character(s)
 
string name, website   -- declare two variables of string-sequence type
 
name = "shian lee"
website = "http://www.RapidEuphoria311.com/"
 
puts(SCREEN, name & ' ' & website & EOL)
    -- prints "shian lee http://www.RapidEuphoria311.com/"
 
 
include string.e -- basic string functions, from Lib2 version 1.41
 
string both -- declare one variable of string-sequence type
 
both = name & website
 
puts(SCREEN, both & EOL)
    -- prints "shian leehttp://www.RapidEuphoria311.com/"
 
puts(SCREEN, left(both, length(name)) & EOL) 
    -- prints "shian lee"
 
puts(SCREEN, right(both, length(website)) & EOL)
    -- prints "http://www.RapidEuphoria311.com/"
 
puts(SCREEN, right_of(both, ".", 0) & EOL)
    -- prints "com/"
 
puts(SCREEN, mid(website, 5, 12) & EOL)
    -- prints "Rapid"
 
puts(SCREEN, change(website, "", 3, 25) & EOL)
    -- prints "http://www.RapidEuphoria.com/"
 
puts(SCREEN, change(website, 's', 0, 5) & EOL)
    -- prints "https://www.RapidEuphoria311.com/"
 

Tags:
string

SOS - Euphoria 3.1.1 don't support OOP!

by shian ⌂, Friday, August 14, 2020, 07:51 (46 days ago) @ shian

Thanks God for that!!!

OOP (Object Oriented Programming) is not a modern concept, it is a very old concept, wrong and delusional.


The "flagship" of OOP was and is ENCAPSULATION. WOW! What a term! Scary.

"Encapsulation" exists from the day procedural programming, such as the C language, started to use subroutines and modules (files). "Encapsulation" was not invented by OOP freaks (as some may argue).


The next "flagship" of OOP was and is HIERARCHY. Jesus. OOP became a religious order. That's scary.

"Hierarchy" is a failed logic. Once you implement it - no more freedom. Since each "object" MUST BELONG to another object, and you cannot "lend" or "borrow" to/from someone's else private object - even if you really need it. What a stupid and failed concept. Yet decades ago, some enthusiastic freaks thought that it's really cool.

OOP HIERARCHY = Losing you freedom as a programmer. There are no limitations in procedural programming (such as in C, Basic, or Euphoria 3 programming languages).


At the end of the day, anything significant is written with procedural languages, especially C.
UNIX/BSD/Mac OSX(BSD)/Linux/Now even Windows-10 (probably) are written in C.
Popular and great GUIs (Graphical User Interfaces), such as GTK, are written in C.
Let me remind you, C is a procedural programming language without any OOP support, just like Euphoria 3.

Let me remind you that any successful programming language, such as Python, Java, Basic, etc is written using procedural programming language or Assembly - OOP is simply too clumsy (to say the least) to do the job. (And I did not verify it with Wikisomething).


Well well, decades ago, few enthusiastic freaks had a "great" idea called OOP. I'm used to such people, I see them everywhere, also today.

Sorry for bashing OOP, yet some experienced OOP programmers already admitted that OOP was a mistake from the very first day, decades ago. And they understand the OOP concept very well, and they are completely right.


My conclusion: procedural programming languages, such as C or Euphoria 3, gives you the freedom you need as a programmer to do things your way, the correct way. Euphoria 3 in particular is far more powerful then OOP languages, conceptually.

So stop talking about OOP - it does not deliver the "magics" that it promised. It is a failed concept, yet popular, just like Coca cola. Nothing else.

I could elaborate much more, but what for. The King is Naked (from "The Emperor's New Clothes").

Tags:
OOP, Object Oriented Programming

Using bit manipulation in a very high level language?!

by shian ⌂, Saturday, August 15, 2020, 07:27 (45 days ago) @ shian

Euphoria 3 is a very high level language, it does not use low level tricks, it lets you program safely, without worrying about low level issues.

Yet Euphoria 3 allows you to perform low level operations when needed (when you want to access C shared library - .DLL/.so, DOS interrupt, i386 machine language, or just for extremely fast code).

In Lib2 library I'm using low level functions for manipulating bits, such as and_bits(), or_bits(), etc, since a library routine must be fast and efficient as possible. A library routine is a basic building block which should be suitable for many uses.

In your program you are not forced to use low level functions. Euphoria 3 offers high level functions for manipulating bits safely (shift bits, rotate bits, slice bits, etc), these functions are: int_to_bits(), bits_to_int().

Although these are high level bit manipulation functions, they are extremely convenient, very safe, and... very fast, since in Euphoria 3 integer calculations are very fast. I recommend you to use these functions (unless you need some extremely fast operations from Lib2 library). I personally used these functions a lot, that's why I can recommend them.

Conclusion: In Euphoria 3 you can use high level functions for manipulating low level bits, using the functions int_to_bits(), bits_to_int() and also bytes_to_int() and int_to_bytes(). See "Operations on sequences" in the Reference Manual (refman.doc).

Tags:
bit, bits

Euphoria 3.1.1 lacks of essential libraries!

by shian ⌂, Saturday, August 15, 2020, 08:16 (45 days ago) @ shian
edited by shian, Monday, August 24, 2020, 09:31

Well Euphoria 3.1.1 never became a commercial product, and never had a multi-billion sponsor - OK? That's why Robert Craig could not afford spending time on an advanced cross-platform GUI library, etc.

I assume that nobody wanted to sponsor Euphoria 3 since it would make other languages useless, i.e. languages such as BASIC, VisualBASIC, Python, Ruby, PHP, etc could become useless if Euphoria 3 would have take their place. Sincerely. Honestly. Truthfully.

There are some great open source cross-platform GUI libraries, written in C, you just need to look for them and wrap them into an Euphoria 3 file.
I recommend you to first wrap the most elementary functions, such as text-box and check-box, and give it a version number 1.0.0; Only then, slowly but surely, continue to wrap the more advanced objects. You don't need to wrap the entire GUI library - much of it is for nerds.


Lib2 provides a lot of elementary and useful functions + text mode simple IDE: edu. Using Lib2 can save you lots of time. The edu IDE supports context sensitive help for all functions - so benefit from it.

And last: if you are a disciplined programmer, you may add a practical module for Lib2, such as a "big numbers" library or a "complex numbers" library. If your code is standard, documented (as in Lib2), debugged, clear and clean - I will be more then happy to add it to Lib2. Anyway, creating additional libraries can be done by YOU. No need to wait for someone else to do it. If you're good at Math (I'm not), Trigonometry, Statistics, Graphics, whatever, then simply contribute your talent and knowledge, 알겠느냐?

Tags:
library, libraries

Euphoria 3 does not have an ERROR handler???

by shian ⌂, Sunday, August 16, 2020, 05:47 (45 days ago) @ shian
edited by shian, Monday, August 24, 2020, 09:21

Is seems to me that some people missed the point.

An error handler can be used in the following cases:

  • 1. Your program have a logical bug (division by zero, index out of bound, etc).
  • 2. You wanna make your life easier (if file's format is wrong then just ignore it, etc).
  • 3. You wanna load a plugin that may have a bug.
  • 4. You don't know what you want.

I'll answer the above:

  • 1. If your program have a logical bug - some data, somewhere, may be corrupt. What can an error handler do about it? Nothing. You should fix your bug.
  • 2. Instead of displaying a message "Illegal function call" whenever a single comma is missing... just create a decent function to deal with it.
  • 3. A plugin is a program, just like your program. If a plugin has a bug then it should be fixed - till then: don't use it. The sky won't fall.
  • 4. That's the common case. Take a break.


Euphoria 3 crashes on logical bugs, as it should. But it allows you to call a crash_routine() to cleanup the mess before your program stops, or to simply initialize and restart your program.

In any case all files are closed automatically before your program crashes.

When your program crashes a file is created in the current directory, "ex.err", with detailed, readable information about the crash: values of variables, routines that leaded to this crash, and the exact location of the crash (file, line, column). The crash routine is versatile and you can use it the way you need.

To deal with very specific operating system's errors, you can create an error handler yourself (as I did in DFS library for the infamous DOS Critical Error Handler). Yet these are rare cases.

If you need more then this then you better learn programming.


BTW, Euphoria 3 is not BASIC. BASIC crashes on other bugs beside logical bugs, therefore in BASIC you must have an error handler... go figure: they created the problem - then offered the solution. Profound, indeed.


Last: many complex programming methods are leading to lots of unnecessary bugs, which makes an error handler a "life saver" - just avoid those "modern" methods, keep it simple, you're writing a program - not creating another Frankenstein.

Tags:
error, error handler

Yo - Euphoria 3 do not support concurrent computing???

by shian ⌂, Sunday, August 16, 2020, 06:35 (44 days ago) @ shian

Simple:

Multitasking is built into the Euphoria 3 programming language.

The following code is Task #1 by default:

puts(1, "Hello World!\n")

You can add to your program as many tasks as you need and define how you want them to behave.

Multitasking in Euphoria 3 is very simple to implement and totally safe, since it is a builtin software attribute, rather than hardware's multi-threading.

If you need the speed of Multithreading, just remember that computers do not get faster! i.e. although the hardware is getting faster - the software is far more bloated. The result is that a multi-core 64-bit CPU with a modern operating system works just as fast as MS-DOS on an old 386 machine.

Give yourself a break and enjoy the builtin simplicity and safety of Euphoria's Multitasking.

See also euphoria/doc/tasking.doc for details.

Tags:
Concurrent computing, Multitasking, Multithreading

Yo Man - What about a Database?

by shian ⌂, Sunday, August 16, 2020, 08:04 (44 days ago) @ shian

Euphoria 3 provides far more flexible database system then a SQL (Structured Query Language) database; It is called Euphoria Database System (EDS).

EDS is also a relational database but does not have a special tedious language such as SQL to control it, and most important: you can store any object as data (or even key), which means that you can change the record's structure at any time, add fields, delete fields, whatever - records are completely flexible, nothing is fixed.
No more worries (did I forget something? is it the correct data type? do I need to add an extra column, just in case? is the record too long, not efficient, should I change it now? how will I change it in the future?, etc).

In many database systems you must define each field in the record very carefully - not in EDS. In EDS you're free to make critical decisions later. (This is typical to programming with Euphoria 3 in general).

See also euphoria/doc/database.doc

Lib2 version 1.41 provides also traditional functions for direct access (Random access) database, if you need. Direct access database has fixed record's structure but it is the most efficient and fast way to retrieve and store data in a file.

Of course - there are many ways to create a simple database file, in text or binary format, using the print() & get() routines, or in many other creative ways, such as simple CSV (Comma Separated Values) text file, using functions from string.e library (Lib2) - and... the sky is the limit.

Conclusion: creating a database in Euphoria 3 is very simple.

Tags:
Database

OK - Tell me again about the data types in Euphoria 3

by shian ⌂, Monday, August 17, 2020, 06:01 (44 days ago) @ shian
edited by shian, Monday, August 17, 2020, 06:05

Euphoria 3 has only 4 data types:

The main data types (variable type) are:

  • atom - any number.
  • sequence - any sequence of numbers and/or (sub)sequences.

The helpers data types are:

  • integer - a limited atom (yet still an atom), but extremely fast.
  • object - any of the above (integer, atom, sequence).


OK, so briefly, what's the big deal?

  • Data types are the biggest headache in any programming language - NOT in Euphoria 3.

  • sequence is the most important data type in Euphoria 3. Any complex data type in other languages can be represented by it (including OOP).

  • Data types simplicity in Euphoria 3 allows you to focus on your project - not on the programming language itself.

  • The object type is useful since Euphoria 3 code is generic by nature. Many library routines accept an object as an argument.
    Team's work can be done safely by passing a single object argument to routines; it allows backward compatibility with older versions of these routines, i.e. you only need to update the routine itself - not the entire project.

  • The bottom line is: computers understand only numbers. A flexible sequence of numbers is all you need for your program.


Additionally, the simple type() mechanism in Euphoria 3 makes it a very safe language, where you can define your own types easily. What else do you need?


Epilogue:

Look at the C/C++ languages: how much time you must spend on data types? no further comment.

Look at BASIC: choosing the right data type is your daily bread.

Look at Java: the definition of data type is beyond comprehension; for nerds only.

Look at Python: no need to declare data types at all; not recommend in Boeing 747.

Tags:
type, data type, variable

OK - Tell me again about the data types in Euphoria 3

by achury, Monday, September 21, 2020, 03:00 (9 days ago) @ shian

I am not a profesional programmer, only I only program quick solutions for small personal problems.

Some few days ago I was frustrated using YABASIC.

The program must operate info stored on several arrays. And at the end I want the resulting values. I want a simple procedure to print on screen array contents, and I was forced to have 3 versions of the same procedure: For string array, for integer array and simple precision array.

This is the moment when I miss Euphoria.

OK - Tell me again about the data types in Euphoria 3

by shian ⌂, Monday, September 21, 2020, 10:43 (8 days ago) @ achury

I am not a profesional programmer, only I only program quick solutions for small personal problems.

Some few days ago I was frustrated using YABASIC.

The program must operate info stored on several arrays. And at the end I want the resulting values. I want a simple procedure to print on screen array contents, and I was forced to have 3 versions of the same procedure: For string array, for integer array and simple precision array.

This is the moment when I miss Euphoria.

I've used some BASIC versions. Some of them are simply a "toy" language, not really professional from any aspect, such as SmallBASIC (not the Microsoft's version...). Other BASIC versions are very professional, for operating industrial controllers, and for desktop.

But ALL versions of BASIC are overwhelmingly clumsy compared to Euphoria 3.

If you can use Euphoria 3 - then don't even look at other languages. It's a waste of time, IMHO.

Don't be cheated by the "Next programming language". They are only getting worse. Programming today is a boring job of a clerk who's selecting objects from a shelf.

Euphoria 3 is only getting better as time goes by
, since the world of programming today is essentially politics. As an evidence just see how all small software & hardware companies are purchased by the tech giants (the huge corporations). It's not about programming anymore, it's about power. Huge power.

Then why "nobody" is using Euphoria 3.1.1?

by shian ⌂, Monday, August 17, 2020, 06:51 (43 days ago) @ shian
edited by shian, Sunday, August 23, 2020, 07:40

Should I really explain again?

Evil world is based on evil money. (is this enough? no).

Young people choosing programming language according to Job offers and salary.
The marketing sites repeating their mantra:

  • JavaScript
  • HTML/CSS
  • Java
  • C++
  • Python
  • PHP
  • C

Each year it's the same story, only the order's changing.

People are obsessed with Internet and Smartphones, they wanna make big money! JavaScript and Java is the key! Programming became less important. Programming as an art - even less.

The fact that Euphoria 3 is not officially developed anymore - just shows how much brainwashing is the main priority of the tech giants.

Epilogue:

  • If you wanna make big money - be a stripper. It's much faster then programming.
  • Working for tech giant doesn't mean that you're a good programmer (to say the least).
  • Weak people cannot think and analyze the truth - they rely on other's opinion.
  • The King is Naked. Languages like Java are great success in terms of brainwashing.

Tags:
Euphoria 3

What are the KEY POINTS of Euphoria 3?

by shian ⌂, Monday, August 17, 2020, 08:30 (43 days ago) @ shian
edited by shian, Monday, August 24, 2020, 09:07

Euphoria version 3:

  • Has an overall and well defined strategy by Robert Craig.

  • Has a very professional and correct behavior, exactly what you would expect.

  • All aspects of the language are polished and synchronized. Nothing is unrelated or indefinite.

  • Extremely simple, readable, maintainable and logically-correct language.

  • Powerful and rapid language without stupid elements.

  • Very High Level language. No need to worry about low level issues.

  • Minimalist language. Hence, Readable & Maintainable. Only what you really need for programming.

  • No "Dead End". The language is extensible through libraries.

  • Supports the main platforms: DOS, Windows, Linux, FreeBSD. Easy to write generic code that works on all platforms.

  • A 32-bit language. On DOS as well.

  • The data types issue is not exist in Euphoria 3. (The worst nightmare in other languages).

  • The source code of Euphoria 3 is written in C and in Euphoria 3. Easy to compile for other platforms.

  • Can use and create shared C libraries.

  • Interpreted language (with all the benefits that comes with it).

  • Allows you to create standalone executable files, shrouded files or translated files.

  • Suitable design for team's work.

  • Very easy to create CGI (Common Gateway Interface) applications.

  • Very safe language. Programming with confidence.

  • Extremely fast interpreter.

  • Open source language and already used and tested by many users.

  • Procedural language (like C or BASIC). NOT multi-paradigm supermarket! :-D (multi-paradigm languages are hard to maintain and overwhelmingly bloated).

  • Suitable for beginners and professional programmers.

  • ...


There's more, but that's enough for now. Unless you use it - you'll never understand.

Tags:
Euphoria 3

Why atom? Why not double?

by shian ⌂, Saturday, August 22, 2020, 13:07 (38 days ago) @ shian

Some knowledgeable programmers "complain" that in Euphoria 3 the hardware double data type is simply named atom! :-(


Well, as far as I can tell, in Euphoria 3 there are no hardware data types at all:

Euphoria integer is a 31-bit integer, not a 32-bit hardware integer.

Euphoria atom can be either 31-bit integer or 64-bit double at run time, therefore it is not a 64-bit hardware double.


Conclusion:

The data types in Euphoria 3, integer, atom, sequence, cannot be compared to data types in other programming languages. i.e. integer is not a 16/32/64-bit hardware integer; atom is not necessarily a 64-bit hardware double; and sequence is definitely not a traditional array of successive elements of the same data type/structure; a sequence is dynamic data type - not static and not predefined. 알았어?

Tags:
atom, double

What happened to the Euphoria 3 users community?

by shian ⌂, Sunday, August 23, 2020, 08:50 (37 days ago) @ shian

They simply "gone with the wind". Why? disappointment.

When OpenEuphoria Version 4.0.0 was released at December 22, 2010, I personally, and I'm honest, could not believe my eyes: the only good part of it was taken from Euphoria 3. IMHO. I did not like anything about it. I guess that I was not the only one.

No offense. Open Euphoria group is made of professional and talented programmers. They could've made a great work just by listening to Robert Craig of RDS. Yet pride is a poison that kills its owner.

Tags:
OpenEuphoria, Euphoria 3

Who should learn Euphoria 3 & Why am I doing this site?

by shian ⌂, Wednesday, August 26, 2020, 08:20 (34 days ago) @ shian

If you like programming or if you simply interested in it, no matter what your background is, then Euphoria 3 programming language is probably something you've never heard about, and you may want to learn it.


For a professional programmer:

You probably know already EVERYTHING, right? So... it's getting Boring. Tedious. Job. Medals. Money.

Euphoria 3 can replace a lot of automated scripts that you are writing in lots of cryptic languages, with lots of secret and sacred punctuation marks and top-secret tips, which only few gurus can tell about. Isn't it? If you're working with Linux system then Bash (GNU Bourne-Again SHell) must be one of those ancient hieroglyph scripts. No doubt.

Why don't you learn Euphoria 3 in less then few hours, and start writing professional, readable, maintainable, very powerful, simple, short and fast scripts? Euphoria 3 can replace all other languages which you may use on Linux. The system() and system_exec() Euphoria 3 commands can call any GNU utility as well.

Think about it: how much time you waste on ancient hieroglyph scripts? Do yourself a favor and use Euphoria 3 for writing scripts. Later you may use it for writing larger programs as well.


For a beginner in programming:

If you just wanna tell the computer to do things; or if you wanna write programs without spending few years exercising hieroglyph scripts (programming languages); or if you actually want to enjoy programming... Euphoria 3 is the answer.


P.s.
Personally I found Euphoria 3 very late, in 2010, more or less, after writing programs in few flavors of Microsoft Basic, some are commercial programs; I've also enjoyed ladder programming for PLCs (Programmable logic controllers), where you can really tell big machines how to operate... that was my favorite type of programming, yet short.

I've learn few more languages (C, Assembly, SQL, Bash, Python, Java, etc), and forgot them quite fast (very fast). When I found Euphoria 3, out of frustration, I found what I was looking for. Not another cliche - but a profound programming language, an art. I like art so I gave it a try and realized that it is truly MUCH more simple then BASIC and obviously FAR MORE rapid then sacred languages such as C++.

Tags:
Euphoria 3

PC programming vs. PLC programming

by shian ⌂, Tuesday, September 15, 2020, 08:33 (14 days ago) @ shian
edited by shian, Tuesday, September 15, 2020, 08:48

Not so related to Euphoria 3 programming language, yet an interesting thing:
Is there a fundamental difference between Ladder Logic Programming and PC programming? Yea. and as a computer programmer it may be confusing... :lol3:

Normal PC (personal computer) program looks like this (Euphoria 3 program):

with trace
trace(1)
-- Tutorial - Read a File: One line at a time
-- To run this tutorial,
--        Press Enter to execute the highlighted Euphoria statement.
--        Press F1 / F2 to flip to the main output screen.
--        Press down-arrow to execute quickly to the end of a loop
 
-- We will:
--        1. open the "tutorial.doc" file in this directory
--        2. See how many lines contain the word "Euphoria"
--        3. print the number of lines containing "Euphoria"
--        4. close the file
 
integer fn    -- the file number
integer e     -- the number of lines that contain "Euphoria"
object line   -- the next line from the file
 
-- First, we try to open the file called "tutorial.doc"
fn = open("tutorial.doc", "r")
if fn = -1 then
    puts(1, "Can't open tutorial.doc\n")
    abort(1)
end if
-- By successfully opening the file we have established that
-- the file exists, and open() gives us a file number (or "handle")
-- that we can use to perform operations on the file.
 
e = 0
while 1 do   -- this is always true - apparently an "infinite" loop
    line = gets(fn)
    if atom(line) then
        exit -- no more lines, end of file,
             -- this is how we quit the loop
    end if
    if match("Euphoria", line) then
        e = e + 1
    end if
    -- When you get bored,
    -- Press down-arrow until you are out of the loop
end while
 
-- Print the total number of lines containing "Euphoria".
-- We need \" to get a double-quote within a string.
-- %d formats for an integer value in base 10 (decimal)
-- 1 prints to the screen (standard output)
printf(1, "%d lines contain \"Euphoria\"\n", e)
 
-- close the tutorial.doc file
-- This is not really necessary, but you can only have
-- 25 files open at any one time.
close(fn)
 


OK: Normal computer program is executed from top to bottom, line by line, statement by statement, one after the other. The programs ends when there are no more statements to execute.


On the other hand, Ladder Logic Programming is designed to operate machines, therefore it is focused mainly on I/O (inputs/outputs). So, The PLC (Programmable logic controller), using a Ladder Logic Programming, is -

First: Reading ALL Inputs (from the machine, or from the inner memory),
Then: Resolving ALL the Ladder statements from top to bottom,
Last: Writing ALL Outputs, according to their LAST value in the Ladder program (to the machine, or to the inner memory).

Single Push Button On/Off Ladder Logic example:

[image]


OK, The main difference between PC programming and Ladder Logic Programming is that:

The PLC (Programmable logic controller) updates all Outputs only at the END of the program, then it starts the program from the beginning (inside an infinite loop) and reading all inputs.

A PC program does I/O (input/output) instantly, and it's not bound to any infinite loop.


This can be confusing in the beginning.

Having a programmer's skills allows you to "squeeze" the PLC performances and ability to the maximum. i.e. you can do with a cheap PLC lots of things that are available only on a very expensive PLC... Ladder Logic Programming is designed for electricians, not for programmers, therefore they usually purchase the expensive PLC... :lol: :clap:

Most of the PLC Ladder Logic programs that I've seen, written by electricians, were:

  • Dangerous.
  • Unreadable.
  • Unmaintainable (Black Box).
  • Surely including hidden bugs.
  • Undocumented.
  • Cryptic (mixing 9 Inputs + 2 Outputs at the same line... :surprised: Which is "the perfect crime"...).
  • Using unusual commands to solve simple situations.
  • Non modular. (I mean non modular AT ALL).
  • SIMPLY A TOTAL MESS. A BLACK BOX. i.e. HAZARDOUS.

Yet, Ladder Logic Programming is fun, interesting, and of course, it's a low level language.

Tags:
Ladder Logic, PLC

Only 3 scopes + 1 in Euphoria 3 ???

by shian ⌂, Saturday, August 29, 2020, 13:33 (31 days ago) @ shian

Yes.

  • 1. Private scope: any variable declared inside a subroutine (procedure, function or type), is private to this subroutine only. i.e. it's visible and accessible only to this routine.

  • 2. Local scope: any variable, constant or routine that you declare without the global keyword is local only to the module (source file). i.e. it is visible and accessible by all routines and local code in this module.

  • 3. Global scope: any variable, constant or routine that you declare with the global keyword is visible and accessible by your entire program, i.e. by all modules. You must use the include keyword (directly or indirectly) to access something global.

  • 4. for loop counter variable: the counter variable of a for loop is declared and initialized automatically since it is always an atom type variable, and it is private to the for loop. i.e. it is visible and accessible only inside the for loop.

P.s. Private overrides Local. Local overrides Global.


But in some other programming languages there are many more scopes...!

So what? bloated syntax leads to bad programming skills and unreadable code. i.e. you must learn how to name variables systematically if you want to write maintainable programs - and not rely on 70 different unmaintainable scopes to save you. Common sense.

Not long time ago Spaghetti-code did not have scopes at all - the programmer had to name his variables properly and systematically. That's the spirit.

Even today, in 2020, any industrial PLC (Programmable logic controller) that I've seen, didn't have scops (all global) :-) ... And guess what? PLCs are everywhere! From Escalators, Elevators, to Parking Lots, to playgrounds, factories, restaurants... Your life is in the hands of a little industrial computer (PLC) that was programmed without using any scope at all!


To sum up:

Programming languages are overwhelmingly bloated today. Full of "shortcuts".
If you wanna be a good programmer then learn how to write a program without all this modern bullshit. You don't need it. All you need is discipline, consistent and systematical coding style - not a pile of keywords and unmaintainable syntax.

Tags:
scope

Pass By Reference vs. Pass By Value

by shian ⌂, Saturday, September 05, 2020, 21:51 (24 days ago) @ shian

One of the most important aspects of Euphoria 3, among many others, is that Euphoria 3 is passing arguments to routines (procedure, function, type) always By Value.

Under the hood, sequence and floating point numbers are passed By Reference. This, among other aspects, makes Euphoria a very fast and efficient interpreted language.


Now - What's the big deal? BASIC allowing both Pass By Reference and Pass By Value, as well as C and C++... isn't it great that you're able to choose?

The answer is NO.

C and C++ languages are almost low level languages, or let's say - middle level languages, therefore they must include very hard to maintain low level features, such as different ways to pass variables to routines.

High level languages, such as BASIC, should have never allow Pass By Reference to be exist, to begin with!


Pass By Reference saves you few minutes of programming. But maintaining a program takes much more time then writing a program! And... as you could guess: Pass By Reference is the worst nightmare for the maintainer of your program - even if the maintainer is yourself!

Pass By Reference is an invisible feature of the language that completely throwing to the trash the concept of private variables... i.e. Pass By Reference is modifying the variables of the calling routine silently and invisibly - and what would you call it? What scope is it? Private? Local? Global? Export? Import? What??? NO. It's not a scope at all. It is a low level feature that exist in low level languages for a good reason - yet it should NEVER be exist in any high level language.


All I can say is that Pass By Reference is modifying variables invisibly, therefore it leads to lots of bugs when you write the program - and it is a nightmare when you maintain the program, i.e. since it is an almost invisible feature, you must check each variable of each routine to see if: was it passed by reference? or was it passed by value? The highly important concept of private scope is thrown to the trash - that's crazy.

Euphoria 3 is a very high level language, safe, readable and easy to maintain. Low level features such as "Pass By Reference" are the antithesis of readability and maintainability.


P.s. BASIC had to Pass By Value by default and allow Pass By Reference using a very visible and clear syntax... (Euphoria 3 does not need it anyway).

Tags:
reference, value, function, procedure

RSS Feed of thread
powered by my little forum