Re: Please VOTE! Changing keywords to functions
Lenard Lindstrom <[email protected]> Tue, 27 Jul 2004 09:46:19 -0700 (Pacific Daylight Time)
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <Mahogany-0.66.0-4294580231-20040727-095615.00@pop3.norton.antivirus> |
On Mon, 26 Jul 2004 22:42:42 -0700 Mark Hahn <[email protected]> wrote: > > We have already changed "print" and "yield" from keywords to functions. > Guido specifically mentioned "exec" so I will put that on my to-do list to > change also. > > Greg's logic for changing "print" was that "there was no reason for it to be > a keyword". Martin pointed out that functions can be overriden while > keywords cannot. > > Both of these arguments can be applied to any keyword that doesn't include a > code block with maybe these exceptions... > > The keyword "del" has a syntax problem if changed to a function. It's args > would be evaluated instead of kept as l-values. > > The keyword "pass" should stay special since it generate no code. > > The three keywords: "break", "continue", and "return" have no reason to be > treated special except that they are already keywords in a zillion different > languages. Yield is now a function so why not return? It is really nice to > be able to say break and continue without following it with parens though. > The parser does treat return a bit special right now so if it wasn't a > keyword I may get into trouble, but this could probably be fixed. > > That pretty much leaves this list as candidates for conversion... > > assert > from > import > raise > > Please vote on which keywords you think should be changed to functions. > > I vote for adding exec, assert, from, import, and raise in addition to print > and yield. > > import -- keyword from -- keyword assert -- function? (will there be a case where assert statements can be optimized away?) raise -- function? (but does it make sense to pass it as an argument?) import and from are like the object statement in that they assign values to identifiers. I would hate to have to do import($foo). Or would it be foo = import("foo") ? break and continue are flow control statements that take optional labels. They definitely are keywords. The parenthesis were removed from the C return statement years ago. Should they be put back in Prothon? Lenard Lindstrom