InstructionLimit < 49

Not high priority but If you ever set instruction limit to less than 49 it breaks codea and no projects run anymore until you close and restart codea.

Maybe it takes 49 instructions to set the instruction limit?

I suspect (correct me if I’m wrong TLL) that some chunks of Codea are actually written in Lua - it’d be silly not to take advantage of that IMHO. So yeah - there’s going to be Lua overhead just setting up and calling the setup() and draw() functions…

What’s interesting about this is that no projects run until Codea is closed and restarted. That suggests that this setting is persisting across projects, which it presumably shouldn’t.

So the “Setting the instruction limit to less than 49” might be a “When I hit my head against the wall then it hurts” kind of bug, but the fact that this kills all projects isn’t.

Interesting, from something like the code below it seems that the overhead and/on the call to setinstructionlimit itself only takes 5 instructions (and a=“” takes 2 instructions). So maybe the bug is due to something else

function setup()
    a = ""
    a = ""
    a = ""
    a = ""
    a = ""
    a = ""

The problem here is a concept that Projects are idempotent (used in this instance as “side-effect free”). They’re not. Should they be? it’d be nice, but it’s not mandatory, and in day to day use probably doesn’t make a difference.

Codea is an app that embeds Lua, and you are allowed to write chunks of Lua code that the embedded Lua app calls. It is possible to “pee in the pool”. Don’t. Or - do, if you want, but pay the consequences.

I have a feeling this is one of those “completeness theorm” things they talked about in GEB, where no matter how much time you spend, there’s always going to be something that can be done to break things - and to make it perfectly “safe”, you’d need to remove enough functionality to make is unusable in the end, or at least uninteresting.

I can’t think of a single programming language in existence that can’t hose itself if you try.

Point being - yes, you can screw Codea by setting the instruction limit to 49 or less. There are no doubt other ways to do it as well. Don’t. It is arguably no defect that they give you the flexibility (and rope) to hang yourself (and Codea) - it is a feature.

To put it another way: It’s not a bug if it breaks when you’re trying to break it. :slight_smile:

Yeah it’s not an important bug but illustrates complications coming from instructionlimit further. Every time i hit the instruction limit, i turn it off cause who knows what number i need to set it too. So it helps me avoid infinite loops at most once per project.

I would argue it’s not even a bug. It’s a safety net - they’re good, but they can get in the way. Modify them at your peril, and if you modify them to be ineffective, you have nobody to blame but yourself.

Try not turning it off. Try making it bigger.

Me, I don’t care. I can hang Codea (or anything else, really) by looking at it crosseyed. It’s a talent. I’m VERY used to “uh… hello? home-home, press and hold, kill app”, and was long before Codea hit the shelves.

Yeah there’s a state bug in setInstructionLimit, it’s is fixed now.

But as I mentioned in another thread, I’ve removed the instruction limit by default in the execution environment (not the script loading sequence, though). This will be after 1.2.7 is released.