I was looking at the timelimit command in Maple, and wonder about whether it might be improved .
The help-page ?timelimit says that it suspends its checks while within builtin functions. It says that, inside builtins, the time limit is "ignored".
But Maple has a lot of builtins. And significant portions of the work may go on within them. Does this make the timelimit() function not useful, from a practical point of view?
What if timelimit were to make checks whenever garbage collection (gc) ocurred? That's a safe point, no? And gc can happen within some builtins? Or what if time checks were made at the same frequency that interrupt requests were checked? Those can happen within some builtins, at safe points.
Those were my thoughts, until I tried it. The command anames(builtin) shows that rtable() is a builtin. But I have found that timelimit will function within at least some rtable() calls.
> A := RandomMatrix(1000,'density'=0.1,
Error, time expired
Does anyone have an idea what the complete and true story is, with respect to builtins? Also, I notice that it didn't say "Error, (in rtable).." like the help-page indicates. Is that an effect of it timing-out within a builtin?
What about the error message that timelimit returns? Could it not be better if it returned something like this?
Error, (in f) time limit expired, and exceeded by 2 sec