Board index » delphi » Re: Type inference

Re: Type inference


2008-06-17 05:45:13 PM
delphi97
I think that it is important to remember that type inference in C# has not
been introduced for its own sake. It is required to declare variables of
anonymous classes, which in turn are a prerequisite for LINQ (as Markus has
already pointed out). Sure, it has other beneficial uses outside of that,
but I doubt that its creators had that in mind as a primary goal.
Type inference without declaration and assignment in one statement makes
little sense and Pascal's variable declaration section does not lean very
well towards that. So until CodeGear acts on LINQ, I wouldn't bet on seeing
type inference in Delphi any time soon. They have other fish to fry at the
moment.
 
 

Re: Type inference

MartinK writes:
Quote
I think that it is important to remember that type inference in C# has
not been introduced for its own sake. It is required to declare
variables of anonymous classes, which in turn are a prerequisite for
LINQ (as Markus has already pointed out). Sure, it has other beneficial
uses outside of that, but I doubt that its creators had that in mind as
a primary goal.

In Oxygene ("Chrome" at that time), this was done because of inline code inside ASPX markup.
First they allowed inline vars because of it, then they realized that inferring the type greatly
reduces the noise in those code fragments.
Everyone liked it, so it became the default way of having locals.
Quote
Type inference without declaration and assignment in one statement makes
little sense and Pascal's variable declaration section does not lean
very well towards that. So until CodeGear acts on LINQ, I wouldn't bet
on seeing type inference in Delphi any time soon. They have other fish
to fry at the moment.
Yes, they have. But removing the spider webs and pies of dust from the language is always a good thing.
They are already doing it WRT generics and anonymous methods, btw. :-)
 

Re: Type inference

MartinK writes:
Quote
I think that it is important to remember that type inference in C# has
not been introduced for its own sake. It is required to declare
variables of anonymous classes, which in turn are a prerequisite for
LINQ (as Markus has already pointed out). Sure, it has other
beneficial uses outside of that, but I doubt that its creators had
that in mind as a primary goal.
No, I don't think you can draw that conclusion. LINQ is a cool
feature, but it is hardly the only feature of C# 3.0. In particular,
you will see a lot of features in both C# and the .NET framework which
are clearly inspired by dynamic languages. Consider, for example the
Dynamic Language Runtime. One of the principal advantages of dynamic
languages is reducing unnecessary typing. Inferred types can give some
of this advantage without sacrificing the protections of static typing.
So my speculation - and, like yours, it is just speculation - is that,
its benefits to LINQ aside, type inferencing probably *was* introduced
for its own sake.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from mers.com
 

Re: Type inference

MartinK writes:
Quote
Type inference without declaration and assignment in one statement
makes little sense and Pascal's variable declaration section does not
lean very well towards that.
Indeed.
--
Rudy Velthuis [TeamB] www.teamb.com
"It's not the size of the dog in the fight, it is the size of the
fight in the dog." -- Mark Twain (1835-1910)
 

Re: Type inference

Craig Stuntz [TeamB] writes:
Quote

So my speculation - and, like yours, it is just speculation - is that,
its benefits to LINQ aside, type inferencing probably *was* introduced
for its own sake.

No speculations needed, I have seen a video of Hejlsberg holding a white board session and talking about
this exact syntax shortly before the release of C#2. (type inferences, that is)
 

Re: Type inference

So have I, but it is not the only thing he ever said on it.
--
Craig Stuntz [TeamB] ?Vertex Systems Corp. ?Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
qc.borland.com -- Vote for important issues
 

Re: Type inference

MartinK writes:
Quote
So until CodeGear acts on LINQ, I wouldn't bet
on seeing type inference in Delphi any time soon. They have other fish
to fry at the moment.
Aside to what the others said, I would rather guess that they are very
interested in technologies like LINQ, as per last DavidI post (see
blogs.codegear.com/davidi/2008/06/16/38890 ) - very nice one btw.
Also, if you want to determine the kind of fish for lunch, perhaps you
can choose to vote for:
Report No: 63401 Status: Reported
LINQ like feature for native code compiler
qc.codegear.com/wc/qcmain.aspx
- and/or (you can cast as much as 10 votes on unlimited reports now) -
Report No: 63402 Status: Reported
Please support LINQ for .NET
qc.codegear.com/wc/qcmain.aspx
--
m. th.
 

Re: Type inference

MartinK,
| Type inference without declaration and assignment in one statement
| makes little sense...
I think I agree. <g>
--
Q
06/17/2008 11:17:50
XanaNews Version 1.17.5.7 [Q's Salutation mod]