Hi Jason,

> But the main point I was trying to make is that this behaviour
> is just plain wrong IMHO :

> : (struct Ptr '( P W I ) '(1 . 8) '(2 . 2) '(3 . 4))
> -> (1 2 3)
> : (struct Ptr '( B . 32 ))
> -> (1 0 0 0 0 0 0 0 2 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
>
>The '3' value should be at byte 12, not byte 10 .

No, it is correct. It stores (all little-endian):

   (1 . 8) 1 0 0 0 0 0 0 0  # 8 bytes
   (2 . 2) 2 0              # 2 bytes
   (3 . 4) 3 0 0 0          # 4 bytes

So the '3' is at position 8 + 2.


> As you say, it makes no difference if there is NO struct
> description, ie. with:
>   : (struct Ptr NIL '(1 . 8) '(2 . 2) '(3 . 4))

Another side note: Pairs starting with a number are auto-quoting, so you can
save space and time by writing

   : (struct Ptr NIL (1 . 8) (2 . 2) (3 . 4))



> And maybe 'struct could be augmented so that when it has
> a struct description, it could use it when laying out a

Yes, it could surely be done in many different ways. However, I'm convinced it
would blow up the syntax till it is unusable. The PicoLisp way is to keep things
simple on each level. Platform-specific details should not be handled here, but
on a higher abstraction layer.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to