Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread James Richters
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.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Mattias Gaertner
On Tue, 22 Nov 2016 13:32:03 +
Graeme Geldenhuys  wrote:

> On 2016-11-22 13:26, Sven Barth wrote:
> > I think the difference a tab versus a couple of spaces makes (even if
> > across a whole file or a whole project) will be insignificant  
> 
> Well, for every byte in the file, the parser needs to figure out what to
> do with it. Less bytes, means less processing cycles - no matter how
> small. They do add up in the end when you have to parse some 1 million
> lines of code.
> 
> But there was also a reason I put a smiley face at the end of my post.
> [technically what I said is sound and true, but I have no metrics to
> prove it]

You forgot to consider how scanners work, i.e. how they check and
skip spaces.

Here are some numbers:

Compiling Lazarus sources 'make clean all' 1249309 lines 3 times
0m51.682s
0m51.415s
0m51.698s

Lazarus uses indentation of 2, so replacing each double space with one
tab saves 3.7mb. Compiling 3 times:
0m52.003s
0m51.294s
0m51.452s

This is a desktop system, so there is always a bit of noise. As you can
see, the time difference is not measurable.

To estimate the potential speed up:
Replacing all multi spaces with one space saves 6.1mb. Compiling 3
times:
0m51.064s
0m50.733s
0m51.120s

It seems scanning the spaces costs about 1%.

My conclusion: That tabs costs less cpu time in Pascal code is a myth.


Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Reimar Grabowski
On Tue, 22 Nov 2016 12:41:37 +
Graeme Geldenhuys  wrote:

> hahaha... I love how a con is “fundamentally different concept”. How is
> that a con?
Fundamentally different to the way current IDEs/editors process their text -> 
too much work for a feature no one gives a flying f**k about.
Got it?

R.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Vojtěch Čihák

To the topic:
 
Currently when I write the line (in Laz. editor):
 
const Num = 123456789;   
 
I can hover the identifier "Num" and I see tooltip:
 
const Num = 123456789
/file/name.pas(x,y)
 
And there is no tooltip when I hover the "123456789".
 
Maybe this is place for improvement.
 
Hovering the "Num" could show
 
const Num = 123 456 789
/file/name.pas(x,y)
 
while hovering the "123456789" could show just
 
123 456 789
 
V.
__

Od: Graeme Geldenhuys 
Komu: FPC-Pascal users discussions 
Datum: 21.11.2016 15:46
Předmět: [fpc-pascal] Underscores in numerical literals - grouping


I don't know about you, but I like this idea implemented in Java 7 and
later.

http://jasdhir.blogspot.co.uk/2016/11/using-underscores-in-literals.html 



I always find it hard to read long numeric literals.

Regards,
 Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Jonas Maebe

Hi,

Now that the discussion moved from a potential compiler feature to  
coding style preferences, can we please move it to the fpc-other list?


Thanks,


Jonas
FPC mailing lists admin

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 13:12, Martin Schreiber wrote:
> I think you are wrong.

And you have all the right in the world to say that. Just like I would
say I can't read your code at all - because everything is lowercase and
with only 1-space indentation. Your coding style - your preference.

Each developer has their own preferences - I never argued that. I prefer
to read code with 3-4 space indentation, and when debugging heavily
nested code, I would even prefer 6-8 space indentation to help see
blocks of text more clearly. If you don't like ET, simply don't use it.
In every editor I've seen that supports ET, in was optional and disabled
by default.

ps:
  Take a look at this linked PDF and look at the second image. That was
  purposely done to mimic your coding style - 1 space indentation. All
  done by tweaking the ET preferences, and not actually changing the
  underlying file at all. :)

  http://geldenhuys.co.uk/~graemeg/temp/elastic_tabstops_demo_landscape.pdf

  ET allows each developer to apply their own preferences without
  the underlying files being modified. Perfect in an environment where
  many developers work on the same source code units.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 13:26, Lars wrote:
> As for underscores in numbers, it is an interesting idea but I see delphi
> compatibility issues coming up any code you want to port has to be
> converted to non underscores

Who in there right mind would ever want to move from Free Pascal to
Delphi!  The reverse is frequently done though. ;-)

Regards,
  Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 13:26, Sven Barth wrote:
> I think the difference a tab versus a couple of spaces makes (even if
> across a whole file or a whole project) will be insignificant

Well, for every byte in the file, the parser needs to figure out what to
do with it. Less bytes, means less processing cycles - no matter how
small. They do add up in the end when you have to parse some 1 million
lines of code.

