[fpc-pascal] Underscores in numerical literals - grouping
James Richters
james at productionautomation.net
Tue Nov 22 14:53:30 CET 2016
The problem with your example "text_with_tabs_Input-Sans_proportional_font_and_ET.png" is that the underscores and the word Range and the brackets are all out of alignment, even though everything is re-aligned again with the := I prefer the array elements to also be aligned as well. In my opinion this misalignment caused by the proportional font is more annoying than the monospaced font.
> P_Range[1,0]:=0;
> I_Range[1,1]:=0;
> W_Range[2,0]:=0;
> R_Range[2,1]:=1;
>I prefer spacing between programming language symbols, even though I have syntax highlighting enabled too. So I would write the above as:
>
>P_Range[1,0] := 0;
>I_Range[1,1] := 0;
>W_Range[2,0] := 0;
>R_Range[2,1] := 1;
>
>I normally use a monospaced font - Raize font to be exact - which is a bitmap based font.
>
>But to give you an idea of what the above source code will look like in other editors. Take my code sample above, replace the spaces with single TAB (U+0009) characters. This not only
>reduces the file size, it also reduces the number of characters any parser needs to process (thus faster parsing and compiling). :)
>
>See attached screenshots.
>
> text_with_tabs_monospaced_font.png
> This is viewed with EditPad Pro, using a monospaced font and the
> TAB size was set to be equal to 2 spaces in width. Other editors
> text to default TAB width to equals 4 or 8 spaces. Point is, the
> text will always align. EditPad Pro doesn't support ET.
> text_with_tabs_Input-Sans_proportional_font_and_ET.png
> Here I used my experimental Elastic Tabstops enable text editor
> with a proportional font (Input Sans). Note that the text is still
> perfectly aligned. Also note that even though I use a proportional
> font, the 1 (one) and 0 (zero) characters are easily
> distinguishable from l, I, L, o and O letters. The 3rd note is
> that with ET, the minimum width and padding are defined in pixels,
> not [Space] character widths (like most editors do with TAB
> widths).
>So this just shows that alignment can be achieved with or without monospaced fonts. Also that not all fonts are created equal. Just like not all monospaced fonts are appropriate for >programming (tricky letters and numbers). Also not all proportional fonts are created equal - some are better suited to programming code than others. The "Input Sans" font is actually very >nice for source code.
More information about the fpc-pascal
mailing list