Hi, > Somehow the compiler must know how many bytes are arriving. It has > knowledge of the protocol type so I presume it would be possible, even > if at its simplest it just expanded to write the same code for every > entry in the protocol. It's just a suggestion though, I don't mean to > be demanding features ;-) Yes, this can be done ;). And it is already done so for two magic PROCs, DECODE.CHANNEL() and ENCODE.CHANNEL(). These turn regular channel comms into size/address pairs (extended inputs used to keep address valid), and back again -- part of the infrastructure used for the "application link layer" (which I mentioned at CPA-2005) and KRoC.net/pony (Mario's stuff). The code in the compiler that did the expansion of PROTOCOL definitions into handling has been superseded by external C (CIF) code that does largely the same job, but using a binary description of the type dropped by the compiler (this avoids code-size explosion when expanding really big protocols). Having a DEFAULT mechanism for tagged protocol input should be pretty easy (ish) to implement, and safe (even where protocol inheritance is involved). I'll add it to the to-do list, hopefully I can recycle some of the code already in the compiler :). Cheers, -- Fred
Attachment:
pgpO_BGvw2cu2.pgp
Description: PGP signature