Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Martin > > Since the type is part of value, and the value is public, all of the type > that is accessed through the value is available. > Same as you can access a private field through a public property. > Access a private variable via public property is analogous to function​​ calls,

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Jonas Maebe > > This is not equivalent. A private type declaration in a class adds a new > identifier that is visible inside that class. You then use it, still in > that class, to declare the return type of a function. Next, in a scope > where that type identifier is no longer visible,

Re: [fpc-pascal] same routine with different parameters?

2013-10-30 Thread waldo kitty
On 10/30/2013 5:18 AM, Sven Barth wrote: Am 29.10.2013 20:32, schrieb waldo kitty: On 10/29/2013 1:56 PM, Sven Barth wrote: Am 29.10.2013 18:21 schrieb "waldo kitty" : > example: procedure MyObject.MyRoutine; > procedure MyObject.MyRoutine(VarA : SomeType); > procedure M

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-10-30 Thread Dmitry Boyarintsev
On Wed, Oct 30, 2013 at 3:45 PM, Marco van de Voort wrote: > What if unitaa needs recompilation, and it is not in the dir it was > originally > compiled in. .\some\other\place then has a different meaning. > > Specially if the relative paths are short (like ..\src\ or so), there is > still > quit

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-10-30 Thread Marco van de Voort
In our previous episode, Dmitry Boyarintsev said: > I guess, technically it should be possible to use two different units with > the same name. > > I recall there was a discussion a while (few years) ago, about (re)using > Delphi introduced 'in' syntax (afaik, it is not available in pascal). > use

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-10-30 Thread Dmitry Boyarintsev
On Wed, Oct 30, 2013 at 1:35 PM, Marcos Douglas wrote: > IMO, the problem is: > You can not use two unit with the same name. > So, you can point -- using -Fu -- which unit the compiler will compile > but you can't used both at the same project. > I guess, technically it should be possible to use

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-10-30 Thread Marcos Douglas
On Tue, Oct 29, 2013 at 5:05 PM, Dmitry Boyarintsev wrote: > On Tue, Oct 29, 2013 at 3:50 PM, Marcos Douglas wrote: >> >> Yes, works... but the language allow hide the unit name and nobody >> uses unit name as an identifier in 99% of cases, Am I right? So, >> problems can be happen. >> > From my

Re: [fpc-pascal] Re: [Bulk] Re: Namespaces Support

2013-10-30 Thread Marcos Douglas
On Tue, Oct 29, 2013 at 4:51 PM, Dmitry Boyarintsev wrote: > On Tue, Oct 29, 2013 at 8:02 AM, Marcos Douglas wrote: >> >> You didn't understand. >> The namespace we talk about is like a "dinamic namespace". The >> programmer can choose which "names" he will use in your projects when >> these proj

Re: [fpc-pascal] SqlDB fails under Windows to create a new Firebird database

