1. crash_message()

Rob,

A small addition to the ever growing wish list: can we have a
routine that would return the current position of the interpreter
within the source. Just the file name and the line number.

Alternatively, would it be possible to extend the crash_message()
routine to include this sort of information. As it is now, I have to
combine the crash_message() with something silly like ? 1/0 to induce
a traceable error. Otherwise it is quite painful, especially with
multiple includes and thousands of lines in each, to locate offending
sections of the code.

Or am I missing something, is there a better way of doing the same?

jiri

new topic     » topic index » view message » categorize

2. Re: crash_message()

Sorry, guys, this is one of those days, I should not be allowed anywhere
near a terminal...

What I really meant in my previous message was, that I would prefer to
use the interpreter location routine with a simple abort(), instead of
artificially inducing silly errors to get the location through the
standard error mechanism.

jiri

new topic     » goto parent     » topic index » view message » categorize

3. Re: crash_message()

Jiri Babor writes:

> What I really meant in my previous message was, that I
> would prefer to use the interpreter location routine with a
> simple abort(), instead of artificially inducing silly errors
> to get the location through the standard error mechanism.

I'll consider it.
I guess it would let you implement a kind of C assert() statement.
e.g.
          assert(x < 100)
where you print a message with the offending file and line number
when the assert fails. Of course,

procedure assert(integer x)
    if not x then
        ? 1/0
    end if
end procedure

would be almost as good.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: crash_message()

> Jiri Babor writes:
>
> > What I really meant in my previous message was, that I
> > would prefer to use the interpreter location routine with a
> > simple abort(), instead of artificially inducing silly errors
> > to get the location through the standard error mechanism.
>
> I'll consider it.
> I guess it would let you implement a kind of C assert() statement.
> e.g.
>           assert(x < 100)
> where you print a message with the offending file and line number
> when the assert fails. Of course,
>
> procedure assert(integer x)
>     if not x then
>         ? 1/0
>     end if
> end procedure
>
> would be almost as good.

I never consider a hack as almost as good.

I think assert is a wonderful construct as it assists in the development of an
application.
Also there is a logical way to deactivate them
        without assert
and reactivate them
        with assert
These would increase the ability for library developers to create good error
checking, the
current method of returning an error indicator often doesn't work. Which is why
C++ requires
new to throw an exception.

I doubt it would be hard to implement and it would give so much to the
programmer. Pretty,
Pretty, Please RDS.
-------------------------
Sincerely,
Mathew Hounsell

mat.hounsell at excite.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu