Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
krnhotwings
May 7, 2009
Grimey Drawer
Alrighty, I'm trying to gently caress around with generics and reflection, via TypeTag, to try and retain type information on runtime:

http://pastebin.com/Cj6z2Ez4
(It's best to download this file and feed it into the 'scala' command. If you copy and paste it into the REPL, it behaves differently.. I'm on 2.11.8)

As commented, line 11 loses type information because of the generic type declaration in line 6. If I remove that declaration everything works as expected, but for various reasons, let's say that I have to have it there and that I can't manually declare types on line 11 (because realistically, I wouldn't know what kinda of type I'd be getting.)

Is there some way for me to use the underscore/wildcard type in conjunction with TypeTag to keep the type information down that chain of calls?

krnhotwings fucked around with this message at 06:21 on Aug 25, 2016

Adbot
ADBOT LOVES YOU

  • Locked thread