Project

General

Profile

Design #1689

Automatic mapping of RHS in += etc

Added by John Abbott almost 2 years ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tidying
Target version:
Start date:
15 Jun 2022
Due date:
% Done:

100%

Estimated time:
0.88 h
Spent time:

Description

Currently CoCoALib does not permit automatic promotion with operators like +=.

This means that one cannot do, for instance, f /= content(f);
even though f = f/content(f); works just fine. This feel inconsistent!

There is the question about whether to permit the LHS to be promoted automatically.
At the moment I cannot think of a situation where this would be convenient/useful
[but that alone is not sufficient to exclude the possibility]. If we do forbid it,
then again we have a situation where a = a+b; has (slightly) different behaviour
from a +=b;


Related issues

Related to CoCoALib - Feature #645: Automatic mapping of RingElem: user selectable at run-time (GlobalManager?)Rejected2014-11-04

History

#1 Updated by John Abbott almost 2 years ago

I have made a first update (not checked in) which allows the RHS to be promoted, but not the LHS.
Somehow it "feels funny" to allow the LHS to be promoted automatically... but that is not really
a good reason to forbid it.

What do you think?

#2 Updated by John Abbott about 1 year ago

  • Status changed from New to In Progress
  • Assignee set to John Abbott
  • % Done changed from 0 to 80

The current impl gives an error if the LHS would be promoted.
I am inclined to accept this impl, and close this issue.
If people object, it should be easy to change the code to allow the LHS to be promoted too.

What do you think?

#3 Updated by John Abbott about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100
  • Estimated time set to 0.88 h

#4 Updated by Anna Maria Bigatti 2 months ago

  • Related to Feature #645: Automatic mapping of RingElem: user selectable at run-time (GlobalManager?) added

#5 Updated by Anna Maria Bigatti 2 months ago

  • Subject changed from Automatic promotion of RHS in += etc to Automatic mapping of RHS in += etc

Also available in: Atom PDF