Program crash: GC destroys an object unexpectedly

eugene dee0xeed at gmail.com
Thu Sep 23 20:25:21 UTC 2021


On Thursday, 23 September 2021 at 19:32:12 UTC, eugene wrote:
> C (more elaborated) variant:
> http://zed.karelia.ru/mmedia/bin/edsm-g2-rev-h.tar.gz

Sound, GUI? Easy, see
http://zed.karelia.ru/mmedia/bin/xjiss4.tar.gz
It's computer keyboard 'piano', based on the same engine.

As I've already mentioned, I was inspired several years ago
by very nice book, 'Modeling Software with Finite State Machines: 
A Practical Approach'
by Wagner F. et al.

I applied some ideas from the book to Posix/Linux API and
developed EDSM - 'Event driven state machines' - and since I
do not need no libev, libevent and alike.

State machines per se are very powerful methodology
to model program behavior. Also notice,
that machines communicates with each other
by messages - remember Alan Key main OOP principle?
It's message exchange, not class hierarchy (inheritance 
blah-blah-blah).

As to client-server echo pair in D, it is my 3rd (and most 
successful!!!)
attempt to re-implement EDSM in some 'modern' language.

Initially my criteria for choosing a lang were:

- compiles to native code, goodby Java
- no garbage collector, goodby almost all :)
- no classes, only interfaces.
- maybe, something else, do not remember

The only language, that fit to my initial desires, was Rust.
But borrow checker (and especially <'a>, expicite lifetimes)
appeared to be the real hell for me. One can use raw pointers
instead of references, but then your code is from head to toe
is in unsafe {} blocks.

Next one was (just accidentally) was c#.
Here, I was not be able to make signals work properly and I 
dropped it.

After reading some texts a la 'alternatives to c++',
I decided to try D, despite it's 'unpopularity'.





More information about the Digitalmars-d-learn mailing list