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 ... 15 16 17 18 19 20 21 22 23 ... 371  | » ]
Jules Jacobs

Posts: 119
Nickname: jules2
Registered: Mar, 2006

Re: Programming with "Duh" Typing Posted: Jul 8, 2007 3:34 AM
Reply to this message Reply
Advertisement
> Other than in unit tests, I'm hard-pressed to remember
> ever wanting to write such code. An object will have a
> list, and it will be read from a configuration file or
> have a setter or something, but the times I'm wanted to
> initialize it with two hard coded strings is, well,
> never.
>
> In that case, I'm gonna have to write List<String>
> explicitly, and Java seems much more reasonable typing
> wise, and the benefits of more explicit type checking are
> less of a burden to implement.

Good type inferencers can infer the type even if the string isn't hard-coded. The method that reads the data from the configuration file returns a List<String>, and the compiler knows this, so it can infer the type. The compiler knows that this method returns a list of strings because this method reads data directly from the file (the compiler knows that this data is of type string), and puts this data in a list (so the compiler knows that this is a list of strings).

Flat View: This topic has 370 replies on 371 pages [ « | 15  16  17  18  19  20  21  22  23 | » ]
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