durusmail: qp: qpy development ideas
qpy development ideas
2007-10-08
2007-10-09
Re: qpy development ideas
2007-10-10
2007-10-10
2007-10-14
2007-10-15
David K. Hess (2 parts)
2007-10-09
2007-10-09
2007-10-10
2007-10-10
2007-10-10
2007-10-10
2007-10-10
qpy development ideas
David K. Hess
2007-10-10
On Oct 10, 2007, at 5:59 AM, David Binger wrote:

>> What if the decorator function was primarily a NOOP and just used to
>> identify which functions/methods qpy will templatize? I.e. if a
>> function/method is wrapped with a particular decorator from the qpy
>> module, then it gets templatized during compilation. The decorator
>> could also check to make sure that the function/method had indeed by
>> templatized and throw an exception if not.
>
> That's basically the same as what I proposed at the start of this
> thread,
> except that the "decorator" raises a SyntaxError if it is compiled by
> the ordinary python compiler.
>
> It is true that we could use a conventional decorator that just raises
> an exception if it executes at all.   In this case, the file with
> templates
> would need to import those conventional decorators and make sure
> that those names were never assigned any other values.  If the
> decorators
> did not execute as intended, you might not get a template compiled
> as a non-template, and that would be very bad.
>
> It seems better to be certain that you can't ever compile a file
> with the wrong compiler.
>
>> Would this allow files to end in .py?
>
> It seems better to know up-front which compiler is required.

Why I personally lean towards .py extensions is that .qpy extensions
at first seemed a little radical and worried me when I considered
adopting it. I.e. it was a psychological barrier to entry for me.
Granted, in actual use, qpy is great and the .qpy extension has
turned out fine and very trouble-free.

As to the concern about hypothetical qpy decorators not executing as
intended, I'm not sure I see how it would be any more or less of a
coding error than any other misuse of an imported symbol. Granted,
you get an exception when the compilation fails in the normal case
versus incorrect return values in this case, but what are the odds
that the qpy decorator symbol would have been misused like that?

Overall though, I'm not strongly inclined either way as it just isn't
that big of an issue to me. I think qpy works great as it is.

Dave

------
David K. Hess
Cell 214.684.5448 | Fax 214.764.7183
dhess@fishsoftware.com






This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply email and
delete and destroy all copies of the original message.
reply