Comments on: A Guru-level Bug in Pseudo-datatype Reflective Construction
REBOL experts will delight in this bug recently found by guru Gabriele Santilli. (Non experts are free to skip this article. ;)
Since this article is for experts only, the problem can be concisely summarized as: construction of reflected functions may not be equivalent in some cases. This is due to a bug in pseudo-datatypes (often called just pseudo-types).
Gabriele found it when he was building an RPC mechanism on top of REBOL/Services. A bug popped up in a simple remote construction of the append function. Upon removing the RPC and REBOL/services environment and reducing it down to the minimal expression, this error was found in a new function apd that should be identical to append:
>> apd: func load mold/all third :append second :append >> apd [1 2 3] 4 ** Script Error: apd expected series argument of type: series port
In other words, a reconstructed version of append failed when it was expressed as a reflected string. You can see the problem concisely if you use the literal datatype directly:
>> do func [b [#[datatype! series!]]]  "" ** Script Error: ?function? expected b argument of type: series
This is caused by the fact that the construct function (used within load) improperly made the pseudo-datatype.
This bug has been fixed in the next release. A good one, Gabriele! Also, I apologize if anyone found this bug earlier and reported it. If so, we missed it.
Post a Comment:
You can post a comment here. Keep it on-topic.