[Email-SIG] fixing the current email module

Oleg Broytman phd at phd.pp.ru
Fri Oct 9 12:54:33 CEST 2009


On Fri, Oct 09, 2009 at 01:10:40PM +1100, Steven D'Aprano wrote:
> On Thu, 8 Oct 2009 08:18:40 pm Oleg Broytman wrote:
> >    Are you going to parse any garbage and create a Message (probably
> > an empty Message) with one defect "cannot parse it at all"?
> 
> So long as the raw garbage is available for the caller somehow, that 
> seems like a reasonable approach to me. That lets an application 
> display "Unparsable message" to the user, who can then ask to "View 
> Source" (or equivalent) to get access to the raw bytes of the message.

   I don't see any difference with "raise an exception; the calling
application catches the exceptions, displays or logs "Unparseable message",
and displays or logs the original garbage (that can be an attribute of the
exception instance)".
   The difference IFAIU could be between well-formed messages and complete
garbage. A not well-formed input will be parsed to a Message, and such
parsing requires a clever algorithm with resynchronizations (jumps from a
bad point to a recognized good point to restart parsing there). I don't
know if it's possible to create such a clever algorithm; and for complete
unparseable garbage I still prefer an exception.

Oleg.
-- 
     Oleg Broytman            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Email-SIG mailing list