Re: [fpc-devel] Fix CamelCase in unit and method names
On Fri, 23 Mar 2018, Pierre Muller wrote: Le 23/03/2018 à 23:12, Michael Van Canneyt a écrit : On Fri, 23 Mar 2018, Sven Barth via fpc-devel wrote: R0b0t1schrieb am Fr., 23. März 2018, 16:07: IMHO preferably not the unit names (as in 'unit XxX') - with case sensitive file names on Unix, this change might increase time for searching the respective file (somewhat). Obviously, all further references of the unit (as in 'SysUtils.Execute') should be fine. I don't understand how it would increase the search time. I believe what happens is all names are converted to lowercase for the search, as in the strings taken from the user or their files and the names taken from the disk are both converted to lower case before comparisons are made. FPC first looks for the unit with the name as is, then lower case and finally upper case. Yes, but this is done in memory in the directory cache. But isn't the problem more that if you have a SysUtils.pp unit and a sysutils.pp both in your unit search path, on a case sensitive partition, it might now find SysUtils.pp before sysutils.pp and end up with some total different source? No, since the names of the files are not changed, and the names of the units in the uses clauses are not changed, and those are the ones that matter when searching, not the ones in the unit xyz; statement. And if you have this situation on your hard disk, you deserve to be publicly flogged, covered in tar and feathers, and banished from your village forever. Michael.___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
Le 23/03/2018 à 23:12, Michael Van Canneyt a écrit : > > > On Fri, 23 Mar 2018, Sven Barth via fpc-devel wrote: > >> R0b0t1schrieb am Fr., 23. März 2018, 16:07: >> IMHO preferably not the unit names (as in 'unit XxX') - with case sensitive file names on Unix, this change might increase time for searching the respective file (somewhat). Obviously, all further references of the unit (as in 'SysUtils.Execute') should be fine. >>> >>> I don't understand how it would increase the search time. I believe >>> what happens is all names are converted to lowercase for the search, >>> as in the strings taken from the user or their files and the names >>> taken from the disk are both converted to lower case before >>> comparisons are made. >>> >> >> FPC first looks for the unit with the name as is, then lower case and >> finally upper case. > > Yes, but this is done in memory in the directory cache. But isn't the problem more that if you have a SysUtils.pp unit and a sysutils.pp both in your unit search path, on a case sensitive partition, it might now find SysUtils.pp before sysutils.pp and end up with some total different source? Pierre Muller ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Fri, 23 Mar 2018, Sven Barth via fpc-devel wrote: R0b0t1schrieb am Fr., 23. März 2018, 16:07: IMHO preferably not the unit names (as in 'unit XxX') - with case sensitive file names on Unix, this change might increase time for searching the respective file (somewhat). Obviously, all further references of the unit (as in 'SysUtils.Execute') should be fine. I don't understand how it would increase the search time. I believe what happens is all names are converted to lowercase for the search, as in the strings taken from the user or their files and the names taken from the disk are both converted to lower case before comparisons are made. FPC first looks for the unit with the name as is, then lower case and finally upper case. Yes, but this is done in memory in the directory cache. I tested make all, there is no discernable difference in time, so I applied the patch from Ondrej. Michael.___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
R0b0t1schrieb am Fr., 23. März 2018, 16:07: > > > > IMHO preferably not the unit names (as in 'unit XxX') - with case > > sensitive file names on Unix, this change might increase time for > > searching the respective file (somewhat). Obviously, all further > > references of the unit (as in 'SysUtils.Execute') should be fine. > > > > I don't understand how it would increase the search time. I believe > what happens is all names are converted to lowercase for the search, > as in the strings taken from the user or their files and the names > taken from the disk are both converted to lower case before > comparisons are made. > FPC first looks for the unit with the name as is, then lower case and finally upper case. Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, 22 Mar 2018, R0b0t1 wrote: On Thu, Mar 22, 2018 at 10:18 AM, Juha Manninenwrote: On Thu, Mar 22, 2018 at 3:15 PM, Denis Kozlov wrote: Please do... It has caused enough eye (OCD) stress over the years ;) +1 Yes, it has bothered also me a lot. I use code completion to get the unit names correctly. Most of them are CamelCase but some are lowercase. The result looks sloppy. Maybe it is OCD, don't know. It bothers me anyway. I agree it looks sloppy. Something else that has bothered me, but a lot less, is the conflicting naming standards. E.g. Contnrs "should" really be Containers, more like Delphi; It's called contnrs in delphi as well. You're probably confusing the classes based one with the generic based one. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, Mar 22, 2018 at 10:18 AM, Juha Manninenwrote: > On Thu, Mar 22, 2018 at 3:15 PM, Denis Kozlov wrote: >> Please do... It has caused enough eye (OCD) stress over the years ;) > > +1 > Yes, it has bothered also me a lot. I use code completion to get the > unit names correctly. Most of them are CamelCase but some are > lowercase. The result looks sloppy. Maybe it is OCD, don't know. It > bothers me anyway. > I agree it looks sloppy. Something else that has bothered me, but a lot less, is the conflicting naming standards. E.g. Contnrs "should" really be Containers, more like Delphi; the former is more of a C style that you find when everything is lower case and abbreviated, which is not really the style I see most Object Pascal programmers adopt. I apologize for the unwarranted opinion, but it had been bothering me for a while. Cheers, R0b0t1 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, Mar 22, 2018 at 6:42 AM, Michael Van Canneytwrote: > > > On Thu, 22 Mar 2018, Ondrej Pokorny wrote: > >> Hello, >> >> will a patch be applied that fixes CamelCase in unit and method names and >> other identifiers? >> >> Example: >> >> dateutils -> DateUtils >> sysutils -> SysUtils >> typinfo -> TypInfo >> contnrs -> Contnrs >> strutils -> StrUtils >> EnterCriticalsection -> EnterCriticalSection >> DoneCriticalsection -> DoneCriticalSection >> LeaveCriticalsection -> LeaveCriticalSection >> TryEnterCriticalsection -> TryEnterCriticalSection >> (Funnily enough InitCriticalSection is correct.) >> >> TPoint.x -> TPoint.X >> TPoint.y -> TPoint.Y >> >> (For unit names: of course only the unit definition name will be changed, >> not the file name). > > > At first sight I don't see any disadvantages from this, so yes, I would > apply such a patch. > > Code completion will benefit from it, I suppose. > I asked about this a while ago; please apply the patches if any are made. On Thu, Mar 22, 2018 at 7:44 AM, Tomas Hajny wrote: > On Thu, March 22, 2018 12:42, Michael Van Canneyt wrote: >> On Thu, 22 Mar 2018, Ondrej Pokorny wrote: > > > Hi, > >>> will a patch be applied that fixes CamelCase in unit and method names >>> and other identifiers? >>> >>> Example: >>> >>> dateutils -> DateUtils >>> sysutils -> SysUtils >>> typinfo -> TypInfo >>> contnrs -> Contnrs >>> strutils -> StrUtils > . > . >>> (For unit names: of course only the unit definition name will be >>> changed, not the file name). >> >> At first sight I don't see any disadvantages from this, so yes, I would >> apply such a patch. > > IMHO preferably not the unit names (as in 'unit XxX') - with case > sensitive file names on Unix, this change might increase time for > searching the respective file (somewhat). Obviously, all further > references of the unit (as in 'SysUtils.Execute') should be fine. > I don't understand how it would increase the search time. I believe what happens is all names are converted to lowercase for the search, as in the strings taken from the user or their files and the names taken from the disk are both converted to lower case before comparisons are made. This is why some of the unit names are entirely lower case - they were at some point stored internally as entirely lower case, and no one fixed them (because you have to do it each time you interact with certain IDE GUIs). There may have been some versions of Lazarus that would not allow you to save mixed case file names, or at least made it very hard to do so. I suspect some of the mixed case file names that are not capitalized properly are due to the lack of case sensitivity and code completion. I found some Microsoft projects which misspelled something the same way in each of 4-5 places, probably because the name was typed once and then never fully typed again. Following from the above, very interesting patches would be ones that do not automatically lower case file names in Lazarus. Cheers, R0b0t1 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
Mark Morgan Lloydschrieb am Do., 22. März 2018, 17:57: > On 22/03/18 15:30, Juha Manninen wrote: > > On Thu, Mar 22, 2018 at 3:15 PM, Denis Kozlov > wrote:> Please do... It has caused enough eye (OCD) stress over the years ;) > > +1Yes, it has bothered also me a lot. I use code completion to get > theunit names correctly. Most of them are CamelCase but some arelowercase. > The result looks sloppy. Maybe it is OCD, don't know. Itbothers me anyway. > > Is my understanding correct that there's no compiler warning for this > sort of inconsistency? > Of course there isn't. After all Pascal is case insensitive, so everyone is free to case the identifiers as they want. Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On 22/03/18 15:53, Anthony Walter wrote: Yes, I agree, both for unit names, but also for methods and arguments. The exceptions should be for code related that are imports or extensions of existing APIs, for example: cairo_create should remain the same glGenBuffersshould remain the same gtk_window_newshould remain the same dlopenshould remain the same But in the RTL or LCL here are some of many pure pascal functions or procedures that could have their case changed: abs should be Abs arctanshould be ArcTan getdirshould be GetDir intpower should be IntPower hexstr should be HexStr strcan should be StrScan And with RTL or LCL unit names: keyboard should be Keyboard math should be Math strutils should be StrUtils cthreads should be CThreads Same applies to function/procedure/method arguments. If they're a pure pascal original, then arguments should be CamelCase. If they are part of an API imported, then they should remain the way the original API declares them. IMO I agree, pure Pascal should use CamelCase, otherwise we should follow the published API. In all cases usage should follow the declaration. I must have the same OCD variant too! ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On 22/03/18 15:30, Juha Manninen wrote: On Thu, Mar 22, 2018 at 3:15 PM, Denis Kozlovwrote:> Please do... It has caused enough eye (OCD) stress over the years ;) +1Yes, it has bothered also me a lot. I use code completion to get theunit names correctly. Most of them are CamelCase but some arelowercase. The result looks sloppy. Maybe it is OCD, don't know. Itbothers me anyway. Is my understanding correct that there's no compiler warning for this sort of inconsistency? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
Yes, I agree, both for unit names, but also for methods and arguments. The exceptions should be for code related that are imports or extensions of existing APIs, for example: cairo_create should remain the same glGenBuffers should remain the same gtk_window_new should remain the same dlopen should remain the same But in the RTL or LCL here are some of many pure pascal functions or procedures that could have their case changed: abs should be Abs arctan should be ArcTan getdir should be GetDir intpower should be IntPower hexstr should be HexStr strcan should be StrScan And with RTL or LCL unit names: keyboard should be Keyboard math should be Math strutils should be StrUtils cthreads should be CThreads Same applies to function/procedure/method arguments. If they're a pure pascal original, then arguments should be CamelCase. If they are part of an API imported, then they should remain the way the original API declares them. IMO ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, Mar 22, 2018 at 3:15 PM, Denis Kozlovwrote: > Please do... It has caused enough eye (OCD) stress over the years ;) +1 Yes, it has bothered also me a lot. I use code completion to get the unit names correctly. Most of them are CamelCase but some are lowercase. The result looks sloppy. Maybe it is OCD, don't know. It bothers me anyway. Juha ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On 22.03.2018 12:42, Michael Van Canneyt wrote: Code completion will benefit from it, I suppose. Yes, my only motivation is code completion. I uploaded the patch here: https://bugs.freepascal.org/view.php?id=33481 Thanks Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
Please do... It has caused enough eye (OCD) stress over the years ;) Denis On 22/03/2018 11:32, Ondrej Pokorny wrote: Hello, will a patch be applied that fixes CamelCase in unit and method names and other identifiers? Example: dateutils -> DateUtils sysutils -> SysUtils typinfo -> TypInfo contnrs -> Contnrs strutils -> StrUtils EnterCriticalsection -> EnterCriticalSection DoneCriticalsection -> DoneCriticalSection LeaveCriticalsection -> LeaveCriticalSection TryEnterCriticalsection -> TryEnterCriticalSection (Funnily enough InitCriticalSection is correct.) TPoint.x -> TPoint.X TPoint.y -> TPoint.Y (For unit names: of course only the unit definition name will be changed, not the file name). Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, 22 Mar 2018, Tomas Hajny wrote: On Thu, March 22, 2018 12:42, Michael Van Canneyt wrote: On Thu, 22 Mar 2018, Ondrej Pokorny wrote: Hi, will a patch be applied that fixes CamelCase in unit and method names and other identifiers? Example: dateutils -> DateUtils sysutils -> SysUtils typinfo -> TypInfo contnrs -> Contnrs strutils -> StrUtils . . (For unit names: of course only the unit definition name will be changed, not the file name). At first sight I don't see any disadvantages from this, so yes, I would apply such a patch. IMHO preferably not the unit names (as in 'unit XxX') - with case sensitive file names on Unix, this change might increase time for searching the respective file (somewhat). Obviously, all further references of the unit (as in 'SysUtils.Execute') should be fine. But only if it is in a uses clause, not the actual unit xx; clause ? Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, March 22, 2018 12:42, Michael Van Canneyt wrote: > On Thu, 22 Mar 2018, Ondrej Pokorny wrote: Hi, >> will a patch be applied that fixes CamelCase in unit and method names >> and other identifiers? >> >> Example: >> >> dateutils -> DateUtils >> sysutils -> SysUtils >> typinfo -> TypInfo >> contnrs -> Contnrs >> strutils -> StrUtils . . >> (For unit names: of course only the unit definition name will be >> changed, not the file name). > > At first sight I don't see any disadvantages from this, so yes, I would > apply such a patch. IMHO preferably not the unit names (as in 'unit XxX') - with case sensitive file names on Unix, this change might increase time for searching the respective file (somewhat). Obviously, all further references of the unit (as in 'SysUtils.Execute') should be fine. Tomas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Fix CamelCase in unit and method names
On Thu, 22 Mar 2018, Ondrej Pokorny wrote: Hello, will a patch be applied that fixes CamelCase in unit and method names and other identifiers? Example: dateutils -> DateUtils sysutils -> SysUtils typinfo -> TypInfo contnrs -> Contnrs strutils -> StrUtils EnterCriticalsection -> EnterCriticalSection DoneCriticalsection -> DoneCriticalSection LeaveCriticalsection -> LeaveCriticalSection TryEnterCriticalsection -> TryEnterCriticalSection (Funnily enough InitCriticalSection is correct.) TPoint.x -> TPoint.X TPoint.y -> TPoint.Y (For unit names: of course only the unit definition name will be changed, not the file name). At first sight I don't see any disadvantages from this, so yes, I would apply such a patch. Code completion will benefit from it, I suppose. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] Fix CamelCase in unit and method names
Hello, will a patch be applied that fixes CamelCase in unit and method names and other identifiers? Example: dateutils -> DateUtils sysutils -> SysUtils typinfo -> TypInfo contnrs -> Contnrs strutils -> StrUtils EnterCriticalsection -> EnterCriticalSection DoneCriticalsection -> DoneCriticalSection LeaveCriticalsection -> LeaveCriticalSection TryEnterCriticalsection -> TryEnterCriticalSection (Funnily enough InitCriticalSection is correct.) TPoint.x -> TPoint.X TPoint.y -> TPoint.Y (For unit names: of course only the unit definition name will be changed, not the file name). Ondrej ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel