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

2016-11-21 Thread 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

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

2016-11-21 Thread Flávio Etrusco
On Mon, Nov 21, 2016 at 10:09 PM, James Richters
 wrote:
> I use notepad++ Vertical editing ALL THE TIME, you cannot do vertical editing 
> effectively with a proportional font.   For those who aren't familiar with 
> it, you can hold down ALT and highlight many lines vertically making a very 
> tall cursor, you can then start typing and what you type will be on all lines 
> with the tall cursor.. thus you can very quickly and easily shift entire 
> blocks over, or even fix something on many lines at once.  This is very 
> helpful when you have something that used to be inline and now you want to 
> make a procedure out of it for example.
>

The editor can just switch to a monospaced font when the
vertical/column selecion-mode is toggled, this is what Eclipse does.
BTW SynEdit also supports column selection, it's just not available in
the menu. In the Options Dialog you can assign key mappings to Column
and Normal Selection Mode.

-Flávio
___
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-21 Thread James Richters
I use notepad++ Vertical editing ALL THE TIME, you cannot do vertical editing 
effectively with a proportional font.   For those who aren't familiar with it, 
you can hold down ALT and highlight many lines vertically making a very tall 
cursor, you can then start typing and what you type will be on all lines with 
the tall cursor.. thus you can very quickly and easily shift entire blocks 
over, or even fix something on many lines at once.  This is very helpful when 
you have something that used to be inline and now you want to make a procedure 
out of it for example.

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org 
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Graeme Geldenhuys
Sent: Monday, November 21, 2016 6:42 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Underscores in numerical literals - grouping

On 2016-11-21 19:06, Sven Barth wrote:
> but also due to the ability to easily compare different names simply 
> based on their visual length without having to decide whether the 
> difference is due to the name or the different sized characters.


And here is an example of the exact problem, but when using a monospaced font. 
The spelling error is spotted much easier when using a proportional font.

View the following URL and search for “Proportional fonts can make it easier to 
spot typos.” - it’s about 3/4 down the page.

  http://input.fontbureau.com/info/

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

___
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-21 Thread Dmitry Boyarintsev
On Mon, Nov 21, 2016 at 9:46 AM, Graeme Geldenhuys <
mailingli...@geldenhuys.co.uk> 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.
>

I find it a made up problem, inspired by sales department.

The site shows CC-card and SSN number stored as numerics. I doubt there's
ever a task that actually needs such storage (since both numbers should be
considered as a set of characters ie strings).

Maybe its a new feature that will inspire people to use more anonymous
constants.
They looked ugly before, but look how cute they look now if underscores.

Having pure-functions available for pascal constant expressions is far more
preferred than underscores.
And it will also might make them even more readable and flexible.

thanks,
Dmitry
___
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-21 Thread James Richters
>IOW I don't like editors that store in formats that are nearly useless in
other editors.

I total agree with this statement,  proportional editors are only good if
you are the only one who will ever look at the code, if anyone else EVER
looks at it, it's just a giant mess, you can't put snippets of it in
pastebin for ask for help, or really collaborate in anyway with anyone else
without manually re-formatting it for a monospaced font, and there is really
no point in even bothering.  I find Consolas VERY easy on the eyes and have
no problems organizing my code with it.   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, unfortunately Arial is one of
them, and guess what font stock installations of windows use..  and the VAST
majority of windows users have no idea it can be changed, never mind how to
change it..   My son's teacher sent home spelling words typed in Arial and
my son was spelling Illusion - i i i u s i o n because it was just not clear
what the characters were.  When writing code we have a LOT of variables and
such that are not normal readable words so it's a really bad idea to have a
font with any questionability in what the characters are at all.  Also a lot
of proportional font indent corrections only work if your font is a
particular size,  if you change your mind and decide you are getting older
and now need a larger font than you did 10 years ago,  now all your code
that used to look good, is all misaligned.  The only way code will be
properly aligned all the time, in any editor, at any size is to use a
monospaced font, and do not use tabs at all, set your editor to insert
spaces for tabs.   The only thing that ever looks good all the time to
everyone is a nice grid of character cells.   Even if an editor COULD make
it come out right with a proportional font, you are back to now having code
that only one person can ever read, making it useless,  so why bother with
the effort at all... it's also impossible to autocorrect every situation
with a proportional font.. for example:

P_Range[1,0]:=0;
I_Range[1,1]:=0;
W_Range[2,0]:=0;
R_Range[2,1]:=1;

