Impact of 64bits vs 32bits when using non precise GC.

As ARM release its intention to go 64bits, we can be pretty much sure that almost every device will be 64bits soon, except the one on which it is unrealistic to run a garbage collector.

A garbage collector can be precise like in Java, or not, like D’s GC or Boehm’s GC for C++. It means that theses GC don’t know what it a pointer and what isn’t. Non precise GC cannot move data to compact the heap, and are also prone to false positive. On a theoretical perspective, switching from 32 bits to 64 bits should improve things, but what it is in practice ?

Continue reading

A review of D2 – constness and immutablility

The D programming language is a very promising language. I propose here to do a quick review of some problems it is facing (or at least problems I’m facing when using it) and propose some solutions.

Immutability and constness in D2

I wanted to to a single, but writing it, it kept getting longer and longer. The point wasn’t to rant randomly, but also to make some proposal to improve things. So I did split it into smaller articles, and here the first one. We will discuss constness and immutability in D2.

Continue reading

The hashtable closure pattern

I noticed that I was using a pattern of my own more and more. It is actually very usefull, for several reasons. It may have been used by other before me, but never saw a name for it.

This pattern is useful when you have to apply an operation dependent on parameters several times. for example when you want to apply a calculation on all elements of an array, the calculation depending on some parameters. This article will explain you that pattern and demonstrate how it can be used in Javascript, PHP and D.

This pattern can be used in any language that support first class function and hashtable, that is becoming more and more common (closure support was added in PHP as of version 5.3).

Continue reading

The PHP is an HTML element, not a PHP one.

On many Internet websites, you’ll come across article explaining you HTML and PHP. But none of them teach you that the PHP tag should be considered as an HTML element, not as a PHP one. Worse, many example you’ll find does this mistake again and again. This article is PHP centered, but apply to other technologies like JSP or most templates systems, where code is mixed with logic.
Continue reading

Interfacing D with C++ : start new thread

Interfacing D with C++ is sometime tricky. In this scenario, I will show how to start a thread from C++ that execute C++ code, but in a valid D environment, so that C++ code can interact with D code safely.

This work as been done to port SFML2 to D2 language. But the technique is useful for anybody who want to start safely thread in a environment with code in both C++ and D.

Continue reading