On Tue, May 31, 2022 at 10:52:47PM +0200, Ralf Hemmecke wrote:
> >Well, we had
> >
> >       lazyEval x == (rst(x):(()-> %)) ()
> >
> >':' was doing what you apparently think that 'pretend' would do.
> >':' is gone, IIRC 'pretend' failed, so that is why we have SPADCALL...
> 
> Oh, we had this? But honestly, I am happy that ':' is gone. When I read the
> above line, I wouldn't understand it as I understand 'pretend'.
> 'pretend' for me is no operation, just telling the compiler that it show
> override the type with what 'pretend' says.
> Maybe internally it works differently, but the above is my layman's view.

There are small, subtle effects which may change generated code.
Did you ever think why 'delay' with pile works?  'delay' expects
function as an argument, pile as argument produces a value.
Why this works when produced value is _not_ a function?

> BTW, I would have no problem if a 'pretend' crashes the system. 'pretend' is
> claiming that the user knows enough about the compiler to make the claim of
> a potentially unsafe type cast.
> 
> Maybe like Lisp calls, 'pretend' should only appear in what you called
> "primitive domains'.

There are at least two cases where 'pretend' is safe without looking
at low level details:

 - we can use 'pretend' to store anything in variable of type None.
   We can retrive it later using 'pretend' to original type.

 - there are cases when compiler does not know that code is type
   correct.  'pretend' can be used to convince to accept the
   code.  This was use for implementation of some advanced
   concepts in Aldor.

Coming back to representation of Stream, arguably correct representation
is

   Rep := Record(firstElt : None, restOfStream : None)

Namely code stores various things in both fields, with None this
is OK.  Not so using current types.  OTOH that would require
bunch of 'pretends' in stream code (probably could be hidden
in a few macros).

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20220601190923.GA15652%40fricas.math.uni.wroc.pl.

Reply via email to