/sys/doc/ Documentation archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generic Programming



Otfried Geffert wrote:
> 
> How do I write a generic stack, associative array, hashtalbe, ...
> in Limbo?
> 
> In C I used void*, so I could put every datatype into the stack,
> associative array, ... .


You write a preprocessor that implements templates, since
there is no equivalent of void in Limbo.

It's not just that Limbo is strongly typed without type
casting, the Dis virtual machine is, typed, also.
Dis instructions are not machine code; they are fairly
complex operations like
"copy this adt, return a reference, and increment reference counts".

I'm not familiar enough with the guts of Inferno to
know what prompted those design decisions, but they
have some clear advantages.