But there was also a reason I put a smiley face at the end of my post.
[technically what I said is sound and true, but I have no metrics to
prove it]

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Lars
On Tue, November 22, 2016 6:12 am, Martin Schreiber wrote:
> On 11/21/2016 03:46 PM, Graeme Geldenhuys wrote:
>
>> The age old rule
>> of programmer source code always being in a mono-spaced font is
>> ridiculous for this day and age.
>>
...
> A programmer scans code most the time vertically
> or block by block and not horizontally and word by word as normal text. And
> for that a monospace font is much better suited because of the straight
> vertical character columns.

Agree. The idea that reading code is like reading a novel, was put forth
by IMO a somewhat idiot, Rob Pike in this particular case, as far as I
remember. His argument was that C code was easier to
read_with_lots_of_underscores.

My counter argument was that underscores jump out like a symbol, like a
minus sign, so you pollute the code with symbols, and there is enough
space and symbols already littered throughout the code.

As for underscores in numbers, it is an interesting idea but I see delphi
compatibility issues coming up any code you want to port has to be
converted to non underscores, or delphi would have to implement the
feature at some point. Another mode switch if check in the compiler, in
possibly more than one place.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Sven Barth
Am 22.11.2016 12:14 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
> 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). :)

I think the difference a tab versus a couple of spaces makes (even if
across a whole file or a whole project) will be insignificant and maybe
even get lost in the noise that stems from disk caches and the multi
tasking nature of today's operating systems.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 12:59, Stephen Chrzanowski wrote:
> tables/divs/CSS that change those sites around so I can view the way I want
> to, not the way they THINK is best for me.

And there is no difference to that and an editor that supports ET. If
you don't want to use ET, simply disable it, and go about your job as
normal. In all cases where I've seen editors that support ET, they have
chosen to disable ET by default - so as not to upset the apple cart.

I never suggested all editors use ET or nothing. I simply stated that if
a editor is smart enough to support ET, it could go one step further and
[optionally] support grouped numerical literals too. Obviously for text
editors (or IDE's) that only support monospaced fonts and force all text
into grid-like character cells, they will not be able to support the
rendering of grouped numerical literals either.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Martin Schreiber
On 11/21/2016 03:46 PM, Graeme Geldenhuys wrote:
>The age old rule
> of programmer source code always being in a mono-spaced font is
> ridiculous for this day and age.
>
I think you are wrong. A programmer scans code most the time vertically
or block by block and not horizontally and word by word as normal text.
And for that a monospace font is much better suited because of the
straight vertical character columns.
I know that this theme is off topic here but I thought somebody should
express a different meaning.
I also don't like elastic tabstops much BTW...

Martin
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Stephen Chrzanowski
Now we're getting into the field of personal preferences, and EVERYONE and
their neighbor on the internet is going to defend their personal
preferences like a rabid dog over a piece of meat.

Looking at a screen all day long, comfortably, is ultimately up to the
person sitting in the chair at that computer.  For email, variable width
fonts are alright (Although I've now changed that in gmail so I read email
in a fixed-font family).  For code, fixed font, terminal/consolas/system
fonts for me, end of story, and if the IDE doesn't support it, I remove the
IDE and look at something else.  Taking another font that is variable
width, and pretends to be monospace still irritates me, and is a
distraction.

The goal of the developer is to setup the IDE so that they are comfortable
using it for long periods of time, and use the system effectively.  All
these 'toys' that people write are fine, but, claiming that fixed font is
of ancient ways, although true, has exactly zero bearing on the
effectiveness of the development process.  You're not going to write a
better function because you're not using Arial.

This whole discussion is going towards discussing the "standards" of some
web forum software forcing their tables to be a max of 1024 pixels wide,
leaving a whack of white space, for the purpose of "readability".  I'm a
very strong opponent to it.  I hate it.  On my 2560x1440 screen, no text
scaling, those sites look absolutely ridiculous when my browser is full
screen.  I have browser plugins that change the formatting on the
tables/divs/CSS that change those sites around so I can view the way I want
to, not the way they THINK is best for me.

On Tue, Nov 22, 2016 at 5:05 AM, Graeme Geldenhuys <
mailingli...@geldenhuys.co.uk> wrote:

> I'm fully aware than the idea of using proportional fonts for coding or
> most text editor work sounds alien - simply because that is how it was
> done for decades. But times have changed, some editors have advanced,
> some editors have implemented more intelligent ways of working with text
> and fonts - opening up more possibilities to use better looking fonts.
> Eclipse and IntelliJ IDEA (surprisingly both implemented in Java -
> coincidence or not) has raised the bar considerably when it comes to
> intelligent text (source code) management. Both Eclipse and MS Visual
> Studio support Elastic Tabstop plugins too.
>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 11:15, Jürgen Hestermann wrote:
> I am still not sure how exactly elastic tab stops work.

Think how a word processor (MS Word, LibreOffice Writer) interprets
tabstops. Word Processors don't define a TAB as x width of Spaces or
Pixels. But for some strange reason IDE's and Text Editors do!

In word processors a single TAB character can jump the cursor all the
way to the right side of a page. Also you can have multiple tabstops on
a single line, but each tabstop has a different width.

That is kind-of how Elastic Tabstops work, but in the case of ET, it
decides the width of a tabstop based on a block of text and your
Indentation and Padding preferences.

> What if an empty line is between such lines?

ET works with text blocks, so an empty line would introduce the start of
a new text block. The new text block might still fall under a previous
indentation level though. I guess the best way to understand this is to
try out the small Java application downloadable from the author's homepage.


> In this example (where 'Param1' should align with 'Param2')

If you want something aligned or at the same indentation level, you
simply need to insert a TAB character. ET will keep blocks of text
indentation and aligned even if any text inside that block grows or shrinks.

I wrote your sample code in two ways. The first sample doesn't really
take much advantage of ET, as all tab widths are the same (indentation).
I enabled showing TAB characters so you can better see what I mean.

In the second layout example (lines 13-21) you will note that on line 15
the second tab is considerably larger than all other tabs. ET did that
because the two parameters of FunctionA() fall into the same text block,
so they get aligned equally.

Then for good measure, I loaded that same sample text into my
experimental ET enabled editor and switched to a proportional font
(Input Sans). Magically all indention and alignments are still correct.
:-) That will still be true even for other wacky proportional fonts like
cursive ones or MS Comic Sans etc.


