You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some unexpected errors when manipulating frozen variables in the shell. I suspect the shell or write aren't expecting unbound/int/list items in frozen goals.
Don’t have a full pix yet, but freeze(Y, 1) is a bug in the machinery for display of delay vars.
The machinery is in blt_frez.pro, a combo of show_delay_binding/4 and w_d_t/4, the bug occurring in the latter. (I’ve also turned up a bug in put_number/3 too; see at end)
w_d_t (for write_delay_term), is called from show_delay_binding/4:
w_d_t(VarDelayTerm, Stream, XVPairs, Subsids)
It is just a big branch on the type of Term. It has an incorrect clause:
w_d_t(Term, Stream, _, [])
:-
atomic(Term),
!,
put_atom(Stream, Term).
The error
?- freeze(Y, 1).
Error: Argument of type integer expected instead of 1.
- Error Attribute: [sio:
put_atom(
stream_descriptor('\003',open,console,
'standard output',[noinput|output],false,-2,0,0,
0,0,true,0,wt_opts(78,400,flat),[],wait,text,
eof_code,true,0),
1)]
- Throw pattern: error(type_error(integer,1),[[sio: *]])
Y->
is being thrown from the call to put_atom/2 above.
Add this clause before the “atomic” clause above:
w_d_t(Term, Stream, _, [])
:-
pbi_write(top_w_d_t_5(Term)),pbi_nl,pbi_ttyflush,
integer(Term),
!,
put_number(Stream, long, Term).
This produces:
?- freeze(Y, 1).
Y->
It should yield:
?- freeze(Y, 1).
Y->1
There’s a reasonable chance that the three other problems you got are similar issues in w_d_t & friends.
----------
The behavior showing Y-> instead of Y->1 is due to bugs in put_number/3. In sio.pro, just before the defn of put_number/3, the comment says:
* OutputType may take on the following values:
* byte
* short
* long
* float
* double
But:
?- put_number(user,short,2).
yes.
?- put_number(user,long,2).
yes.
?- put_number(user,float,2.0).
yes.
?- put_number(user,double,2.0).
yes.
So there’s a bug in put_number/3, which is essentially sio_put_number(Stream,OutputType,Number).
However, I also think there’s a short-coming, in that there should be a builtin put_number/2, like this:
put_number(Stream,Number)
:-
get_number_type(Number, OutputType),
put_number(Stream,OutputType,Number).
We shouldn’t have to add separate cases (integer,float,….) for simply outputting different types of numbers.
Cheers,
——Ken
On Oct 12, 2019, at 6:37 PM, Chuck Houpt ***@***.***> wrote:
freeze(Y, 1).
Some unexpected errors when manipulating frozen variables in the shell. I suspect the shell or write aren't expecting unbound/int/list items in frozen goals.
The text was updated successfully, but these errors were encountered: