From: Phil!Gregory
Date: 17:37 on 12 Aug 2005
Subject: Delphi's Type-Bondage
Hey, here's an idea. Let's make a language that forces the program to
adhere to extremely rigid variable typing rules. That way, we can force
the programmer to never shoot himself in the foot. Oh, but the whole
bondage and discipline approach to typing won't make him hate us enough.
Let's also introduce just enough type interchangeability to break anything
where he might try to use the type strictness to his benefit.
Well, it works. I hate them.
I have to read a series of database fields into a series of variables.
Except for the types of the variables, the process is the same for all of
the fields. I'd love to have just one function to call on all of them; it
would make things very simple. Delphi thinks differently. There's no way
to to hand a function a variable of an arbitrary type and have it do the
right thing; the compiler won't allow it. The best I can do is to keep
track of the data types myself and pass an extra value into the function
to tell it what the type of the destination variable is.
"But wait!" you cry (maybe). "You can use overloaded functions and
inheritance and stuff!" Or, at least, that's what I though to myself.
But, while Delphi is ever-so-strict about keeping different types
separate[0], if one type is defined in terms of another (TDateTime is
really a Double, for instance), overloaded functions _cannot tell the
difference between them_.
Go, Delphi, giving me the worst of all possible worlds.
[0] To the point where this is illegal code:
var
arr1 : array[1..10] of Integer;
arr2 : array[1..10] of Integer;
begin
arr1 := arr2
because the compiler considers arr1 and arr2 to be of different
types.
From: Robert G. Werner Date: 22:31 on 12 Aug 2005 Subject: Re: Delphi's Type-Bondage Phil!Gregory wrote: [snip] > Go, Delphi, giving me the worst of all possible worlds. > > > [0] To the point where this is illegal code: > > var > arr1 : array[1..10] of Integer; > arr2 : array[1..10] of Integer; > begin > arr1 := arr2 > > because the compiler considers arr1 and arr2 to be of different > types. > Wave's of Pitty are washing from my keyboard to yours.
From: Peter Pentchev Date: 20:10 on 18 Aug 2005 Subject: Re: Delphi's Type-Bondage --nVMJ2NtxeReIH9PS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 12, 2005 at 02:31:27PM -0700, Robert G. Werner wrote: > Phil!Gregory wrote: > [snip] > > Go, Delphi, giving me the worst of all possible worlds. > >=20 > >=20 > > [0] To the point where this is illegal code: > >=20 > > var > > arr1 : array[1..10] of Integer; > > arr2 : array[1..10] of Integer; > > begin > > arr1 :=3D arr2 > >=20 > > because the compiler considers arr1 and arr2 to be of different > > types. > >=20 > Wave's of Pitty are washing from my keyboard to yours. Well, at least it's a good thing those aren't waves ot pithy ;) G'luck, Peter --=20 Peter Pentchev roam@xxxxxxx.xxx roam@xxxxx.xx roam@xxxxxxx.xxx PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 "yields falsehood, when appended to its quotation." yields falsehood, when = appended to its quotation. --nVMJ2NtxeReIH9PS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDBN0i7Ri2jRYZRVMRAim7AKC6d75W62lxCMNdizLcDgZN0s8aWwCeN6Z5 89G+BWYZdMrqZgqcL6OP2Nc= =igtf -----END PGP SIGNATURE----- --nVMJ2NtxeReIH9PS--
Generated at 10:28 on 16 Apr 2008 by mariachi