I'm renaming :keywords to "control words". "Keyword" means something else in Python. In the Hissp documentation I was calling them "key symbols", I think I'll change that as well for consistency.
:controlwords are used by some of the little DSLs created by macros, sometimes to label what the next argument is for (e.g. :as in from:/import: and try:.)
But there are cases when I want blocks to have these labels attached. I think it's more natural to just allow the control word to take arguments like symbols do than to use :foo pass: or pass: :foo.
Obviously this makes no sense at the top level. Python identifiers can't have :. (That doesn't stop you from putting a non-identifier string in a __dict__ though.) So I don't think Hissp would compile it into anything sensible. But inside a macro, the code would get rewritten anyway, and this can make sense, for example
Because of automatic qualification of reserved words and of normal unqualified symbols in masks, using symbols here is kind of more difficult than it should be. Control word wouldn't have this issue. And because control words can have special characters, the !mask: macro can look a little more lispy and use :,:/:,@: instead of _:/__: like before.
On the downside, we're using even more colons than before. Unfortunately, Hissp had to special case :keywords at the compiler level to make them work, and Python used colon to start blocks for completely unreleated reasons. Maybe I could change the :keyword symbol to $keyword or something. The code examples in docstrings also look funny if the IDE thinks it's supposed to be reStructuredText, because having a word beginning and ending with a colon (like :foo:) means something in that language.
I'm renaming
:keywords
to "control words". "Keyword" means something else in Python. In the Hissp documentation I was calling them "key symbols", I think I'll change that as well for consistency.:controlwords
are used by some of the little DSLs created by macros, sometimes to label what the next argument is for (e.g.:as
infrom:
/import:
andtry:
.)But there are cases when I want blocks to have these labels attached. I think it's more natural to just allow the control word to take arguments like symbols do than to use
:foo pass:
orpass: :foo
.Obviously this makes no sense at the top level. Python identifiers can't have
:
. (That doesn't stop you from putting a non-identifier string in a__dict__
though.) So I don't think Hissp would compile it into anything sensible. But inside a macro, the code would get rewritten anyway, and this can make sense, for exampleor
Because of automatic qualification of reserved words and of normal unqualified symbols in masks, using symbols here is kind of more difficult than it should be. Control word wouldn't have this issue. And because control words can have special characters, the
!mask:
macro can look a little more lispy and use:,:
/:,@:
instead of_:
/__:
like before.On the downside, we're using even more colons than before. Unfortunately, Hissp had to special case
:keywords
at the compiler level to make them work, and Python used colon to start blocks for completely unreleated reasons. Maybe I could change the:keyword
symbol to$keyword
or something. The code examples in docstrings also look funny if the IDE thinks it's supposed to be reStructuredText, because having a word beginning and ending with a colon (like:foo:
) means something in that language.