Pointers in Slate.

Pupeno pupeno at pupeno.com
Wed Nov 10 17:26:44 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Je Merkredo Novembro 10 2004 18:13, Michael Walter skribis:
> I don't think you want to do dynamic allocation from C. I can't see
> much wrong with just passing the pointer (as long as there is an
> integer type in slate which has the size of a pointer).. and then
> adding some abstraction to that *in Slate*. But I could be wrong.
I'm trying this way... passing the pointer back to slate, since I'll have to 
move this pointer from one extension to another.
The main problem I have with pasing pointers, or number in general is that, 
the small ones (<= 1073741824 = 2^31/2) are SmallIntegers and the rest, are 
BigIntegers. The pointers on x86, if I'm not mistake, are 32 bit, so, 
eventually, they may become BitIntegers.
SmallIntegers can be safelly passed as int, so, I would have the following:

void aFunc(int a){
 doSomethingWith(a);
}

but then, as the number can be big, I need:

void aFunc2(struct ByteArray *a){
 doSomethingWith(baToInt(a));
}

and then on Slate (pidgin):

x at CairoTraits aFunc: number at SmallIntegerTraits [
 'aFunc(number >> 1)' directly.
]  `pidginPrimitive.

x at CairoTraits aFunc: number at ByteArrayTraits [
 'aFunc2((struct ByteArray *) number)' directly.
] `pidginPrimitive.

and on real Slate:

x at CairoTraits aFunc: number at BigIntegerTraits [
 x aFunc: (number as: ByteArray).
] `pidginPrimitive.

Is this aproach the one I should take ?
- -- 
Pupeno: pupeno at pupeno.com - http://www.pupeno.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBkr/WfW48a9PWGkURAnCrAJ9DU0Bod3NyloW0SgiA2iJCE2GyugCfa+hl
4mBnNDFR/cY+QEKuUJ0n4h0=
=wKBn
-----END PGP SIGNATURE-----




More information about the Slate mailing list