Subject: Verify Report Findings

From: Celebrity Arrest Records <[email-masked]>
Date: Fri, 30 May 2014 11:36:35 -0700

Search Criminals Records | Bankruptcy Records |Previous Addresses

Enter a Name Here →

to change message status Update Notice Messages

118 Kecks Lane

Ruff Dale, PA 15679
or visit unsubscribe

This is useless, it is only a complicated way to write new String[...]. But what is really needed is something like public static <T> T[] newArray(int size) { ... }, and this simply does not exist in java noir can it be simulated with reflection - the reason is that information about how a generic type is instantiated is not available at runtime. Ingo Mar 21 '11 at 10:11
@Charlatan: Sure, but so can new []. The question is: who knows the type and when. Therefore, if all you have is a generic type, you can't. Ingo Mar 23 '11 at 12:4
@Ingo That's static. This is dynamic. I'm not sure what you don't understand. gdet that. The point is, you don't get a Class object at runtime for generic
Almost. I admit that this is more than what can be achieved with new[]. In practice, this will almost always do the job. However, it is still not possible, for instance, to write a container class parameterized with E that has a method E and that indeed returns a true E[] array. Your code could be applied only when there is at least one E-object in the collection. So, a general solution is imposs @Ingo If you wanted that functionality, and you really wanted to avoid needing to suppress any warnings, then you could have an instance field of type Class and have the constructors take a corresponding argument to initialize it with. This could be done in a type-safe manner. gdejohn Mar 23 '11 at 13:45

rlatan How to get a Class object for type ArrayList<String>, in a typeponding argument to initialize it with' cannot be done in a type safe manner after a
@misiu_mp Yes, it can. That will compile without warnings and give you what you want. It's obviously just not an option for the preexisting ArrayList implementation
@Charlatan Try to use ArrayList<String> as the generic argument in your example. GenSet<ArrayLisss contraption. misiu_mp Oct 11 '11 at 12:59

@misiu_mp You can't parameterize class literals, due to type erasure

This is especially if you were using macros to add items to arrays. Using macros don't have the smarts to distinguish when not to add a comma, or rather adding such logic makes macros inherently more complex. justification is to make code generation simpler, then why not adopt the no parenthesis style of some funcional languages? and why not to infer all types? and remove the semicolons? and so on. I think the real Why "unfortunate"? What's the downside here? Just because some consideration has been given to code generation (and easy manipulation) for one tiny part of the language doesn't mean it has to be the primary motivation behind all decisions in the language. Type inference, removal of semi-colons etc have hUnfortunate because is inconsistent with other rules such as commas between method arguments, why the code-generation guys didn't get "helped" there? My reference to type inference, removal of semi-co
lons, etc. were to put an exaggerated example of a great help for code-generation. In other words, IMHO, or the language is fully consistent or is ful That's where pragmatism wins over dogmatism: why does it have to be fully one thing or fully the other, when it's more useful to be a mixture of both? How does it actually get in the way, being able to add a comma at the end? Is this an inconsistency which has ever impeded you in any sense? If not, please weigh that irrelevant inelegance against the practical benefits of allowing a comma at the end. Jon Skeet Aug 13 '11 its supported in a number of other languages besides c++ as well i know that php and c# support this so its I once stumbled across this issue when I wrote a script gene C code describing a 3D-Model and was happy tGene code - can we say its done 10% or less times; rest of the time it involves typing in code. Statistically significant or not, those ferocious coders who blast off 100s of characters per minute, cannot af
ford to type in 2 more (or 20 more for that matter) characters? I'm not complaining, but this justification seems odd. I think @Mrchief: It's not a matter of typing rate - it's a matter of simplicity, when copying, removing or reordering items. It made my life simpler just yesterday. With no downside, why not make life easier? As for trying to point the finger at MS, I strongly suspect this has been in C since before Microsoft even existed... You say this justification seems odd, but I bet it benefits thousands of developers across hundreds of companies every Totally with you, my thought is, why not make life easier in other places too? As a sidenote and a bit @Mrchief: I suspect it wouldn't be nearly as useful in other places - because most other places don't use a homogeneous list of items. For example, for method calls, reordering parameters is something which generally takes a lot more care due to the type system. The position makes a semantic difference, not just an order-of-ap
pearance difference. (This doesn't hold as much water for named arguments, of course.) It feels lWell, I was referring to other things, such as being able to say: public property int Index; (for auto-implemented properties primarily) which is much easier to type in (less chars, all in same row), more readable than ugly public int Index { get; set; }; and I guess tad easier for code generation as well. Mrchief Aug 17 '11 at 14:23