On 09/02/2025 20:03, Waldek Hebisch wrote:
>> Well I often get thrown by the differences between SPAD categories and
>> say Java interfaces so the code may well be sub optimal.
> I have no deep knowledge of Java, but I do not think there are big
> conceptual differences between Spad categories and Java interfaces.
> Spad category lists signatures (functions) that should be available
> in all domains declared to belong to given category.  Implementation
> part of category gives default implementation.  IIUC the same thing
> holds in Java: interface specifies functions and may give default
> implementation.

There was some difference that always used to cause me problems because
categories are more statically defined than interfaces but I have
forgotten the details now. That's the problem when concepts are so
similar but important details are different.

For example, in Java you might have an interface called 'shape' and this
interface has functions such as 'draw' so classes that implement shape
such as 'square' and 'circle' all have there own implementations of 'draw'.
Some other part of the code may have a List of 'shape' and if you call
'draw' on each of the elements it would call the appropriate version of
draw depending on whether it is a 'square' or a 'circle'.

I don't think you can do that with categories because they are more
statically defined so you cant have 'List shape' and this makes a big
difference to how you would go about constructing such a programming task.

I mention this just as a reminder of the sort of problems new users may
have when coming to SPAD from other languages. I think it would be good
if there was something on fricas.github.io listing potential issues like
this for new users (and me).

Martin

--
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/4405940b-077a-4fd6-82d5-0cde52680454%40martinb.com.

Reply via email to