slang-users mailing list

[2019 Date Index] [2019 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Stack underflow()


slsh> define f() {}
slsh> () = f();
Stack Underflow Error

I wonder why this is considered an error. If "()=" means "pop anything left on the stack", isn't "nothing" (in a mathematical sense) also "anything"? This could be a problem IMHO if a function may or may not leave data on the stack, e.g. depending on parameter values. To prevent an error, one would have to wrap the call in a test of the stack width.

Or must the information about how many values a function leaves on the stack be understood as part of the contract with the user?

-Bernd

--
http://www.sudrala.de
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2019 date index] [2019 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]