Re: Function once: concern
Paul Prescod <[email protected]> Thu, 15 Jul 2004 04:31:45 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote:
>>From: Paul Prescod
>
>
>>Sorry, can you point me to the use case?
>
>
> http://www.prothon.org/pipermail/prothon-user/2004-July/002820.html
Missed that one.
We're still talking about the difference between:
object Foo:
def run():
once:
doInit()
doStuff()
and:
object Foo:
initialized = False
def run():
if not self.initialized:
self.initialized = True
doInit()
doStuff()
I'm kind of amazed that we're talking not about a function but a
_keyword_ for doing such a trivial thing. There are many, many people
who want to learn every keyword of their language to make sure that they
aren't missing anything important. You're going to put the burden of
learning this keyword on them for a once-a-year use-case.
What about explicit is better than implicit?
>...
> I think outer usage cases are straying far away from Python's usage
> cases. Outer is useful for so much more and who knows what future uses
> we might come up with. That is the power of a good tool.
If you feel strongly about it then do what you think is right. But bear
in mind that outer is _just_ syntactic sugar. If it becomes too general
then it becomes less like sugar and more like medicine. "Great taste of
medicine -- all of the health benefits of sugar!"
It's the middle of the night so I don't have time to work through a
bunch of use cases but I would suggest that the right way forward is to
take 5 examples from the Python PEP and write them in the three syntaxes:
1. No sugar.
2. One (or more!) of the Python PEP syntaxes.
3. outer: syntax
If we don't have time to do this then maybe we should just leave the
feature out of Prothon 1.0. As pure sugar it seems delayable. We
shouldn't rush the design of something that can wait...
Paul Prescod