On Mon, May 13, 2024 at 05:58:01PM +0200, Ralf Hemmecke wrote:
> On 5/12/24 16:01, Waldek Hebisch wrote:
> > OutputForm was designed so that operators are Symbol-s and
> > dealing with operators should use opearations from Symbol.
> > fmt.spad essentially treated operators as strings (they were
> > immediately converted to strings and resto of code used
> > string operations).  The attached patch replaces strings
> > by symbols, alt least in places that I found.
> 
> I do not see any bug/problem in my formatting framework.
> 
> The only thing that is needed from OutputForm is the string representation
> of the operator (and its semantics). It's just a matter of taste whether the
> interface uses String or Symbol. I have chosen String.

It is not only matter of taste.  Symbol is preferable for control
functions, String for pure data.  Operators in OutputForm are
part of control, that is why they are Symbol.  The patch is not
changes places where String-s are just data, those places are
fine and using Symbol there would be wrong.

I am not aware of bugs in formatting framework.  However, using
String in places where Symbol is more appriopriate is a problem.
In particular using String instead of Symbol led to bugs or
inefficiences in other parts of FriCAS.

> I do not like the usage of ' in a .spad file.
> The patch introduces the need for ::Symbol for the third parameter in
> setOperatorHandler!, i.e. makes it less user friendly.

Well, ' works.  And only operators defined in OutputForm make sense
for third parameter to 'setOperatorHandler!', so not being able
to pass a String will help in getting working code.

> I see no benefit of that patch and thus I am strongly against it.

Benefit is mainly to have formatting framework as an example of
good programming style.  As I wrote, confusion between Symbol
and String led to real troubles in the past, so IMO good example
should be careful there.

-- 
                              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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZkJLGmMGOBm-jxne%40fricas.org.

Reply via email to