2013-10-30 Thread waldo kitty
On 10/30/2013 8:13 AM, Graeme Geldenhuys wrote: Here is the console output of when I run the program. --- c:\programming\m2_system\Scripts>makedb -d '127.0.0.1:c:\programming\data\m2_dl_3019.fdb' Creating database... '127.0.0.1:c:\programming\data\m2_dl_3019.fdb' exception at

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 15:00, Sven Barth wrote: Am 30.10.2013 14:37, schrieb Jonas Maebe: "Private" is just another way to define a scope, just like a unit interface and implementation define a scope. Neither the "private" section nor the interface of unit "u1" is in scope when the "hidden"

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Martin
On 30/10/2013 13:49, Xiangrong Fang wrote: 2013/10/30 Martin mailto:laza...@mfriebe.de>> I think there is no problem with: var a: array of Integer begin A:= obj.proc; You are NOT using the type. You are using the value. pascal is strong-typed. You are actually u

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Sven Barth
Am 30.10.2013 14:37, schrieb Jonas Maebe: On 30 Oct 2013, at 14:30, Xiangrong Fang wrote: 2013/10/30 Jonas Maebe The tdynarray type is not visible in the program because u1 is not in its uses clause (it's not in scope whatsoever), and nevertheless there is no problem to use it. It's of co

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 14:49, Xiangrong Fang wrote: pascal is strong-typed. You are actually using type along with its value. e.g. var a: array of Double; begin a := obj.proc;​​ This will emit a COMPILE time error because compiler know these 2 types are not compatible. No, it does not c

Re: [fpc-pascal] Powtils: lightwebserver, lightwebserver2 or lightwebserver3?

2013-10-30 Thread silvioprog
2013/10/30 Graeme Geldenhuys > On Tuesday 29/10/2013 at 18:19, John Lee wrote: > >> Is this assessment valid for win or linux or both? J >> > > I use both equally, and for the 32-bit and 64-bit platforms. > > Regards, > Graeme > +1. -- Silvio Clécio My public projects - github.com/silvioprog

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Martin > > I think there is no problem with: > > var > a: array of Integer > begin > A:= obj.proc; > > You are NOT using the type. You are using the value. > pascal is strong-typed. You are actually using type along with its value. e.g. var a: array of Double; begin a := ob

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Sven Barth > It's a bit annoying that the usage private/protected types in > public/published functions is allowed... (this is however Delphi > compatible) Maybe this should be adjusted for non-Delphi modes for language > consistency... (maybe at least as a warning which could be eleva

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Martin
On 30/10/2013 13:30, Xiangrong Fang wrote: 2013/10/30 Jonas Maebe > The tdynarray type is not visible in the program because u1 is not in its uses clause (it's not in scope whatsoever), and nevertheless there is no problem to use it. It's of course n

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 14:30, Xiangrong Fang wrote: 2013/10/30 Jonas Maebe The tdynarray type is not visible in the program because u1 is not in its uses clause (it's not in scope whatsoever), and nevertheless there is no problem to use it. It's of course not exactly the same (tdynarray isn

Re: [fpc-pascal] Re: SqlDB fails under Windows to create a new Firebird database

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Graeme Geldenhuys wrote: I haven't tested what happens if you specify a path under Windows that contain spaces, but will test it later. I would imagine quotes must be used, but not sure how yet. AFAIK: Windows doesn't know single quotes, you need to use double quotes

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Jonas Maebe > The tdynarray type is not visible in the program because u1 is not in its > uses clause (it's not in scope whatsoever), and nevertheless there is no > problem to use it. It's of course not exactly the same (tdynarray isn't > declared as private to u1), but at the scope vi

[fpc-pascal] Re: SqlDB fails under Windows to create a new Firebird database

2013-10-30 Thread Graeme Geldenhuys
Here is the console output of when I run the program. --- c:\programming\m2_system\Scripts>makedb -d '127.0.0.1:c:\programming\data\m2_dl_3019.fdb' Creating database... '127.0.0.1:c:\programming\data\m2_dl_3019.fdb' exception at 00431BD8: : CreateDB : -I/O error during

Re: [fpc-pascal] Efficient String concatenation

2013-10-30 Thread Graeme Geldenhuys
On Tuesday 29/10/2013 at 19:51, John Lee wrote: Did you try any other fpc compiler optimisation settings? No, -O2 is the only compiler optimisation I enabled. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://

Re: [fpc-pascal] Powtils: lightwebserver, lightwebserver2 or lightwebserver3?

2013-10-30 Thread Graeme Geldenhuys
On Tuesday 29/10/2013 at 18:19, John Lee wrote: Is this assessment valid for win or linux or both? J I use both equally, and for the 32-bit and 64-bit platforms. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org ht

[fpc-pascal] SqlDB fails under Windows to create a new Firebird database

2013-10-30 Thread Graeme Geldenhuys
Hi, I created a very simple little application that takes 2 parameters, then creates a empty FDB (firebird) database, then runs 4 script files to populate the database with default tables and data. This little console application works perfectly under Linux and FreeBSD, but fails under Wind

[fpc-pascal] Re: SqlDB fails under Windows to create a new Firebird database

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Graeme Geldenhuys wrote: Hi, I created a very simple little application that takes 2 parameters, then creates a empty FDB (firebird) database, then runs 4 script files to populate the database with default tables and data. This little console application works perfectly

Re: [fpc-pascal] Efficient String concatenation

2013-10-30 Thread Sven Barth
Am 30.10.2013 12:59, schrieb John Lee: jonas wrote ' It may indeed be possible to handle this in the compiler. > What about llvm - (coming soon to fpc apparently) - would that fix it? Not in the least. "soon" is also a gross overstatement. ' What's the size/difficulty of compiler spotting this?

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Jonas Maebe wrote: On 30 Oct 2013, at 13:05, Michael Van Canneyt wrote: On Wed, 30 Oct 2013, Jonas Maebe wrote: On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote: You must admit that in the case of a function result type, that is a bit awkward, since you will neve

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 13:05, Michael Van Canneyt wrote: On Wed, 30 Oct 2013, Jonas Maebe wrote: On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote: You must admit that in the case of a function result type, that is a bit awkward, since you will never be able to declare a properly typed var

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Jonas Maebe wrote: On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote: On Wed, 30 Oct 2013, Jonas Maebe wrote: It can, as demonstrated by the example that started this thread. The type identifier may not be visible, but entities that have this type can be. Just like

Re: [fpc-pascal] Efficient String concatenation

2013-10-30 Thread John Lee
jonas wrote ' It may indeed be possible to handle this in the compiler. > What about llvm - (coming soon to fpc apparently) - would that fix it? Not in the least. "soon" is also a gross overstatement. ' What's the size/difficulty of compiler spotting this? Suppose it needs to be able to 'look ahe

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 12:50, Michael Van Canneyt wrote: On Wed, 30 Oct 2013, Jonas Maebe wrote: It can, as demonstrated by the example that started this thread. The type identifier may not be visible, but entities that have this type can be. Just like in the unit example. You must admit tha

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Jonas Maebe wrote: On 30 Oct 2013, at 12:09, Sven Barth wrote: Am 30.10.2013 11:59, schrieb Jonas Maebe: The tdynarray type is not visible in the program because u1 is not in its uses clause (it's not in scope whatsoever), and nevertheless there is no problem to us

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 12:09, Sven Barth wrote: > Am 30.10.2013 11:59, schrieb Jonas Maebe: >> >> The tdynarray type is not visible in the program because u1 is not in its >> uses clause (it's not in scope whatsoever), and nevertheless there is no >> problem to use it. It's of course not exactly

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Sven Barth wrote: Am 30.10.2013 11:59, schrieb Jonas Maebe: problem to use it. It's of course not exactly the same (tdynarray isn't declared as private to u1), but at the scope visibility level it is the same situation as far as I am concerned. Hmm... but here the comp

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Sven Barth
Am 30.10.2013 12:06, schrieb Frederic Da Vitoria: 2013/10/30 Jonas Maebe > On 30 Oct 2013, at 10:36, Michael Van Canneyt wrote: I think it is an error. You declare something as private, and then you use it in a public function ? If that is n

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Sven Barth
Am 30.10.2013 11:59, schrieb Jonas Maebe: On 30 Oct 2013, at 10:36, Michael Van Canneyt wrote: I think it is an error. You declare something as private, and then you use it in a public function ? If that is not a visibility clash, I don't know what is :) The ability to use types in public f

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Frederic Da Vitoria
2013/10/30 Jonas Maebe > On 30 Oct 2013, at 10:36, Michael Van Canneyt wrote: > > I think it is an error. You declare something as private, and then you >> use it in a public function ? If that is not a visibility clash, I don't >> know what is :) >> > > The ability to use types in public functi

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Jonas Maebe
On 30 Oct 2013, at 10:36, Michael Van Canneyt wrote: I think it is an error. You declare something as private, and then you use it in a public function ? If that is not a visibility clash, I don't know what is :) The ability to use types in public functions that are not necessarily visib

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Sven Barth wrote: Am 30.10.2013 10:36, schrieb Michael Van Canneyt: On Wed, 30 Oct 2013, Sven Barth wrote: Am 30.10.2013 08:47, schrieb Xiangrong Fang: Hi All, I have the following class: type generic TVector = class private type

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
2013/10/30 Sven Barth > I think it is an error. You declare something as private, and then you use >> it in a public function ? If that is not a visibility clash, I don't know >> what is :) >> > I agree, but the question is should we declare this as a bug in the > language and thus fix it which m

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Sven Barth
Am 30.10.2013 10:36, schrieb Michael Van Canneyt: On Wed, 30 Oct 2013, Sven Barth wrote: Am 30.10.2013 08:47, schrieb Xiangrong Fang: Hi All, I have the following class: type generic TVector = class private type TDataType = array of T; pri

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Michael Van Canneyt
On Wed, 30 Oct 2013, Sven Barth wrote: Am 30.10.2013 08:47, schrieb Xiangrong Fang: Hi All, I have the following class: type   generic TVector = class   private type     TDataType = array of T;   private     FData: TDataType;     ... ...

Re: [fpc-pascal] same routine with different parameters?

2013-10-30 Thread Sven Barth
Am 30.10.2013 02:06, schrieb waldo kitty: Assume that this is for value parameters only. In particular, I don't think there's a way of defaulting a var parameter to a nil pointer. hummm... the original has no parameters at all... my addition has two... will this be a problem? no, i've not h

Re: [fpc-pascal] same routine with different parameters?

2013-10-30 Thread Sven Barth
Am 29.10.2013 20:40, schrieb waldo kitty: FWIW: i decided to try this because i was unable to (hope i'm using the proper terms here) derive a new object from the existing one and override this one inherited routine with my modifications... this would allow me to add my own variables to the obje

Re: [fpc-pascal] same routine with different parameters?

2013-10-30 Thread Sven Barth
Am 29.10.2013 19:35, schrieb Mark Morgan Lloyd: waldo kitty wrote: question: in simple language, how can i have a routine with differing parameters like some routines in FPC and Lazarus do? i've never attempted this before and it is completely alien to my experience but i do use the functional

Re: [fpc-pascal] same routine with different parameters?

2013-10-30 Thread Sven Barth
Am 29.10.2013 20:32, schrieb waldo kitty: On 10/29/2013 1:56 PM, Sven Barth wrote: Am 29.10.2013 18:21 schrieb "waldo kitty" : > example: procedure MyObject.MyRoutine; > procedure MyObject.MyRoutine(VarA : SomeType); > procedure MyObject.MyRoutine(VarA : string; VarB: int

Re: [fpc-pascal] private type and type compatibility

2013-10-30 Thread Sven Barth
Am 30.10.2013 08:47, schrieb Xiangrong Fang: Hi All, I have the following class: type generic TVector = class private type TDataType = array of T; private FData: TDataType; ... ... public ... ... function Slice(APos: Integer = -1; ACount: Integer = -1): TDataType;

[fpc-pascal] private type and type compatibility

2013-10-30 Thread Xiangrong Fang
Hi All, I have the following class: type generic TVector = class private type TDataType = array of T; private FData: TDataType; ... ... public ... ... function Slice(APos: Integer = -1; ACount: Integer = -1): TDataType; end; The Slice() method return a portion of th