[Ohrrpgce] SVN: teeemcee/10508 hspeak: scripts and subscripts can now have attributes too

Ralph Versteegen teeemcee at gmail.com
Sat Aug 18 19:24:40 PDT 2018


You might be wondering what the purpose of function (command, script and
math function) attributes are. Well, I will use @obsolete to mark commands
that you shouldn't use, since I noticed it's easy to make the mistake of
calling getattackname instead of readattackname. Aside from that, I simply
imagine we'll want some more in future...
I used the @ syntax to look like Python decorators, but that can still be
changed. It turns out that using @ for both references and attributes isn't
a problem, because all valid attribute names are hardcoded in hspeak.

One possible attribute might be @builtin for scripts in plotscr.hsd, to
mark that they should be skipped over the debugger.
Or @shadow could make a script's variables shadow the names of global
variables/constants, instead of using an ugly hsd: prefix on everything.
But both of those could be replaced with some whole-file directive instead.
I was actually thinking of some "namespace" block, to make it easier to
slot in someone's scripts without clashes. Probably a bit overboard.

Another one would be @optimize(always/never) which I need in order to write
testcases for hspeak's math simplification. You might remember that there
is a bug where ^ is misoptimised on Mac; I never checked that fix in
because I couldn't write a testcase for it! I started implementing a
"directive" statement, which I never finished but oddly enough duplicated
part of what attributes do.

On 19 August 2018 at 14:03, <subversion at hamsterrepublic.com> wrote:

> teeemcee
> 2018-08-18 19:03:53 -0700 (Sat, 18 Aug 2018)
> 117
> hspeak: scripts and subscripts can now have attributes too
>
> Phew, that was a lot more complex to add than expected...
> ---
> U   wip/hspeak.exw
> U   wip/testgame/parser_tests.hss
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20180819/6b88a167/attachment.html>


More information about the Ohrrpgce mailing list