With a monospaced font, they are all perfectly aligned, but with a
proportional font, there is nothing the editor could do automatically to fix
this.  Sure you could put some space between the variable and the [ and try
to adjust that space in a reverse proportional method, but that doesn't make
it look right, and you CAN'T stick any space in the actual variable name to
make all the _Range align again once the initial proportional letter has
fouled everything up.   I have been programming for a long time, (also
started with a VIC20) and I just don't see how structured programming can be
done effectively with a proportional font.. you will spend more time trying
to force the proportional font to look good than actual programming.  As it
mentions on the Freepascal wiki, pascal itself doesn't require any
formatting, you can put your whole program on one long line if you want, but
no one else will ever understand it.  The formatting is for our benefit, so
why would you use some kind of editor that now takes all your nice
formatting and saves it in a way that requires a specific editor to read.
The spacing and formatting is much more important that the actual reading of
individual 'words' in a program, you need to identify the variable you are
working on quickly and follow the structure accurately, thus monospaced
fonts are far and away the best choice for this. 

-Original Message-
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Marco van de
Voort
Sent: Monday, November 21, 2016 2:26 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Underscores in numerical literals - grouping

In our previous episode, Graeme Geldenhuys said:
[ Charset UTF-8 unsupported, converting... ]
> On 2016-11-21 16:05, J?rgen Hestermann wrote:
> > Why?
> > I like monospaced fonts for code very much.
> 
> See my reply to Stephen. More intelligent editors can let you use 
> monospaced and proportional fonts with ease - yet you don't loose code 
> alignment, indentation etc. Elastic Tabstops do just that. It's simply 
> about editors becoming more clever about there text rendering instead 
> of forcing everything into a grid of character cells.
> 
> Plus proportional fonts overall look much better than monospaced ones. 
> ;-)

IMHO editors should be like network protocols. Liberal in what you accept,
and conservative in what you write.

IOW I don't like editors that store in formats that are nearly useless in
other editors.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  

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

2016-11-21 Thread Graeme Geldenhuys
On 2016-11-21 19:06, Sven Barth wrote:
> but also due to the ability to easily compare
> different names simply based on their visual length without having to
> decide whether the difference is due to the name or the different sized
> characters.


And here is an example of the exact problem, but when using a monospaced
font. The spelling error is spotted much easier when using a
proportional font.

View the following URL and search for “Proportional fonts can make it
easier to spot typos.” - it’s about 3/4 down the page.

  http://input.fontbureau.com/info/

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-21 Thread Graeme Geldenhuys
On 2016-11-21 19:06, Sven Barth wrote:
> but also due to the ability to easily compare
> different names simply based on their visual length without having to
> decide whether the difference is due to the name or the different sized
> characters.

I don't think you fully understand what Elastic Tabstops (ET) does.
Indented and aligned text are possible with or without monospaced fonts.
That's the beauty of ET.

The following website gives very nice visuals and detailed overview of
what ET can and can't do.

  http://tibleiz.net/code-browser/elastic-tabstops.html


Based on your quoted message above, could you give an example of where
you think ET will fail with a proportional font?

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-21 Thread Graeme Geldenhuys
On 2016-11-21 19:25, Marco van de Voort wrote:
> IOW I don't like editors that store in formats that are nearly useless in
> 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).

Any text editor worth their salt can display a TAB indented text file.
An ET capable editor simply does a much better job and with more
flexibility.

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

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-21 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
[ Charset UTF-8 unsupported, converting... ]
> On 2016-11-21 16:05, J?rgen Hestermann wrote:
> > Why?
> > I like monospaced fonts for code very much.
> 
> See my reply to Stephen. More intelligent editors can let you use
> monospaced and proportional fonts with ease - yet you don't loose code
> alignment, indentation etc. Elastic Tabstops do just that. It's simply
> about editors becoming more clever about there text rendering instead of
> forcing everything into a grid of character cells.
> 
> Plus proportional fonts overall look much better than monospaced ones. ;-)

IMHO editors should be like network protocols. Liberal in what you accept,
and conservative in what you write.

IOW I don't like editors that store in formats that are nearly useless in
other editors.
___
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-21 Thread Sven Barth
Am 21.11.2016 18:27 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
>
> On 2016-11-21 15:52, Stephen Chrzanowski wrote:
> > but I've always preferred mono-spaced fonts in my IDE versus
> > variable width, JUST on the primary basis of legibility of the code
itself,
> > ignoring the 'gravy' of lining up text within the code.
>
> Hence I mentioned "think Elastic Tabstops" which solves that problem for
> proportional and monospace fonts. I've used Elastic Tabstop support in
> jEdit (java based editor) for the last 3 years, and it works brilliantly.

