ID:1923561
Aug 23 2015, 3:13 pm
|
|||||||
| |||||||
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.
|
Aug 23 2015, 6:25 pm
|
|
+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 |
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.
|