On 1/30/19 2:36 AM, oldk1331 wrote:
> Yes, this is a bug introduced during my cleanup of Factored domain.
Thanks for fixing it so quickly.
> Now to think about it, if we really want to avoid extra allocation,
> a better approach is to use local variable:
>
> __one := [1, empty()]
> 1 == __one
Honestly, it would surprise me if that works. In fact, I believe in
Aldor that would even lead to a subtle bug. The Aldor compiler reorders
== and := assignments. == assignments always come first. Maybe Peter
Broadbery can say more about it.
Have you checked whether in FriCAS
1 == [1, empty()]
i.e., the current situation, really leads to allocation of a new record
each time 1 is used?
In fact, it keeps confusing me.
In Aldor, if write something like
foo: % == [1, empty()]
bar(): % == [1, empty()]
then in the use of bar() I would expect a new allocation every time
bar() is used. But not so for foo. In Aldor bar is a function but foo is
a constant (no function call).
I were happy it that would be the same in FriCAS, but 1 in FriCAS is
ONE() and not really a constant. :-(
Ralf