-
-
Notifications
You must be signed in to change notification settings - Fork 679
Open
Description
Functions returning a value should not have side effects, var does. In #17447, comment 23 Nils Bruin proposed to separate both usages of var by introducing declare_var: this should behave exactly like var without return value, and var should not put the var handle in the globals list but should act like SR.var. If we want the following behaviour:
declare_var('x')==var('x')as before but returningNonevar('x')prints deprecation message, returns variable as before; error after deprecation periody = var('x')as before (but without globals), NO deprecation message
we certainly need the preparser to recognize 2/3, and to replace (2) withdeclare_var('x'); deprecation(...); xand (3) withy = SR.var('x'). Secondly, there is a different docstring needed withvarwhen compared withdeclare_var.
This and the same with functions is the most annoying problem for people doing calculus in Sage.
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/17958