Opened 8 years ago

Last modified 2 years ago

#2698 assigned enhancement

Calculate allows default variables to be redefined

Reported by: greenfeld Owned by: garycmartin
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Calculate Version: 0.92.x
Severity: Minor Keywords: easy-hack, patch
Cc: manuq, humitos Distribution/OS: OLPC
Bug Status: Unconfirmed

Description

I may or may not have already filed this somewhere, but:

Calculate provides several default variables such as "e", "pi", etc.

These can all be overridden with new numbers by setting a label of the same name. And then Sugar, by defaulting to starting the last journal entry for an activity, can make it non-obvious how to get to a session where these have not been changed.

Should this be allowed?

Seen in Calculate-36/OLPC 11.2.0 os13.

Change History (11)

comment:1 Changed 7 years ago by godiard

  • Keywords easy-hack added

comment:2 Changed 7 years ago by humitos

  • Cc manuq added

I think this shouldn't be allowed. Calculate should check the name of the variable and don't allow to change "e", "pi", etc as you mentioned.

What should happen? Show an error message? How?

comment:3 Changed 7 years ago by walter

Not sure I agree, It would be interest to let the learner explore what happens if you, for example, redefine pi as 3 (As I recall, Alabama did this once [1] -- don't use bridges in Alabama). Seriously though. Why not see how it screws things up? That said, an alert warning that this is not a good idea would be appropriate. The alert mechanism is pretty straight-forward.

[1] http://www.scambusters.org/hoaxes.html

comment:4 Changed 7 years ago by humitos

  • Cc humitos added

comment:5 Changed 7 years ago by godiard

  • Owner changed from rwh to garycmartin
  • Status changed from new to assigned

comment:6 Changed 7 years ago by garycmartin

There is a small array of reserved words in create_var_textview that could be added to, however these words just silently fail to apply a value to, the UI provides no warning or error message, and acts like it happily set the value. This might cause even more confusion so I've not extended this reserved word variable filter just for now, until I have time for adding some better user feedback.

comment:7 Changed 4 years ago by godiard

Contrary to walter comment, I think the constants should not be redefined, because the possibilities to do a good use are dubious and can confuse to the users.

comment:9 Changed 4 years ago by godiard

  • Keywords patch added
Note: See TracTickets for help on using tickets.