The Artima Developer Community
Sponsored Link

Weblogs Forum
Programming with "Duh" Typing

370 replies on 371 pages. Most recent reply: Aug 8, 2007 9:54 AM by James Watson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 370 replies on 371 pages [ « | 1 ... 13 14 15 16 17 18 19 20 21 ... 371  | » ]
Carson Gross

Posts: 153
Nickname: cgross
Registered: Oct, 2006

Re: Programming with "Duh" Typing Posted: Jul 7, 2007 9:25 PM
Reply to this message Reply
Advertisement
> Irrelevant, this is NOT what I wrote. There is no way you
> can add an Integer in my example. It is a stupid and
> useless warning.

I'm looking at it from a compiler writers perspective. All you have is a parameterized type left hand side of a declaration/assignment, and and right hand side expression with a generic type. Peeking at the rhs expression to determine if it is a pure constructor would be an utter hack. Why do that when very simple type inference gives you even more, and is sound?

> Your example is just plain bad code (which you intended it
> to be, not a knock on you) for a lot of reasons, and you
> can't stop bad code.

It's bad code that *could* be stopped if java didn't allow generic types to be assigned to parameterized types. It should be an error, and I was dumbfounded when I found out that it isn't in java for "source" compatibility. I mean, we have to go through utter type bondage with all the wildcard types flying around in normal code, but some sucker comes flying in with a generic type and, blam, the type system is in shambles.

They may as well have slammed covariant generic types in as well: it's useful at times even though it is incorrect formally. (OK, OK, that was a wee bit offsides.)

Agree to disagree?

Cheers,
Carson

Flat View: This topic has 370 replies on 371 pages [ « | 13  14  15  16  17  18  19  20  21 | » ]
Topic: Programming with "Duh" Typing Previous Topic   Next Topic Topic: Python 3000 Plea for Help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use