Discuss changing the behaviour of append()

new topic     » topic index » view thread      » older message » newer message

Currently this is illegal ...

sequence x 
 
x = append(1,2) 

We get the error message ...

first argument of append must be a sequence 
Would it be a bad thing to remove this restriction such that when appending to an atom, Euphoria would automatically build a new sequence? This would be similar to how concatenation works.

sequence x 
 
x = 1 & 2 -- No error. Creates {1,2} 

In my current code, I ran across this case and had to code an explicit test to get around it. This is 'ugly' and makes the code a bit slower and larger.

function F(object A, object B) 
sequence x 
    if atom(A) then 
        x = append({A}, B) 
    else 
        x = append(A, B) 
    end if 
    return x 
end function 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu