Xavid (kihou) wrote,
Xavid
kihou

Opinions on syntax

(This is mostly for my own benefit, but I'd appreciate opinions if you have them.)

In the proud tradition of taking breaks from computer science by programming, I've been working on Gameki (my crazy object-oriented wiki GameTeX replacement of DOOM) a little lately. One thing I'm not sure how I want to handle are "binary macros". Gameki markup is currently based on Creole, where macros are formatted like tags with double angle brackets. I sorta want to have some macros with two contents areas, like an if with a true side and a false side or a card with a front and a back. There doesn't seem to be any consensus on how to do something like that (tag-based templating languages seem to mostly make you do two separate if statements, for example). Some syntax possibilities are below.
<<if condition>>True side<<else>>False side<</if>>
<<if condition>>True side<</if>><<else>>False side<</else>>
<<if condition>>True side::False side<</if>>
<<if condition>>True side&&False side<</if>>
<<if condition>>True side||False side<</if>> and require empty table cells in an if to be | | not ||

<<card>>True side<<flip>>False side<</card>>
<<card>>True side<</card>><<back>>False side<</back>>
<<card>>True side::False side<</card>>
<<card>>True side&&False side<</card>>
<<card>>True side||False side<</card>> and require empty table cells in an if to be | | not ||

I sorta like the first option for the if statement; it generalizes to <<elif condition>> well, and it's easy to read and less magical. I'm less fond of it for cards, I guess because the word "flip" is sorta dumb (but I can't think of a better one) and it doesn't seem to benefit from multiple continuations or continuation arguments. Sam was in favor of a briefer, punctuation-based separator like the last one before. I'd sorta like all binary macros to be consistent. I'll probably end up going for expressive power and minimization of magic (i.e., the first option), but if you have an opinion, I'd be interested to hear it. I'm not always a great judge of what's easy for most people to understand, after all. ^_^
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments