Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Adding an integer to a string: when is it checked? #289

meijeru opened this Issue · 4 comments

2 participants


When provoking the previous issue, I noticed that 1 + "c" will compile without protest, but print 1 + "c" will give an math-code error, as will the assignment a: 1 + "c".

Moreover, "c" + 1 compiles happily, whereas print "c" + 1 will give:

*** Compiler Internal Error: Script Error : Invalid argument: none
*** Where: emit-integer-operation
*** Near:  [forall list [
expr: list/1
if block? unbox expr [comp-expression expr yes]
if object? expr [cast expr]
if type <> 'inline [
emitter/target/emit-argument expr functions/:name

It does not make a difference!


A few type checkings are obviously missing.


It is a side-effect of pointer arithmetics. No distinction is made between a literal string and non-literal one. I need to add some checking to raise a compilation error.


1 + "c" (or reversed expression) will compile silently because this expression will be caught by the dead code detection routine (added 2-3 months ago) and will not generate any native code. As the functions arguments type checking appends later in the compilation process, no error is raised.

@dockimbel dockimbel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.