While elastic tabstops might be nice and good I personally definitely
wouldn't want anything but a monospaced font in my editors (one of the
first things I change in Notepad++ is the idiocy to use Comic Sans for
comments). That's not only due to code alignment (which would indeed be
solved by elastic tabstops), but also due to the ability to easily compare
different names simply based on their visual length without having to
decide whether the difference is due to the name or the different sized
characters.

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-21 Thread Graeme Geldenhuys
On 2016-11-21 16:31, Vojtěch Čihák wrote:
> I guess Graeme meant to make non-monospaced font look like monospaced
> in Lazarus editor

No I didn't mean that at all. That would be disastrous. Take a look at
my reply to Stephen, and follow the links mentioned there and see the
screenshots in the PDF linked.

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-21 Thread Graeme Geldenhuys
On 2016-11-21 16:05, Jürgen Hestermann wrote:
> Why?
> I like monospaced fonts for code very much.

See my reply to Stephen. More intelligent editors can let you use
monospaced and proportional fonts with ease - yet you don't loose code
alignment, indentation etc. Elastic Tabstops do just that. It's simply
about editors becoming more clever about there text rendering instead of
forcing everything into a grid of character cells.

Plus proportional fonts overall look much better than monospaced ones. ;-)

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-21 Thread Graeme Geldenhuys
On 2016-11-21 15:52, Stephen Chrzanowski wrote:
> but I've always preferred mono-spaced fonts in my IDE versus
> variable width, JUST on the primary basis of legibility of the code itself,
> ignoring the 'gravy' of lining up text within the code.

Hence I mentioned "think Elastic Tabstops" which solves that problem for
proportional and monospace fonts. I've used Elastic Tabstop support in
jEdit (java based editor) for the last 3 years, and it works brilliantly.

Here is a fpGUI newsgroup post (printed to PDF), where I implemented
basic Elastic Tabstops (ET) support in a homegrown text editor with the
ability to play around with ET user-defined parameters. Also see the
screenshots at the end where the last two uses proportional fonts.

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

Elastic Tabstops homepage:
   http://nickgravgaard.com/elastic-tabstops/

A nice overview of ET:
  http://tibleiz.net/code-browser/elastic-tabstops.html


Anyway, I didn't mean to make this message thread about ET, but I guess
using something like ET (more intelligent editors) could solve the
problem nicely without any compiler changes.

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] DOM and UTF-8 widestring conversion

2016-11-21 Thread Seth Grover
After playing around some more with my example, I was able to get it to
work in 2.6.4 (without using the cwstring unit) by using the lazutf8
unit's UTF8ToUTF16
routine on the SetAttribute and UTF16ToUTF8 on the GetAttribute:

TDOMElement(childNode).SetAttribute('value', UTF8ToUTF16(s));
s2 := UTF16ToUTF8(TDOMElement(childNode).GetAttribute('value'));

So for now I have a workaround until we're able to upgrade to the 3.0
compiler and use cwstring and the correct implicit conversions. I'd still
welcome any input to help me understand the difference between the two
versions though.

Thanks,

-SG

--
Seth Grover

Be kind to all of your neighbors
Because they're just like you.
And you're nothing special
Unless they are too.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] DOM and UTF-8 widestring conversion

2016-11-21 Thread Seth Grover
I'm hoping somebody could point me to the specific change (mantis bug #,
revision #, user changes wiki page link, whatever) between 2.6.4 and 3.0.0
that fixes this problem I was running into.

Given this sample program:

===
program Project1;

{$mode objfpc}{$H+}

uses
  cthreads,
  cwstring,
  Classes,
  SysUtils,
  XMLWrite,
  dom;

var
  s : ansistring;
  s2 : ansistring;
  dstDoc : TXMLDocument;
  rootNode : TDomNode;
  childNode : TDomNode;
begin
  s := #$E3#$82#$A6#$E3#$82#$A3#$E3#$83#$AB#$E3#$82#$B9;
  writeln('[', s, ']');
  dstDoc := TXMLDocument.Create;
  try
rootNode := dstDoc.CreateElement('root');
childNode := dstDoc.CreateElement('contents');
TDOMElement(childNode).SetAttribute('value', widestring(s));
s2 := ansistring(TDOMElement(childNode).GetAttribute('value'));
rootNode.AppendChild(childNode);
dstDoc.AppendChild(rootNode);
  finally
