begin quoting Christopher Smith as of Sun, Jan 06, 2008 at 11:44:05PM -0800:
> SJS wrote:
> > begin quoting David Brown as of Sun, Jan 06, 2008 at 05:29:12PM -0800:
> >
> >> C# is kind of enough to consider use before initialization to be a static
> >> compilation error. Most other languages just consider it a warning.
> >
> > Well, C# is just a Java ripoff. That's nothing new.
>
> I hate it when people say this. C# is a language in its own right, and
> distinct in lots of interesting ways. Java might well have a lot to do
> with the motivations for creating the language, but it is important and
> useful to evaluate each language in its own right.
The purpose, so far as I am concerned, of C#, was to kill Java and
remove a threat to M$. (And the mono project was a declaration of
alligance to M$ and enmity to Sun; I keep thinking of Schlock Mercenary
Rule #29...)
C# is a fork of the Java design. And I think it served its purpose: Sun
then rushed thru a bunch of ill-thought-out features to be bolted on to
Java in an effort to "keep up with Microsoft".
> Of course... Java *does* detect use before initialization at compile
> time, where possible. ;-)
Yup!
[snip]
> > auto foo( auto input ) {
> > auto bar = processInput( input );
> > ...
> > return bar;
> > }
> >
> That certainly wouldn't work in C++ 0x.
Well, it's C++. :-P
> If it did though, it wouldn't be *too* bad a thing, until you looked at
> the declaration for "foo":
>
> auto foo(auto input);
>
> That makes no sense whatsoever.
Yup.
> Typically in C++ you can use some
> standard template idioms to accomplish much the same thing though:
>
> template <typename T>
> typename tr1::result_of<processInput(T)>::type foo(T input);
Yup. There's a reason I don't care for C++. One of the big reasons for
"auto" was that LongArduousType foo = new LongArduousType(...); was
too hard to read. The C++ way, which works, doesn't solve the original
criticism. :-/
> Which roughly translates to: "the return type of foo(T) is whatever the
> return type of processInput(T) is".
Well, at least you've convinced me that Java's Generics syntax isn't
as bad as C++'s template syntax.
> > At the moment, I'm actually wondering about heading in the other
> > direction. What if objects _have_ a type, but do not _define_ a type?
> > What if, to define an type, you had to define an interface, and
> > variables (and parameters, and return-types) could _only_ be
> > interefaces?
>
> I've seen people hack on things like this to Smalltalk, and Objective-C
> kind of has stuff like this. In practice it does produce some extra
> typing (you basically have a type system and then behavior binding to it
> which is entirely orthogonal, and you have a lot of simple cases where
> the distinction creates redundant definitions). In the end, I found it
> not as nice as I'd thought it would be.
That's generally the case with most "interesting ideas". :)
(And it's also why I'm suspicious of whatever Cool New Approach is this year
or month or whatnot.)
Still, it might be interesting to try it out.
--
I think it is important to explore lots of ideas and approaches
Eventually you might find a way to turn pumpkins into coaches.
Stewart Stremler
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg