slang-users mailing list

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

[slang-users] Strange error messages when started interactively


The following test program t.sl runs fine when started from the shell prompt, but emits a bunch of error messages when called from an interactive slsh session:

%-------------------------------
_traceback = 1;

ifnot (is_defined("F_Type"))
    typedef struct {
        foo,
        new
    } F_Type;

private define newF() {
    variable f = @F_Type;

    f.foo = "bar";
    return f;
}

variable F = @F_Type;       % The class object

F.new = &newF;

private define f_tostring(f) {
    return f.foo;
}

__add_string(F_Type, &f_tostring);

% --- main ---

variable x = F.new();

print(string(x));
%-------------------------------

$ ./t.sl
"bar"

----------

slsh> evalfile("./t.sl");
"bar"
Unable to typecast Null_Type to String_Type
Unable to typecast File_Type to String_Type
Traceback: fprintf
/usr/share/slsh/slshrl.sl:444:slsh_interactive_before_hook:Type Mismatch
  Local variables for slsh_interactive_before_hook:
	Integer_Type n = 2
	F_Type v = ??
Error encountered while executing slsh_interactive_before_hook
<stdin>:3:<top-level>:Type Mismatch
-1
Struct_Type with 2 fields

----------

Is there anything wrong with this construct? Or a glitch in slshrl.sl?

- 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]