SJS wrote:
> 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...)
>   
I think it is safe to say that is a gross oversimplification of what was
going on, and in particular ignores the strategy behind the CLR and C#'s
role in that. It also ignores Hejlsberg's heavy involvement in the
Pascal world and how that influenced the language's design. Finally, it
ignores the fairly divergent directions Java and C# are heading in
(particularly if you look at all the work around adding LINQ to the CLR).

Either way, going after a language based on the forces that supported
its development is quite similar to an ad hominem.
> 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". 
>   
That's a fantastic story that doesn't stand up to the facts. Generics
(which is what most people gripe about) has been a long standing effort
that predates the language even being called Java. Gosling talked about
it being ready for prime time before anyone knew about the C# initiative
or whether it was going to amount to anything. It was originally slated
for release in JDK 1.4 and was held back by a JCP veto because a vendor
wasn't ready for it.
>>> auto foo( auto input ) {
>>>    auto bar = processInput( input );
>>>    ...
>>>    return bar;
>>> }
>>>   
>>>       
>> That certainly wouldn't work in C++ 0x.
>>     
>
> Well, it's C++. :-P
>   
Prior to 0x, the auto keyword doesn't do what you are trying to get it
to do.
>>                                 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.
Well, first of all, you're hopefully mostly doing:

LongArduoustype foo(...);

most of the time. Secondly, you can use typedef's (oddly not found in
Java-y languages for some reason) and namespace aliases (indeed, this is
the far more common idiom for doing this kind of stuff with templates
than the one listed above). Thirdly, it is a tad unusual to actually be
invoking new directly (as opposed to through some factory method which
would likely have a much shorter name) and storing the result in a local
variable. I would seriously treat it as a bit of a red flag when I was
reading the code. Finally, if you *are* using "new", part of the reality
is that "foo" doesn't have to be of type "LongArduousType*" (you dropped
the pointer for reasons unknown), so the declaration does have
significant meaning.
>   The C++ way, which works, doesn't solve the original
> criticism. :-/
>   
The auto keyword does solve the problem. It doesn't allow you to tersely
define the return type of a function, but many would argue that's a good
thing, because that is a logical point for explicit type definitions.

--Chris

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to