> I found an interesting discussion discussion about elastic tabstops with some 
> cons here:
> http://softwareengineering.stackexchange.com/questions/137290/what-are-the-drawbacks-of-elastic-tabstops

hahaha... I love how a con is “fundamentally different concept”. How is
that a con? Just because ET's implementation is different to how TABs
were handled in text editors for the last couple of decades, doesn’t
constitute it as a con - it’s an improvement to how TABs are interpreted
and rendered on screen.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 11:27, Yann Mérignac wrote:
> In Ada at least since 1983.
> http://archive.adaic.com/standards/83lrm/html/lrm-02-04.html


:-D

Thanks for that Yann.


Regards,
  Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-21 23:59, Dmitry Boyarintsev wrote:
> I find it a made up problem, inspired by sales department.

Not at all. I do agree that using constants is a very good idea, instead
of hard-coded "magic numbers", but sometimes you use a value only once
in your code, and a constant is simply overkill.

Here is an example of actual code I have:


  checksum := $B1B0AFBA - (checksum and $);


Quickly look at that and tell me how many "f" are in the last hex value.
Did I make a typo by adding to many or to few f's? Can't tell
(monospaced font or not), so you have to carefully count that to be
sure. Making small typos in such values could take hours to debug and find.


Now, lets look at the same code again, but formatted as mentioned in the
Java blog. Quickly, how many f's did I type now in either hex value?
Instantly you can see I made no typos.

  checksum := $B1B0_AFBA - (checksum and $_);

Group formatting of numerals - via a underscore or more intelligent text
rendering by the text editor - would be very very useful to eliminate
those subtle bugs. It's exactly the same as what syntax highlighting
does - making reading and writing source code easier, and with less
mistakes.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Yann Mérignac
> Is there any other place in any language (programming or natural) where
underscored are used in this way?

In Ada at least since 1983.
http://archive.adaic.com/standards/83lrm/html/lrm-02-04.html

2016-11-22 1:26 GMT+01:00 Gordon Findlay :

> Yet another daft idea from java.  Is there any other place in any language
> (programming or natural) where underscored are used in this way? Any long
> list of digits will represent a string anyway. My library card had a field
> with 9 digits, but that sure ain't a number.
>
> On 22/11/2016 3:46 am, "Graeme Geldenhuys" 
> wrote:
>
>> I don't know about you, but I like this idea implemented in Java 7 and
>> later.
>>
>> http://jasdhir.blogspot.co.uk/2016/11/using-underscores-in-literals.html
>>
>>
>> I always find it hard to read long numeric literals.
>>
>>
>> Alternatively, without needing compiler changes, the IDE's and
>> programmer editors should become more clever in how they display source
>> code (think Elastic Tabstops), and automatically display numeric
>> literals with slight increase in [render] spacing between certain number
>> groups. Binary literals could be grouped every eight digits, whereas Hex
>> could be grouped every 4 and Decimals every 3 digits. The age old rule
>> of programmer source code always being in a mono-spaced font is
>> ridiculous for this day and age.
>>
>> Regards,
>>   Graeme
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Jürgen Hestermann

