On Wed, Mar 20, 2024 at 07:41:11PM +0100, Grégory Vanuxem wrote:
> Hello,
>
> Do you happen to know why the declaration of string(Integer) is in
> StringCategory and its definition in the String domain?
> (STRINGIMAGE$Lisp)
'string' constructs a String and as all functions of similar sort
is defined in corresponding domain. As usual, 'string' is declared
in corresponding category, that is StringCategory
> That way if someone adds a domain, say, Foo, that has an Integer to
> Foo coercion and exports a 'string' operation the interpreter will
> choose the Foo one. It's a bit of a shame, isn't it?
Well, that is how Spad overloading works: if you have two ways
they should give the same result or you need to be more specific
(hide Foo, add explicit '$Integer' etc.). If Foo can be coerced
to Integer, then maybe 'string' in Foo is not needed at all.
Also, note that interpreter coercions are tuned to existing set
of domains. When you add new domains (or new operations to existing
domains) with current rules interpreter can make undesirable
choice. That is a shame, when adding exposed operations we need
to take into account what interpreter will do, or modify
interpreter to change its rules. Ideally there should be a
user level way to add or remove interpreter inference rules.
--
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/ZftU-WcPThCruCpy%40fricas.org.