http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gameprogrammer] More scripting: Multiple return values



Some more questions regarding RT scripting language design;

* Does anyone have experience with game and/or real time
  scripting with a language that support functions with
  multiple return values?

* Are multiple return values seriously useful? Confusing?
  Dangerous?

* Does it make sense to have variable number of return
  values?

* If so, which is more sensible; letting functions return as
  many values they feel like, or letting the caller tell the
  function how many results it should return? Or maybe ask
  for at most N return values, and then check how many you
  actually got?


I currently have support for multiple return values. (Functions have a 
list of "return arguments" before the function name in declarations.) 
There is support for variable argument count, but the result count is 
fixed. (Hardwired at compile time.)

I also have these function references we've been discussing the last 
few days, and obviously, these cause trouble since I can't tell how 
many return values to make room for by looking at the function 
declaration. :-/

A related problem is caused by the fact that I've implemented the 
assignment operator ('=') as an actual operator. That means it's 
handled by the normal infix expression evaluator, which in turn means 
that I can't just look at the left hand subexpression to figure out 
how many arguments I want, in case the right hand subexpression 
happens to be a function call. (*If* that's actually desired, that 
is.)


As usual, it's probably a good idea to decide which problems to solve 
before starting to solve them. ;-)


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---