For Programmers: Free Programming Magazines  


Home > Archive > Tcl > January 2008 > Re: Re: [TCLCORE] TIP #312: Create 'link' Command and Add More Link









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Re: [TCLCORE] TIP #312: Create 'link' Command and Add More Link
rene

2008-01-28, 7:43 pm

Betreff: Re: [TCLCORE] TIP #312: Create 'link' Command and Add More
Link Types
Gesendet: Mo 28 Jan 2008 13:00:28 CET
Von: "Alexandre Ferrieux"<alexandre.ferrieux@gmail.com>

> The reason I'm asking this, is about levels of abstractions, and risks.
> If all you need is a Tclish access to a block of shm/mmaped file, then
> maybe a better approach would be to extend the ByteArray type to allow
> it to be backed by one of these blocks, and add the missing machinery
> for in-place modifications if write access is needed:
>
> set x [mmap $ch $off $len rw] ;# $x has a ByteArray IntRep
> (or: set x [shm $id rw])
> set p [string range $x 16384 16387] ;# you can then use [binary]
> string set x 16384 16387 ABCD ;# [string set] operates in-place
> on unshared values
>
> As you can see, the ByteArray approach gives a rock-solid protection
> against wandering pointers, since the usual bound checking is always
> done on bytearray indices. The only needed extra are the mmap/shm
> commands, and the adaptation of tclBinary.c to handle preexisting
> storage, and a new [string set] working like flat [lset] but for byte
> arrays.

Sure you can do that. But with the proposed 'link' extension you get
also traces.
And because of the given 'size' it is not possible to write outside.
And after
'link'ing you can even forget about addresses. Just use simple tcl
variables.

Both solutions have the same problem. The size must be given from
outside.


rene
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com