Re: Please VOTE! Changing keywords to functions

"Mark Hahn" <[email protected]> Tue, 27 Jul 2004 10:21:39 -0700
Newsgroups gmane.comp.lang.prothon.user
Message-ID <004101c473fe$2d6026a0$da01a8c0@walker>
Martin wrote:

>True, it is. As overloaded functions, could anything nifty be done
>with them? I'm thinking something along the lines of break(2) to break
>out of two levels of nested loops, or continue(2) which says to skip
>the rest of the current iteration, the one after that and then
>continue with the loop, etc. Is this doable?

Prothon already supports "break label" and "continue label" where labels are
allowed only before "for" and "while" keywords, but this is handled in the
parser and would have to be changed a lot to be function compatible.  I
guess they could be changed to accept symbol variables.  This would be more
dynamic.  This would mean you'd have to say break() for the simplest case.

>Mark> That pretty much leaves this list as candidates for
>Mark> conversion...
>Mark>  assert
>Mark>  from
>Mark>  import
>Mark>  raise
>
>Right... but wouldn't it be possible to unify import and from? As
>keywords, some syntactic oddness is to be expected, but since it reads
>pretty much as natural English, most of us don't notice. As functions,
>this suddenly becomes more apparent. How would you have them look?

I'm thinking we'd design keyword arguments for a single import function.

>Mark> Please vote on which keywords you think should be changed to
>Mark> functions.
>
>I think that return and yield should be the same, whether keywords or
>functions. import and from depend on whether we can make that pretty
>enough. :-) break and continue... well, if something interesting can
>be done with them as functions, perhaps that might be worth
>considering, but I like them as keywords. Other than that, my vote is
>definitely on exec, assert, raise and print.

I'll take that as a vote for return, from, import, exec, assert, & raise.