problem with function requirement in domain argument

7 views
Skip to first unread message

Ralf Hemmecke

unread,
Jun 24, 2026, 3:25:45 AM (2 days ago) Jun 24
to fricas-devel
In version 1.3.13 (6cafaeb7603e379c55244e3d9292ecff5058dd63)

The following code worked and could be used.

--- foo.spad ---
Foo(S: with One: () -> %): with
--Foo(S: with 1: constant -> %): with
foo: () -> S
== add
foo(): S == 1 $ S
---------------

=========================================================
Now I am in at FriCAS 03de7446cf2aa4f03e63f8d1c2d8a61147f31983
and get

$ echo ')co foo.spad'|fricas -nosman

Checking for foreign routines
.....

(1) -> Compiling FriCAS source code from file
/home/hemmecke/backup/git/qeta/foo.spad using system compiler.
FOO abbreviates package Foo
------------------------------------------------------------------------
initializing NRLIB FOO for Foo
compiling into NRLIB FOO
compiling exported foo : () -> S
****** comp fails at level 1 with expression: ******
error in function foo

((|Sel| S 1))
****** level 1 ******
x:= (Sel S (1))
m:= S
f:=
((((|One| #) (|foo| #) (|$DomainsInScope| # # #) (% # #) ...)))

>> Apparent user error:
unspecified error

=========================================================

OK, that is most probable a problem with removing "One" from FriCAS.
So I used

Foo(S: with 1: constant -> %)

instead. That compiles fine.
But then typing

%%% (2) -> Foo Integer
Internal Error
Unexpected error or improper call to system function hasAttSig :
unexpected form of unnamed category

How can this be cured? Or is it a bug?

Ralf

Waldek Hebisch

unread,
Jun 24, 2026, 9:08:44 AM (2 days ago) Jun 24
to 'Ralf Hemmecke' via FriCAS - computer algebra system
Yes. Arguably the original code should not compile.

> So I used
>
> Foo(S: with 1: constant -> %)
>
> instead. That compiles fine.
> But then typing
>
> %%% (2) -> Foo Integer
> Internal Error
> Unexpected error or improper call to system function hasAttSig :
> unexpected form of unnamed category
>
> How can this be cured? Or is it a bug?

There are 2 related, but different problems. First, code handling
this did not allow 'constant' (that is an old problem). Writing

)abbrev package FOO Foo
Foo(S : with 1 : () -> %) : with
foo: () -> S
== add
foo(): S == 1 $ S

the package compiles and does not cause internal error. Instead
it says that Foo(Integer) is not a valide type. This is the
second problem: signature in the anonymous category contains
1 as integer, while search for signatures expects symbol.

The attached patch should fix both problems.

--
Waldek Hebisch
sum6a.diff

Ralf Hemmecke

unread,
Jun 24, 2026, 12:39:48 PM (2 days ago) Jun 24
to fricas...@googlegroups.com, Waldek Hebisch
Thank you, Waldek. That works fine for me. Can you commit it.

The bad thing is now tha my former

Foo(S: with One: () -> %): with

works for 1.3.13, but not with current 'master' and

Foo(S: with 1: () -> %): with

works with current master, but not with 1.3.13. That is somehow a bad
situation for my QEta package, since I would have to release different
code for different FriCAS versions.

My using 'One: () -> %' came from the fact that 1:()->% did not work at
that time. In fact I would have liked that '1: %' should work (which is
a kind of shorter form of '1:constant->%'.

Any suggestion how to solve my problem?

Can I add some

)if version<=1.3.13
Foo(S: with One: () -> %): with
)else
Foo(S: with 1: () -> %): with
)endif

or must I patch my source code by a script, before I can compile the
package?

Ralf

Waldek Hebisch

unread,
Jun 24, 2026, 2:19:28 PM (2 days ago) Jun 24
to 'Ralf Hemmecke' via FriCAS - computer algebra system
On Wed, Jun 24, 2026 at 06:39:44PM +0200, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote:
> Thank you, Waldek. That works fine for me. Can you commit it.
>
> The bad thing is now tha my former
>
> Foo(S: with One: () -> %): with
>
> works for 1.3.13, but not with current 'master' and
>
> Foo(S: with 1: () -> %): with
>
> works with current master, but not with 1.3.13. That is somehow a bad
> situation for my QEta package, since I would have to release different code
> for different FriCAS versions.
>
> My using 'One: () -> %' came from the fact that 1:()->% did not work at that
> time. In fact I would have liked that '1: %' should work (which is a kind of
> shorter form of '1:constant->%'.
>
> Any suggestion how to solve my problem?
>
> Can I add some
>
> )if version<=1.3.13
> Foo(S: with One: () -> %): with
> )else
> Foo(S: with 1: () -> %): with
> )endif
>
> or must I patch my source code by a script, before I can compile the
> package?

I think that rather ugly hack will work. Namely, AFAIK all version
of FriCAS, up to 1.3.13 assert AIX. That changed recently.
So

)if AIX
Foo(S: with One: () -> %): with
)else
Foo(S: with 1: () -> %): with
)endif

should with version that can work. There is a gap between removal
of One and fixing 1, QEta will not work with corresponding git
snapshots.

Concerning more general question of conditions, currently condition
is just an identifier which is considered true or false. That
is rather inflexible, so I would like to allow more general
condition. Long ago Spad compiler allowed arbitrary Boot
expressions os conditions, that is reasonably general. But
I prefer to avoid exposing Boot via conditions, so want
something different.

Before we have better handling I prefer to limit use of conditions,
to limit problems with transion. The ')if false' form that
I used should be compatible with any possible replacement,
other probably not.

--
Waldek Hebisch

Ralf Hemmecke

unread,
Jun 24, 2026, 2:26:34 PM (2 days ago) Jun 24
to fricas...@googlegroups.com
On 6/24/26 20:19, Waldek Hebisch wrote:
> I think that rather ugly hack will work. Namely, AFAIK all version
> of FriCAS, up to 1.3.13 assert AIX.

OK, then I probably go for patching my sources.

Thank you
Ralf
Reply all
Reply to author
Forward
0 new messages