WriteXMLFile(dstDoc, 'export.xml');
FreeAndNil(dstDoc);
  end;
  writeln('[', s2, ']');
end.
===

With FPC 2.6.4 I end up with "" for the output (both to the
console and written to the xml file) as the output. With FPC 3.0 I get the
correct representation of the japanese characters.

So my question is:

1. What changed between FPC 2.6.4 and 3.0 to cause the change in behavior?

and

2. (apart from upgrading to FPC 3.0) Is there any workaround in 2.6.4 to
get the correct behavior?

I'd prefer just to be using 3.0 everywhere but on some legacy versions of
our product upgrading the build environment is not an option right now.

Thanks much,

-SG



--
Seth Grover

Be kind to all of your neighbors
Because they're just like you.
And you're nothing special
Unless they are 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-21 Thread Stephen Chrzanowski
heh.. Not really, as GMail uses variable width fonts by default. ;)  Imma
gunna feex dat.

On Mon, Nov 21, 2016 at 11:05 AM, Jürgen Hestermann <
juergen.hesterm...@gmx.de> wrote:

-
> function  FileCompareName (Datei1,Datei2 : PFileTyp) : SizeInt;
> function  FileCompareDate (Datei1,Datei2 : PFileTyp) : SizeInt;
> function  FileCompareSize (Datei1,Datei2 : PFileTyp) : SizeInt;
> -
>
> much more than a non-aligned:
>
> -
> function  FileCompareName (Datei1,Datei2 : PFileTyp) : SizeInt;
> function  FileCompareDate (Datei1,Datei2 : PFileTyp) : SizeInt;
> function  FileCompareSize (Datei1,Datei2 : PFileTyp) : SizeInt;
> -
>
___
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-21 Thread Ralf Quint

On 11/21/2016 8:05 AM, Jürgen Hestermann wrote:

Am 2016-11-21 um 15:46 schrieb Graeme Geldenhuys:

The age old rule
of programmer source code always being in a mono-spaced font is
ridiculous for this day and age.


Why?
I like monospaced fonts for code very much.

Code is not a novel or a newspaper where you read
a lot of text from top down to the end in a linear manner.
Instead, alignment is very important to make code more readable.
Monospaced fonts make it much easier to align code and
make a lot of things align 'automatically'.

I even align procedure headers like the following where all variables and
all types start at the same column
(which may not be visible in this email if you use proportional fonts 
;-).
Please copy it to notepad or into Lazarus Editor in this case): 

+1
Anything BUT a mono-spaced font for program code is ridiculous, even in 
this day and age...


We are programming in Pascal, which is neither case-sensitive (like for 
example C) nor does it make it whitespace significant (like Python), 
allowing for a much more readable code than most other languages out 
there, as you can easily format code in a way that is more human 
readable. The machine (compiler) doesn't care for that...


Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

___
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-21 Thread Vojtěch Čihák

I guess Graeme meant to make non-monospaced font look like monospaced in 
Lazarus editor which currently doesn't work (it looks very ugly).
 
V.
__

Od: Jürgen Hestermann 
Komu: FPC-Pascal users discussions 
Datum: 21.11.2016 17:05
Předmět: Re: [fpc-pascal] Underscores in numerical literals - grouping


Am 2016-11-21 um 15:46 schrieb Graeme Geldenhuys:
> The age old rule
> of programmer source code always being in a mono-spaced font is
> ridiculous for this day and age.
>
Why?
I like monospaced fonts for code very much.

Code is not a novel or a newspaper where you read
a lot of text from top down to the end in a linear manner.
Instead, alignment is very important to make code more readable.
Monospaced fonts make it much easier to align code and
make a lot of things align 'automatically'.

I even align procedure headers like the following where all variables and
all types start at the same column
(which may not be visible in this email if you use proportional fonts ;-).
Please copy it to notepad or into Lazarus Editor in this case):

-
procedure TForm1.FunctionListGetHintSize(Sender : TBaseVirtualTree;
                                         Node   : PVirtualNode;
                                         Column : TColumnIndex;
                                     var R      : TRect);
-

and I align the 'MaskFilter' variable in such a for loop:

-
for i := Low (MaskFilter) to
         High(MaskFilter) do
-

and I like such an aligned declaration

