Forum
Suggestion about the functions and the brackets - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Documentation (https://www.boriel.com/forum/forumdisplay.php?fid=17)
+---- Thread: Suggestion about the functions and the brackets (/showthread.php?tid=257)



Suggestion about the functions and the brackets - programandala.net - 06-18-2010

I suggest to always use brackets with functions, both in the Syntax and Examples sections, and everywhere in the docs.

I suggest to include a note in the language reference page in order to explain that brackets are optional in functions for the sake of compatibility with Sinclair BASIC (and maybe FreeBASIC in some cases). But that's all.

I think the code is much more clear with brackets; they help to avoid bugs too. And it's the standard beside a good practice, isn't it? On the other hand, it's good to have a clear convention to write the docs.


Re: Suggestion about the functions and the brackets - britlion - 06-18-2010

programandala.net Wrote:I suggest to always use brackets with functions, both in the Syntax and Examples sections, and everywhere in the docs.

I disagree. This would break compatibility with Sinclair Basic.

programandala.net Wrote:I suggest to include a note in the language reference page in order to explain that brackets are optional in functions for the sake of compatibility with Sinclair BASIC (and maybe FreeBASIC in some cases). But that's all.

I think the code is much more clear with brackets; they help to avoid bugs too. And it's the standard beside a good practice, isn't it? On the other hand, it's good to have a clear convention to write the docs.


Wait, now you're saying you don't want to require it at all? Perhaps I'm misreading it - you're saying to always allow brackets, for things like RND? I suppose there's no reason not to allow RND() - and I think Boriel has updated the function to allow that; but since it never takes any parameters I don't think it matters. It behaves just like PI in most respects - it replaces a number.


Re: Suggestion about the functions and the brackets - programandala.net - 06-18-2010

britlion Wrote:
programandala.net Wrote:I suggest to always use brackets with functions, both in the Syntax and Examples sections, and everywhere in the docs.

I disagree. This would break compatibility with Sinclair Basic.

I'm afraid you misinterpreted. I'm talking about the docs, not the compiler.


Re: Suggestion about the functions and the brackets - boriel - 06-18-2010

programandala.net Wrote:
britlion Wrote:
programandala.net Wrote:I suggest to always use brackets with functions, both in the Syntax and Examples sections, and everywhere in the docs.

I disagree. This would break compatibility with Sinclair Basic.
I'm afraid you misinterpreted. I'm talking about the docs, not the compiler.
It's okay with ZX BASIC. The compiler already allows both forms (with and without parenthesis). This week end I will upload a new version. But need to fix 2 important bugs with strings first. :wink: