Re: Please VOTE! Changing keywords to functions

Martin Christensen <[email protected]> Tue, 27 Jul 2004 11:16:00 +0200
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
>>>>> "Mark" == Mark Hahn <[email protected]> writes:
Mark> Yield is now a function so why not return?

Indeed. Since the two do conceptually the same thing, I'd definitely
think it weird that they have different syntax. At the very least, I
think the two should be consistent, whether as keywords or as
functions.

Mark> It is really nice to be able to say break and continue without
Mark> following it with parens though.

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?

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?

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.

Martin

-- 
Homepage:       http://www.cs.auc.dk/~factotum/
GPG public key: http://www.cs.auc.dk/~factotum/gpgkey.txt
signature.asc (application/pgp-signature, 196 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iEYEABECAAYFAkEGHVAACgkQYu1fMmOQldX7zwCgyhpoZGmO5NNiT9uK50XxemAL
uZkAoK3TVc9IfvSKImSMMe/F7yUbzh/h
=tele
-----END PGP SIGNATURE-----