Do we really need const?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Mon Sep 17 14:24:20 PDT 2007
"Robert Fraser" <fraserofthenight at gmail.com> wrote in message
news:fcmngv$qhq$1 at digitalmars.com...
> I'm not suggesting D go dynamically-typed (doesn't work so well in a
> compiled language),
Bit of a sidetrack here. Dynamic typing, in the sense that variables don't
have types, certainly doesn't go well in a compiled language, but type
inference, something that ends up looking very similar to dynamic typing,
_does_, can, and has been implemented well in compiled languages. ML and
Haskell are examples. Nemerle as well, because even though it compiles to a
VM it's still a statically typed VM. It's almost like IFTI or variable
declaration type inference (auto x = 5), but extended to virtually
_everything_.
One language I've seen that I really liked was Bla. It uses Haskell-style
type inference, but it still allows you to explicitly type things if you
want. In this way you can do away with typing variables/params in a vast
majority of the cases, and in the instances when you _want_ something to be
typed, or when the type inference system can't figure it out on its own, you
can type it manually.
Of course something like this would probably be far too much of a departure
for a language like D.
More information about the Digitalmars-d
mailing list