Re: Re: Please VOTE! Changing keywords to functions
"Mark Hahn" <[email protected]> Thu, 29 Jul 2004 08:23:17 -0700
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mukhsein Johari wrote: > --- Mark Hahn <[email protected]> wrote: >> The keywords "assert", "import", and "from" have >> been eliminated on >> technical grounds. That only leaves: >> >> exec >> raise >> >> break >> continue >> return >> > > What about yield? Is voting on that closed? I'd vote > to keep yield and return be the same 'type' of thing. > Either both functions or both keywords. Making them > different seems confusing. To me at least. The problem is that yield in the new stackless is a method of the ThreadMgr object. ThreadMgr.yield() is actually replacing Channel.transfer(). When the built-in yield(arg) is used by itself, Object.yield(arg) is going to just call curThreadMgr.yield(arg). yield will still do what it does in Python for generators, but it does so as part of a much bigger overall flexible co-routine scheme. So to make a long story short, I really want yield to be a function (method). On the other hand, return is just plain old return with all it's special meaning to the parser. So they really are two very different animals even though they seem similar on the surface. I think they will have to be different. The good news is you can say "return(arg)" and it will work fine. I did that for years in C before I found out I didn't need the parens. :-) > I guess one of the things to think about when deciding > is: > > Do you want users to be able to change the meaning of > those things? Maybe you do, maybe you don't. eg. > > def raise(x): > print x > > Hmmm...seems 'dangerous' to me. One of many dangerous things. > I think that you want to keep things such that the > programmer of a prothon program (either original or > newly recruited) can quickly make sense of things > instead of having to check if things like raise and > yield in that program actually means what he thinks it > does. Keywords give you that sense of certainty. I don't agree. You have to check what keyword actually means just as much as a function.