View Single Post
Old 10-08-2022, 10:22 AM   #14
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by un_pogaz View Post
But I'm really curious to understand why it should be avoided to create a 0 arg function by default, what would be the risks and problems?
It seems to me absurdly arbitrary , hence my theory 0 'Stored template' / +1 'function', I'm trying to find a way to make sense of it.
First, remember that template functions have been around for some 10 years. They were 'invented' when Single Function Mode was the normal way to write a template. When an SFM template calls a template function it *always* passes at least one argument, the value of the cell. The restriction was put in to give a big hint to the function developer that usage in SFM must be considered.

Skip forward some 5 years when General Program Mode has been enhanced enough where it was much more widely used. At this point zero-argument functions were quite acceptable. I never got around to removing the restriction because all the developer had to do was set arg_count to -1.

I haven't decided whether to remove it or make it a warning. I am leaning toward a warning with a "Don't show again" checkbox. Assuming I get around to doing it.
chaley is offline   Reply With Quote