Convert versus coerce

5 views
Skip to first unread message

Waldek Hebisch

unread,
May 13, 2023, 4:59:26 PM5/13/23
to fricas...@googlegroups.com
I have looked at old problem reported many years ago by Franz Lehner:

A:Matrix IntegerMod 5 := [[2,3],[3,2]]
inverse A

gives inverse over rational numbers, due to automatic convertion
by interpreter.

I looked what happen when we disable using 'convert' for
interpreter coercions. There are many regressions. In some
cases we could request users to be more explicit. For
example after

i := 10

instead of

i::String

users could write

convert(i)@String

But there are more troubling cases. Currently

[1..3,10,20..23]

works and gives list of segments, but disablig authomatic use of
'convert' we get error message instead:

Cannot convert an element of the construct to type Segment(
PositiveInteger) .

For added confusion we can 'convert'...

Similarly,

m := matrix([[11, 12, 13, 14], [21, 22,23, 24], [31, 32, 33, 34]])
m(1, 2..2)

which works now, after change produces error message.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages