Data Types

I have been thinkering with whether or not to support advanced data types; to allow registration of some “Property Handlers” so as to allow something akin Object Oriented programming.  While this could allow some really powerful things to be done down the road this could really impact performances.

For example, let’s take a simple integer.  We can have  a simple “x: dd 1″ to define a 32-bit value initialized to 1; increasing it by 1 is as simple as “inc dword [x]“.  In an OO world, this would be calling a function “Increment” on the object “x” and depending on the implementation the cost of this operation can be a simple “push x; call _increment; mov eax, [esp+4]; inc dword [eax]; retn 4″ or as complex has:

  • Identifying the data type of “x”
  • Locating the “Increment” procedure for the identified data type
  • Calling the “Increment” procedure
  • Incrementing
  • Returning

While “files” and “TCP Ports” may be good candidates for OO due to the more complex functions involved, I’m thinking that there must be a way to provide the meta-data required to do live data type identification while minimizing the performance impact.