> >> And the conversions to octet vectors may work for strings, but not in >> general for arbitrary integer or float values… > > I’m not sure what you mean there. This code? > > (defun to-byte-array (x) > (let ((retval (make-array 0 :adjustable t > :fill-pointer t > :element-type '(unsigned-byte 8)))) > (map 'nil (lambda (c) (vector-push-extend (char-code c) retval)) > (format nil "~A" x)) ; > (coerce retval 'ironclad::simple-octet-vector))) > > I would think the ~A in the format would give a solid textual representation > for any type that has a printable expression. Am I incorrect in that? >
Sorry, I might have got a bit ahead of myself there. But in general, objects that might be involved in a transaction could have values that are difficult to print. Take for example a structure, or a class instance. And for floating point values, the ~A is too lenient in terms of digits printed, rounding, etc. This code will also be dependent on the current value of *PRINT-BASE*, which I noticed that you permanently set to 16 along the way. But I saw your intent, and I substituted my own network byte encoding which handles everything except compiled closures. - DM