vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.15k stars 136 forks source link

Maximal length of names of expressions? #334

Open vsht opened 4 years ago

vsht commented 4 years ago

In the manual it is written that

The length of names is not restricted in FORM. There is one exception to this rule: names of expressions cannot be longer than 16 characters. Of course in practise there are physical limits on the size of names, posed by the size of the memory of the computer being used.

However, one can obviously do something like

off statistics;
S s, x, y;
CF acc;
 Global thisexpressionis32characterslong = x^2+y^2;
.store

save thisexpressionis32characterslong.res thisexpressionis32characterslong;

.end

without triggering any warning or errors.

When trying to load the saved expression

load thisexpressionis32characterslong.res;
.sort
L exp = thisexpressionis32characterslong;
.sort
print exp;
.end

it seems that the expression was not saved properly. However, the truth is that FORM cuts the name after the 20th character, so

load thisexpressionis32characterslong.res;
.sort
L exp = thisexpressionis32ch;
.sort
print exp;
.end

works and recovers the correct expression.

Are things expected to work this way? Naively I would rather expect an error message once the name length exceeds 16 characters.

Cheers, Vladyslav

tueda commented 4 years ago

Please see #192. The problem is MAXENAME for .sav files. Maybe more information about it should be added in the manual.

vermaseren commented 4 years ago

Let us say that this is something that suffered from much tampering in the history of Form. But then tampering by more than one person. Clearly not in a completely coherent fashion. But if you hold to the 16 characters rule, you will always be safe.

The last tampering was years ago when the sav files were made systems independent. Probably that stretched things from 16 to effectively 20 although, it may well be that the excess 4 bytes are actually supposed to be used for something different if a certain flag is set, or maybe it is just padding for now.

Jos

On 15 Nov 2019, at 23:08, Vladyslav Shtabovenko notifications@github.com wrote:

In the manual it is written that

The length of names is not restricted in FORM. There is one exception to this rule: names of expressions cannot be longer than 16 characters. Of course in practise there are physical limits on the size of names, posed by the size of the memory of the computer being used.

However, one can obviously do something like

off statistics; S s, x, y; CF acc; Global thisexpressionis32characterslong = x^2+y^2; .store

save thisexpressionis32characterslong.res thisexpressionis32characterslong;

.end without triggering any warning or errors.

When trying to load the saved expression

load thisexpressionis32characterslong.res; .sort L exp = thisexpressionis32characterslong; .sort print exp; .end it seems that the expression was not saved properly. However, the truth is that FORM cuts the name after the 20th character, so

load thisexpressionis32characterslong.res; .sort L exp = thisexpressionis32ch; .sort print exp; .end works and recovers the correct expression.

Are things expected to work this way? Naively I would rather expect an error message once the name length exceeds 16 characters.

Cheers, Vladyslav

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/334?email_source=notifications&email_token=ABJPCEQI4QRUTIGZ3OA4RIDQT4MUNA5CNFSM4JOBIHWKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HZXHISQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEWSELZG4EOCZSX7PS3QT4MUNANCNFSM4JOBIHWA.

vsht commented 4 years ago

I see, thanks! Would it be perhaps possible to add a flag (or something on the form.set level) that strictly enforces the 16 chars rule, so that one can actively avoid such situations?

When using automated setups with lots of scripts to generate expression names on the fly, it is not always easy to ensure that nothing is longer than 16 chars.