vermaseren / form

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

Print statements do nothing when there are no active expressions #239

Closed jodavies closed 6 years ago

jodavies commented 6 years ago

The following program prints nothing:

#-
*Local test = 1;
Print "hello";
.end

If one uncomments the expression, FORM prints hello as I would expect.

Similarly, this also prints nothing:

#-
Local test = 1;
.sort
Hide test;
Print "hello";
.end

Thanks, Josh

benruijl commented 6 years ago

The print statement is executed for every term, so if there are none, nothing happens.

You could use #write instead.

tueda commented 6 years ago

It is a bit tricky point that Print has two meanings: (1) print for every terms as an executable statement and (2) print expressions at the end of the module as a kind of module control statement/declaration. So the manual says the type of the Print statement is "Print statement". In your case Print has a "..." string and acts as an executable statement.

jodavies commented 6 years ago

Ah, yes, of course. Usually I use #message for such things, but for some reason I was using a print like this somewhere, and it took me a while to track down why nothing was happening... Thanks!