0

I read that it is important to use types , as they have specific size of memory, which helps fetch the necessary chunk of memory and to also know how to interpret the data.

Is this true? and if yes, this means that scripting languages use this mechanism behind the scenes even though they are dynamically typed?

Naughty.Coder
  • 3,922
  • 7
  • 32
  • 41
  • 1
    At least in most cases, yes, they have and use some sort of type mechanism behind the scenes (but the details vary by language and implementation). – Jerry Coffin May 08 '15 at 17:28
  • Technically, typed languages don't use "types" behind the scenes because the electrons inside your RAM chips don't have types. They just use a large array of bytes (which is what RAM chips are). In the 80s people experimented with hardware types (tagged memory) but those architectures failed to gain market share – slebetman May 19 '15 at 03:20

1 Answers1

0

Correct there is a type behind the scenes. Most untyped languages are implemented with all data wrapped up in a generic VALUE type (Names vary by author and language). Every piece of data is somehow representing as an instance of the VALUE data-structure.

Among the things carried in this data structure are the size in memory and some way of describing "what am I".

John F. Miller
  • 26,961
  • 10
  • 71
  • 121