[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ::scr Touchy Feely?
On Friday 25 October 2002 13:17, Simon Kinahan wrote:
> > From my point of view, the Java syntax (and C++'s syntax before it) is
> > a *horrible* syntax to do OO in. Method definitions that appear to
> > have more declaration code that code that actually *does* anything
> > definitely leave me code, and if your code is well factored that's
> > almost certainly what you'll have in a lot of cases.
> It's the static nature of the thing that gets in the way. The need to
> declare all kinds of meta-information about your code, like what type it
> is, what exceptions it throws, who can access it, and so on. The trouble
> with dynamic languages, though, is that without all that metadata things
> like stripping (see below) are hard. I don't really buy the error-proneness
> argument against dynamic languages: if you can get confused about the type
> of something, you're already doing something wrong.
> What I'd really like is a modern, OO langauge that did type inference (like
> Standard ML) were possible, and then used dynamic typing where necessary.
Yay type inference!
With type inference, type declarations are optional. If left off, they
implicitly declare the declaration to be of a type like 'Object' that
Then the compiler, early on in compilation, goes around working out what
types bindings CAN have based upon what they're initialised from or, for
function arguments, where the function is called from. With that information,
1) Tightens up declarations that are too loose, eg something that is declared
as potentially being of any type turns out to only ever be used for integers,
so it can declare that fact for you. This helps in optimisation, since you
can statically resolve method dispatch and all that.
2) Look for conflicts; if something is declared as being of type Integer but
it's assigned to from a String at some other point, the compiler can bitch.
This helps in finding programmer errors.
> and then you'd have to spend a few days manually dinking around with the
> stripper to get it right.
Har har that sounds fun!
> Not really what you want to be doing right before a release.
Sounds like the kind of thing that might well trigger an immediate 'release'!
A city is like a large, complex, rabbit