-
function  FileCompareName     (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareDate     (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareSize     (Datei1,Datei2 : PFileTyp) : SizeInt;
function  DirCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInDir     (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInBranch  (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirName       (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareFilesInBranch(Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareBytesInBranch(Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInDir    (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirName      (Dir1,Dir2 : PTreeTyp) : SizeInt;
-

much more than a non-aligned:

-
function  FileCompareName (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareDate (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareSize (Datei1,Datei2 : PFileTyp) : SizeInt;
function  DirCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInDir (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirName (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInDir (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirName (Dir1,Dir2 : PTreeTyp) : SizeInt;
-

You can see imeditately that many functions have the same parameters and all 
result in a SizeInt.
In the non-aligned version this is harder to spot.

___
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-21 Thread Jürgen Hestermann

Am 2016-11-21 um 15:46 schrieb Graeme Geldenhuys:

The age old rule
of programmer source code always being in a mono-spaced font is
ridiculous for this day and age.


Why?
I like monospaced fonts for code very much.

Code is not a novel or a newspaper where you read
a lot of text from top down to the end in a linear manner.
Instead, alignment is very important to make code more readable.
Monospaced fonts make it much easier to align code and
make a lot of things align 'automatically'.

I even align procedure headers like the following where all variables and
all types start at the same column
(which may not be visible in this email if you use proportional fonts ;-).
Please copy it to notepad or into Lazarus Editor in this case):

-
procedure TForm1.FunctionListGetHintSize(Sender : TBaseVirtualTree;
 Node   : PVirtualNode;
 Column : TColumnIndex;
 var R  : TRect);
-

and I align the 'MaskFilter' variable in such a for loop:

-
for i := Low (MaskFilter) to
 High(MaskFilter) do
-

and I like such an aligned declaration

-
function  FileCompareName (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareDate (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareSize (Datei1,Datei2 : PFileTyp) : SizeInt;
function  DirCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInDir (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInBranch  (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirName   (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareFilesInBranch(Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareBytesInBranch(Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInDir(Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirName  (Dir1,Dir2 : PTreeTyp) : SizeInt;
-

much more than a non-aligned:

-
function  FileCompareName (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareDate (Datei1,Datei2 : PFileTyp) : SizeInt;
function  FileCompareSize (Datei1,Datei2 : PFileTyp) : SizeInt;
function  DirCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInDir (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  DirCompareDirName (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareFilesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareBytesInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInDir (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirsInBranch (Dir1,Dir2 : PTreeTyp) : SizeInt;
function  TreeCompareDirName (Dir1,Dir2 : PTreeTyp) : SizeInt;
-

You can see imeditately that many functions have the same parameters and all 
result in a SizeInt.
In the non-aligned version this is harder to spot.

___
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-21 Thread Stephen Chrzanowski
I like the concept, but, if I'm using a constant that goes beyond the
millions, I'd add a comment to what the number is in US format, and tag on
what exactly it means, or make the variable name itself mean something.
Because reading

const maxLongint = $7fff;

or

const maxLongint = 2147483647;

is a bit of a pain, I agree.

That said, underscores aren't what I'd use.

I love the idea of the IDE (ANY IDE, not just Pascal based) doing some kind
of code highlight for large numbers.  Something simple, like underlining
every other group of 3 in large numbers, or every other hex pair, or every
8 binary set.

As for the mono-spaced, no, not ridiculous.   If memory serves me correct,
I believe you're as old-school as I am when it comes to code (My teeth cut
on Vic-20), but I've always preferred mono-spaced fonts in my IDE versus
variable width, JUST on the primary basis of legibility of the code itself,
ignoring the 'gravy' of lining up text within the code.  I always
terminal/system/consolas, even in Notepad/PSPad.  I barely tolerate
variable width font in GMail as I can't change the font easily (But you've
sparked an idea >:]  ).  Figuring out if I'm using a capital I versus a
lower l versus a | is quite annoying (Capital EYE versus lower ELL versus
pipe).  Most of the apps I write (for myself) are list based, or require
special formatting are typically fixed width as aligning text is much
easier, and I don't have to code special considerations for W and 1 width
differences.  Forget about the form UI, but even lining up variable
declarations and definitions, procedure, function declarations within
classes, much easier with fixed width.


On Mon, Nov 21, 2016 at 9:46 AM, Graeme Geldenhuys <
mailingli...@geldenhuys.co.uk> 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] Underscores in numerical literals - grouping

2016-11-21 Thread Graeme Geldenhuys
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


Re: [fpc-pascal] Is there a way to create a generic pointer to a generic record

2016-11-21 Thread Sven Barth
Am 21.11.2016 08:33 schrieb "Le Duc Hieu" :
>
> Is there any entry on Mantis for me to keep track of this bug status?

No, because I just noticed that there is one when testing for your question
;)

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