Author Topic: variable storage & retrieval  (Read 3547 times)

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
variable storage & retrieval
« on: December 09, 2009, 02:55:11 AM »
Currently DB2 has makes a distinction between variable assignment and retrieval:
reading a variable is one command (.variable)
storing a variable is two commands. (.variable store)
Retrieval is implicit, storage explicit. What is the reason for this? For consistency one would expect .variable store and .variable read (both explicit, 2 BP) or .variable and something like >variable. (both implicit, 1 BP). As it is now it is easier for a bot to evolve variable retrieval than to evolve variable storage. I expect evolution sims to be faster (and or more interesting) if both are implicit. How is this giong to be done in DB3?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
variable storage & retrieval
« Reply #1 on: December 09, 2009, 02:24:05 PM »
It's actually *.variable vs. .variable store.  .variable just means to look up the (custom or predefined) sysvar named variable and turn it in to a number.  But you're right it's a little inconsistant.

DB3 DNA is smarter about knowing that "variable" means a certain number.  So storing becomes either 10 .variable or 10 variable store, and dereferencing becomes *variable or variable ref.  So there's symmetry between storing and loading and the number of bp required.  Check out THis old topic.  It has an attached command line DNA interpreter you can use to play with the language.