Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under FPC and unexpectedly, FPC doesn't raise any errors!
If you declare a distinct type as follows:
type TMyInteger = type Integer;
The type
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under FPC and unexpectedly, FPC doesn't raise any errors!
If you declare a distinct type as
On Thu, Sep 18, 2008 at 9:42 AM, Michael Van Canneyt
[EMAIL PROTECTED] wrote:
The type TMyInteger Integer so you are not supposed to be allowed
to assign one to the other. Yet you can. See the following program.
But obviously delphi also allows it ? It compiles everything,
just not as a var
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
On Thu, Sep 18, 2008 at 9:42 AM, Michael Van Canneyt
[EMAIL PROTECTED] wrote:
The type TMyInteger Integer so you are not supposed to be allowed
to assign one to the other. Yet you can. See the following program.
But obviously delphi
In our previous episode, Michael Van Canneyt said:
And it is also very annoying because
Type
MyString = type string;
Const
AString = 'something';
Var
M : MyString;
begin
M:=AString;
end.
Will no longer compile if you are too strict. They should at least remain
On Thu, 18 Sep 2008, Florian Klaempfl wrote:
Michael Van Canneyt schrieb:
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under
Michael Van Canneyt schrieb:
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under FPC and unexpectedly, FPC doesn't raise any errors!
If you
From: Florian Klaempfl [EMAIL PROTECTED]
Michael Van Canneyt schrieb:
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical
newsgroup.
They raised an issue about distinct types. I tried the following
example under FPC and unexpectedly,
On Thu, Sep 18, 2008 at 10:11 AM, Michael Van Canneyt
[EMAIL PROTECTED] wrote:
And it is also very annoying because
Type
MyString = type string;
Const
AString = 'something';
Var
M : MyString;
begin
M:=AString;
end.
Will no longer compile if you are too strict. They should at
Graeme Geldenhuys schrieb:
On Thu, Sep 18, 2008 at 10:11 AM, Michael Van Canneyt
[EMAIL PROTECTED] wrote:
And it is also very annoying because
Type
MyString = type string;
Const
AString = 'something';
Var
M : MyString;
begin
M:=AString;
end.
Will no longer compile if you are too
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
Michael Van Canneyt schrieb:
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under
Graeme Geldenhuys schrieb:
Hi,
I was following a discussion in the delphi.non-technical newsgroup.
They raised an issue about distinct types. I tried the following
example under FPC and unexpectedly, FPC doesn't raise any errors!
If you declare a distinct type as follows:
type TMyInteger
On Thu, Sep 18, 2008 at 11:34 AM, Florian Klaempfl
[EMAIL PROTECTED] wrote:
That's the whole point - it shouldn't be assignment compatible. You
are creating a new MyString type, irrespective of what base-type it
was based on. Only MyString types should be assigned to MyString
types,
Graeme Geldenhuys schrieb:
eg: #2
type
MyType = type Double;
MyOtherType = type Double;
Otherwise, what's the different between a alias type (eg #1) and a
distinct type (eg #2)??
As I said: overloading. It means: compatible but not equal. If you want
distinct: use as said, classes,
From: Florian Klaempfl [EMAIL PROTECTED]
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
Michael Van Canneyt schrieb:
On Thu, 18 Sep 2008, Graeme Geldenhuys wrote:
Hi,
I was following a discussion in the delphi.non-technical
newsgroup.
They raised an issue about distinct
Yury Sidorov schrieb:
Yes. But it works only partially. For example the following code is
not compilable:
Well, I wouldn't know either what you expect :)
I expect that compiler will choose DoTest with ansistring parameter in
that case.
What rule do you apply to say this?
//--
type
From: Florian Klaempfl [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Thursday, September 18, 2008 4:14 PM
Subject: Re: [fpc-devel] Bug in FPC and declaring distinct types
Yury Sidorov schrieb:
Yes. But it works only partially. For example the following code
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Thursday, September 18, 2008 4:14 PM
Subject: Re: [fpc-devel] Bug in FPC and declaring distinct types
Yury Sidorov schrieb:
Yes. But it works only partially
On Thu, Sep 18, 2008 at 3:40 PM, Florian Klaempfl
[EMAIL PROTECTED] wrote:
What rule do you apply to say this?
Compiler treats '1234' as ansistring constant. Therefore ansistring
overload must be choosen here.
No, '1234' is taken as generic string constant.
And which type is a generic
From: Florian Klaempfl [EMAIL PROTECTED]
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Thursday, September 18, 2008 4:14 PM
Subject: Re: [fpc-devel] Bug in FPC and declaring distinct types
Yury Sidorov schrieb
Florian Klaempfl wrote:
Yury Sidorov schrieb:
Yury Sidorov schrieb:
Yes. But it works only partially. For example the following code
is not compilable:
Well, I wouldn't know either what you expect :)
I expect that compiler will choose DoTest with ansistring parameter
in that case.
What rule
Graeme Geldenhuys schrieb:
On Thu, Sep 18, 2008 at 3:40 PM, Florian Klaempfl
[EMAIL PROTECTED] wrote:
What rule do you apply to say this?
Compiler treats '1234' as ansistring constant. Therefore ansistring
overload must be choosen here.
No, '1234' is taken as generic string constant.
And
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
Yury Sidorov schrieb:
From: Florian Klaempfl [EMAIL PROTECTED]
To: FPC developers' list fpc-devel@lists.freepascal.org
Sent: Thursday, September 18, 2008 4:14 PM
Subject: Re: [fpc-devel] Bug in FPC and declaring distinct types
On Thu, Sep 18, 2008 at 3:50 PM, Yury Sidorov [EMAIL PROTECTED] wrote:
It makes implementation of utf8string impossible using this approach...
I agree. I created a distinct string type (TfpgString) in fpGUI. That
way I could ensure TfpgString is a UTF-8 string and String is a
AnsiString
] Bug in FPC and declaring distinct types
Yury Sidorov schrieb:
Yes. But it works only partially. For example the following
code is not compilable:
Well, I wouldn't know either what you expect :)
I expect that compiler will choose DoTest with ansistring
parameter in that case.
What rule do
On Thu, Sep 18, 2008 at 3:55 PM, Florian Klaempfl
[EMAIL PROTECTED] wrote:
Without any further code, the type 'asdf' is not defined, $H means only
ansistring might be prefered.
So does that mean if you have {$H+} enabled, then in the example
below, the p1(ansistring) version will be called?
Yury Sidorov schrieb:
We discussed this once and concluded, that something like this hurts
more than it helps because an overloaded assignment operator allows
the compiler always to mess really around :)
Maybe.
But you stated that it is possible to create fully functional utf8string
type
On Thu, Sep 18, 2008 at 10:51 AM, Florian Klaempfl
[EMAIL PROTECTED] wrote:
This is not true. The main purpose is to be able to overload
functions/operators:
type
TUTF8String = type ansistring;
enables you to overload all procedure already defined for ansistrings with
UTF8String
28 matches
Mail list logo