begin
! i2c correctly requires the parameter of length() to be an lvalue. However we may at some point
! want to allow rvalues too - but only when length() is itself being used as an rvalue...
! To do:
! #define UNCONST(x) ((__typeof__(x))(x))
const string (255) const = "string"
ownstring (255) string = "string"
string(255) fn fn
result = const
end
string(255) map map
result == const
end
string(255) s
s = "string"
s = const
s = fn
s = map
printstring("Fail # map") and newline if s # map { <-- this one fails at the moment }
printstring("Fail # fn") and newline if s # fn
printstring("Fail # const") and newline if s # const
printstring("Fail # string") and newline if s # string
printstring("Fail # literal") and newline if s # "string"
printstring("Fail map") and newline if length(map) # 6
! printstring("Fail") %and newline %if length(fn) # 6
! printstring("Fail") %and newline %if length(const) # 6
printstring("Fail string") and newline if length(string) # 6
! printstring("Fail") %and newline %if length("string") # 6
length(string) = 5 ; printstring(string); newline
length(map) = 5 ; printstring(map); newline
! length(fn) = 5 ; printstring(fn); newline
! length(const) = 5 ; printstring(const); newline
! length("string") = 5 ; printstring("""string"""); newline
endofprogram