When you evaluate an expression at the compile-time, all the operands have to 
be compile-time expressions (mostly literals, constants and expressions 
consisted of them) in that context.

When you write
    
    
    "123"
    
    
    Run

Then `"123"` can be used as a compile-time expression.

When you write
    
    
    const text = "123"
    
    
    Run

Then `text` can be used as a compile-time expression.

However, when you write
    
    
    var text = "123"
    
    
    Run

`text` cannot be used as a compile-time expression, because it is considered a 
runtime variable (`var`). The same applies to let-variables.

When you write
    
    
    static:
      var text = "123" & "4"
      text
    
    
    Run

This whole `static`-expression is a compile-time expression once resolved. But 
within the context of this inner block, `text` is still not considered static.

Complex. I know. Just think of it as stack-like.

Also it seems that the lengths of arrays are always considered static, while 
that of string/seq are not (and thus as static as the associated variable).

Reply via email to