FOAM TOTEM
Naked Programmer Cam - Postcards - Schwag - The Svelte Programmer
Orb of Hotep - Random Stuff - SF Bay Trojans - Totem Tales - Photos - Gallery

Last update: 24 Dec 2007 -- 6:14pm

Foamy
Christmas Radio [high] [low]
 Monday
24 Dec 2007

Photos from my trip to the UK. There aren't many; too much time doing business stuff.

 Friday
14 Dec 2007

So, I'm going to several places this week. Most are in and around London (one right by Wimbledon) and one is nearer to Birmingham (~1.5 hours NW of London).

 Thursday
13 Dec 2007

I'm going on an impromptu business trip to the UK from Saturday to next Thursday. Woooo!

 Monday
3 Dec 2007

When did "global warming" become "climate change"?

 Saturday
1 Dec 2007

There are a lot of computer languages out there, and I'm largely agnostic about them. Most are somehow the same at some level (with the exception of the willfully obtuse ones). Syntax isn't unimportant, but the basic facilities of the language are more important.

Cryptic Studios writes practically everything in C. In addition, we support evaluating expressions provided at runtime. The combat system in particular uses these expressions for calculating damage and duration of effects. The alternative to using data-driven expressions is to compile them directly into the code. This makes simple changes to the combat system much more difficult to test (and therefore fix rapidly).

I wrote the expression evaluator used in City of Heroes/Villains. It was a very simple, Forth-like stack machine. I chose this approach because I wanted to spend the minimum time writing the code for it. At that point in the project there was really only a single use for it (badges), so I didn't try to make it nice. Stack machines aren't easy on the uninitiated; they are postfix. But it was extensible, could support C functions and so on, and the implementation was dead simple.

I have found that often wanted more than this simple evaluator. I've wanted a little more oomph. I have realized that there are some features which are very cool to have in a small utility language.

And that's the point of this post: to list the things one needs from an evaluator. (And I know that 98% of you don't care about this.)

A simple evaluator needs to have this:

  • All standard C expressions. Duh.
  • Automatic type conversion from string to int to float and back.
  • Natively understands strings. Can concatenate, split, etc.
  • It must be easy to export and use variables and functions from C to the evaluator.
  • Argument count and type checking.
  • Bullet-proof. If a function doesn't exist, the syntax is wrong, or something goes haywire, the evaluation must still properly terminate. So, no loops.
  • If...else

Probably useful

  • Variables. It turns out that you need access to read C variables much more than you need your own variables in the eval or write to C variables. (Especially if it's a stack machine since the stack is actually a bunch of variables.)

Things which are scary but oh so useful

  • Loops. Here begins the possibility for infinite loops and thus bullet-proofness is harder.
  • Able to self-eval. An expression should be able to construct another expression as a string which is then evaluated.

A useful full language further needs

  • Arrays
  • Hash tables. How did I ever live without these as a basic data type? There is very little cooler than Stuff["Hat"] = "Touque".
  • Anonymous/lambda functions. sort(list, { a.field - b.field })

(The above is a lot of shorthand too.)

1997
Sep Oct Nov Dec
1998
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1999
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2000
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2001
Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2002
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2003
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2004
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2006
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2007
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Pictures of Max - rv's photos - popplers - Snuffy's photos