I am still not sure how exactly elastic tab stops work.
I put standard tabs (#9) in each line and the editor
aligns these tabs for adjacent lines?
What if an empty line is between such lines?
What if I want to start a new 'table' which is not
related to preceeding or following lines?

In this example (where 'Param1' should align with 'Param2')
-
if ProcedureA(FunctionA(Param1,
Param2),
  true,
  false,
  false,
  Shift=[ssAlt],
  ErrorCode) then
   ShowMessage('ERROR')
-
I would put tabs before 'ProcedureA', 'FunctionA', 'Param1', 'Param2', 'true', 
'false', etc. and 'ShowMessage'
and 2 extra tabs on the start of the second line (with 'Param2'), 1 extra tab 
for the following lines?

I found an interesting discussion discussion about elastic tabstops with some 
cons here:
http://softwareengineering.stackexchange.com/questions/137290/what-are-the-drawbacks-of-elastic-tabstops

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-21 23:59, James Richters wrote:
>  I, l, 1, AND | are all distinctly
> different with it as well as 0 and O.I have a REAL pet peeve about
> font's that these characters look identical,

You do realise that not all monospaced fonts are equals. Some monospaced
fonts are terrible for programming source code too. Some monospaced
fonts don't make much [if any] distinction between those tricky
characters either.

Then you get fonts like "Input", which actually allows you to configure
the fonts before you download them. You can choose how you want the 0
(zero), a, l, i etc rendering style to look like.

Go to the following URL and click "Customize your download". You can
then configure various character styles (and even line spacing) before
you download a customised font just for you. The choice is available for
both monospaced and proportional versions of the Input font.

  http://input.fontbureau.com/download/

So your "pet peeve" (which I also have) holds no merit in this discussion.

PS:
  As for your comment about your son's homework. I've had the exact same
  issue at my son's school! I can't believe they (the teachers) can be
  so stupid.


> 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.



Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 08:31, Marco van de Voort wrote:
> If you can do it in IDE, do it in IDE, indeed.

Indeed. This discussion clearly revealed that having a smarter IDE or
text editor is the preferred way to go, compared to implementing a
compiler change that supports underscores (like the original article I
referenced).

Thanks to all that contributed to this discussion.

Regards,
  Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Graeme Geldenhuys
On 2016-11-22 04:41, Flávio Etrusco wrote:
> The editor can just switch to a monospaced font when the
> vertical/column selecion-mode is toggled, this is what Eclipse does.

Exactly, and if you are prefixing something or inserting something in
multiple lines that all have the same text, even in proportional fonts
(and the way ET aligns them), it will work just fine.

I'm fully aware than the idea of using proportional fonts for coding or
most text editor work sounds alien - simply because that is how it was
done for decades. But times have changed, some editors have advanced,
some editors have implemented more intelligent ways of working with text
and fonts - opening up more possibilities to use better looking fonts.
Eclipse and IntelliJ IDEA (surprisingly both implemented in Java -
coincidence or not) has raised the bar considerably when it comes to
intelligent text (source code) management. Both Eclipse and MS Visual
Studio support Elastic Tabstop plugins too.

Anyway, time permitting, I'll play with my experimental text editor and
see if I can implement a more intelligent way of displaying long
numerical literals with group spacing (visual rendering only - no
changes to the underlying file).

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > other editors.
> 
> Elastic Tabstops (ET) only does rendering of the text - based on two
> user defined preferences. The underling file doesn't change because of
> user preference changes. The underlying file is just a TAB(U+0009)
> indented file - like most programming language style defaults (Object
> Pascal for some reason being the exception - but it doesn't need to be).

Yeah, that's what I mean. One of the reasons why hardtabs are such pain is
because you need settings to view a file properly.

I've worked with quite some C/C++ and Java IDEs, but can't really remember
any defaulting to hardtabs (some did default to LF-only files though,
another PITA)

> Anyway, again, my discussion wasn't meant to be about ET specifically,
> but simply that text editors could become more intelligent by
> automatically adjusting the spacing of long numerical literals (without
> affecting the underlying file - like ET capable editors achieve).

If you can do it in IDE, do it in IDE, indeed. A popup with some separators
inserted and/or multiple number systems would be the way to go in this case
I guess.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal