We think in Tcl EIAS. But, think again.

By virtue of so call EIAS, in Tcl we cannot tell the difference between:

A list of one element, one non listed element. A list with even number of elements, a dict or an array.


But these things don't come from a magical EIASness. These things come from our practical choosing of string representations.

Why is the string representation, albeit an intemediate one, of an array the same as one of a list with even number of elements? Because we chose so.

Is there a different way to do things... probably there are many although all seem to be bound to be more verbose than the current state of affairs.

Imagine something in the TOOT tradition but just for values (not necessarily objects, although I guess a correspondence with them could be established).

Tcl is a command language, a script is a succession of commands, a command is made of words, the first word being the command proper and the rest being arguments. This is all convention and we are fine with it. The first word (the command proper) is necessary in all cases and there is even a mechanism to do something about it when it is not recognized (the unknown command mechanism).

In the same vein we could say a Tcl value is a succession of words, being the first the "type" of the value and necessarily present. If it is not recognized, the most probable case with single word values, we could appeal to an unknown type mechanism or provide with a default "string" type there.

So we would have:

  • array 1 a 2 b 3 c
  • list 1 a 2 b 3 c
  • dict 1 a 2 b 3 c

And, possibly:

  • string 1
  • number 1
  • scalar 1
  • list 1
  • 1

The last one would need to be assigned a type somehow.

Would this allow to avoid or limit shimmering and clarify some cases?

Would this destroy all what is good about Tcl and make it a too rigid language to be used?

In fact, in a crazy spiral, a script could go the whole way to:

{script {cmdInvokation {properCmd puts} "string Hello world"}}

But this would be not really advisable.