- Subject: Re: [slang-users] debug: points where left on the stack
- From: Joerg Sommer <joerg@xxxxxxxxxxxx>
- Date: Tue, 23 Aug 2005 10:12:14 +0000 (UTC)
Marko Mahnic <marko.mahnic@xxxxxxxx> wrote:
> Joerg Sommer wrote:
>> "John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
>>
>>>Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:
>>>
>>>>do_check();
>>>>do_something();
>>>>if ( () )
>>>
>>>You should try to minimize the use of such constructs.
>>
>> Why? Is a cool feature of slang.
>>
> It is a cool feature but it makes the code harder to read,
> understand
ACK
> and mantain.
You need more documentation and it is not readable for a non-slang
programmer. But something like this, too:
define vinsert ()
{
_NARGS-1; Sprintf; insert;
}
I don't think this is problem, because every programming language has its
peculiarities and you can't read it if you don't know the language.
> One way to control the stack would be to use sth similar
> to _auto_declare (or _boseos_info).
> If the compilation unit would for example declare
> _strict_return = 1
slsh> message(_slang_version_string);
2.0.4
slsh> message(_strict_return);
_strict_return is undefined
<stdin>:2:<top-level>:Undefined Name
> then all functions that leave sth on the stack would have
> to push the result on the stack with return.
Yes. This is exactly what I am searching for.
> Such byte-compiled functions would look like this
> A = stack_pointer
> .... compiled body ....
> if (stack_pointer - A != _NRESULTS) do_error(...)
This can be done with slang? Is it possible for an eos handler to get
the number of arguments of return?
> In some cases one would need to return a different number of
> values even when _strict_return = 1. This could be done by
> setting _NRESULTS inside the function:
>
> define foo()
> {
> _NRESULTS = 2;
> push("abcde");
> ....
> return 5;
Why not use return("abcde", 5)?
Bye, Jörg.
--
Professor: "Gott", unverständliches und mythisches Wesen, das sich einmal
pro Woche im Kreis der Sterblichen manifestiert um Weisheit auf Folien
unter das Volk zu bringen. (Dschungelbuch 11, FSU Jena)
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2005 date index]
[2005 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]