On Thu, Jun 27, 2013 at 11:37:20PM -0700, Tony Cook via RT wrote: > On Thu Jun 27 19:43:13 2013, pcm wrote: > > Also, since the logic for generating warnings is only stored in the > > tokenizer itself, if something like set_prototype or a prototype > > attribute wanted to do illegalproto warnings, it would have to > > duplicate that logic. Moving the code into a separate function allow > > for code reuse for other mechanisms of setting the prototype. Do the things that you want to follow up with require that this function is available to XS code? > > If this patch is accepted, please apply and hold this ticket open; > > perldelta will need to be updated, and I'm not sure of how that should > > be done, and in the meantime I can base a couple of other illegal > > proto warnings fixed off of the new function. > > This works for me and looks sane, but I'm going to wait for any further > comment for a few days. > > Especially on the public/private part. As it is structured, I don't think that it is a great API. I think that a better API would not be to call the warner directly, but instead return a description of the error (or NULL, if clean), so that the caller can decide how and when to report the error. That API might (in turn) be wrapped by another (private?) function that implements the warning/not warning logic, if that logic would otherwise be repeated across the source. Nicholas ClarkThread Previous | Thread Next