Bill Allombert on Wed, 07 Jan 2026 13:01:08 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: brteak


On Wed, Jan 07, 2026 at 11:10:16AM +0100, Ruud H.G. van Tol wrote:
> 
> I typed a little sloppy:
> 
> ? my(s=0); for(i=1,1000, s++; if(i>10, brteak)); s
> cpu time = 1 ms, real time = 1 ms.
> %1 = 1000
> 
> So brteak was not seen as a keyword, etc.
> 
> I could develop a habit to always add the () for bare breaks, nexts, prints;
> etc.

Yes, please. The confusion between foo and foo() is annoying.
For example 
apply(Set,[3,4])
does not work.

> But I'd rather get a (single) runtime warning about the suspicious undefined
> used in void context, or such.
> What are ways to deal with this?

You can do

? setdebug("compiler",1)
?  my(s=0); for(i=1,1000, s++; if(i>10, brteak)); s
  ***   Warning: statement with no effect: `brteak'.
%2 = 1000

Cheers,
Bill