ID:1923561
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
I think the 'in' keyword should produce an error if the right-hand isn't a container of some kind. Sometimes I'll overlook a typo and create this scenario, and the system ends up not working and I have no runtimes to go on.
+1 Good idea.
This might break things involving the in operator, where you're using the to keyword.

such as:
if(x in 1 to 3) //would evaluate to true if x is between 1 and 3 inclusive

for(var/x in 1 to 10) //loop from x = 1 to 10

FKI mentioned ' a container of some kind '. I assumed he was including (number to number) under his definition of a container although you could argue that it's not.

Maybe the request could be simplified to "Providing run-time errors when right hand arguments to in are invalid."
for(thing in datum)


I was mainly talking about cases like the above and hadn't really considered numbers. In my experience, you can put anything where datum is, regardless of whether it's valid or not. I'd think there would be a way for Lummox JR to check when/where the keyword is being used though and the rules when necessary.

Maybe the request could be simplified to "Providing run-time errors when right hand arguments to in are invalid."

I would agree with this.
you see, the in keyword has multiple usages, and allows for more than a container on the right hand side. They aren't triggering runtimes because its valid syntax, just not what you wanted.
Null isn't a valid container, but the correct behavior in that situation is to fail silently, as if it was given a container with no contents.

In principle though, I think I agree that it'd be nice to have a runtime error if a completely incompatible argument was there.