Forum > Documentation (Maintaining -)
Fpc documentation completely ignores commonly used "{%H-}"
dseligo:
--- Quote from: Martin_fr on April 28, 2023, 12:09:15 pm ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{%H-}
Is documented in the FPC docs https://www.freepascal.org/docs-html/ref/refse2.html#x10-90001.2
"{" begins a comment.
The above code is a comment, indeed. Well, at least as far as fpc is concerned.
--- End quote ---
With this logic, {$R} is also a comment, but FPC fails to compile this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program test; {$R} begin end.
Is documentation wrong?
Martin_fr:
--- Quote from: dseligo on April 28, 2023, 12:58:04 pm ---
--- Quote from: Martin_fr on April 28, 2023, 12:09:15 pm ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{%H-}Is documented in the FPC docs https://www.freepascal.org/docs-html/ref/refse2.html#x10-90001.2
"{" begins a comment.
--- End quote ---
With this logic, {$R} is also a comment, but FPC fails to compile this:
--- End quote ---
Well, but "{$" is documented. (I am not searching the link now, but I do recall having seen it, even studied some of that part of the docs)
Albeit, not in the language ref itself, since it is not part of the Pascal language. Not even (as far as I understand) part of the particular dialect. Rather it is a compiler feature.
"{%" has no documentation, that gives it any additional meaning ("docs" and "meaning" within the scope concerning the language/compiler). Therefore it is a comment.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type x = class// About fooprocedure foo;
"//" is a comment. Yet Lazarus uses it as hint, like documentation.
{%
only has meaning in the Lazarus IDE
dseligo:
--- Quote from: Martin_fr on April 28, 2023, 01:08:51 pm ---
--- Quote from: dseligo on April 28, 2023, 12:58:04 pm ---
--- Quote from: Martin_fr on April 28, 2023, 12:09:15 pm ---
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{%H-}Is documented in the FPC docs https://www.freepascal.org/docs-html/ref/refse2.html#x10-90001.2
"{" begins a comment.
--- End quote ---
With this logic, {$R} is also a comment, but FPC fails to compile this:
--- End quote ---
Well, but "{$" is documented.
--- End quote ---
My point was: there is no mention of that in link you provided neither for '{%H' nor for '{$R'.
dseligo:
--- Quote from: lagprogramming on April 28, 2023, 10:49:20 am ---Searching in the Fpc, MseIde/MseGui and Lazarus directories for "{%H-}" shows many occurrences. When I searched in the documentation of the latest stable FPC for "{%" I couldn't find anything. Might be a good idea to update the documentation so that the next stable release would also cover this subject.
--- End quote ---
https://wiki.freepascal.org/IDE_directives
Martin_fr:
--- Quote from: dseligo on April 28, 2023, 01:21:12 pm ---My point was: there is no mention of that in link you provided neither for '{%H' nor for '{$R'.
--- End quote ---
Well, there cannot be a mention of "{%". It does neither exist from the language side, nor from the compiler.
From the language point of view, both "{$" and "{%" are comments.
From the compiler view"{$" has a meaning and is documented.
It may be debatable if the language doc, should refer to special constructs that are a compiler feature. After all, while it may not be seen as part of the language (not sure if it is, or is not), the particular language ref/doc is specially for the implementation by this compiler.
As for the "{%" it is neither documented in the compiler, nor in the language. In the same way "{foobar}" is also not documented, other than by the documentation for comments.
A % in a comment is no different than a foobar. So why would there be any other documentation for this, than the one about comments?
And how does that relate to the question if "{$" should be somehow mentioned as special in the doc of comments?
- If yes "{$" should be mention => then "{%" would still be the same as {foobar}
- If no "{$" need no mention, as it can be found in compiler docs, then by conclusion if "{%" cannot be found in compiler docs, it is the same as {foobar}.
Any mention of "{%" in either compiler or language docs, would only be expectable, if features of the Lazarus IDE were to be documented in the FPC docs. But then it wouldn't be FPC docs?
What if, some other IDE starts using "(*--HideHint: 1234*)" should that then be in the FPC docs?
Navigation
[0] Message Index
[#] Next page
[*] Previous page