mbrezu / cl-messagepack

A Common Lisp implementation of Message Pack
BSD 2-Clause "Simplified" License
29 stars 13 forks source link

setting *use-null* to t decodes xc0 to 'null #24

Closed jsulmont closed 1 year ago

jsulmont commented 1 year ago

As it is, cl-messagepack does not distinguish between decoding xc0 and decoding xc2: they both decode to nil in Lisp. However there may be cases when this distinction is important (e.g. cl-transit). This PR introduces a top level variable *use-null* which when not nil decodes xc0 to 'null.

phmarek commented 1 year ago

Thanks!

Upon reading that patch I wonder whether it would be better to have a *c0-value* (perhaps with a nicer name?) instead, that could be bound to 'null or any other value. That would be a bit inconsistent with *use-false*, but allows for more flexibility.

OTOH, YAGNI might easily apply here, so lets run with it.

This is the 5th variable that influences decoding; if you have some spare time for something like a (defmacro with-standard-msgpack-settings ((&key ...) &body body) ...) I'd appreciate that!

jsulmont commented 1 year ago

Thanks Philip for merging this. I'll submit a PR for (defmacro with-standard-msgpack-settings ((&key ...) &body body) ...) as suggested :-)