- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: tuples and specialization - surprise
i kinda expected tuple2specialized to be:
class Tuple2Double(val a:double, val b:double)
not
class Tuple2Double(val a:double, val b:double, val unused1:Object, val unused2:Object)
Am 18.01.2012 21:33, schrieb √iktor Ҡlang:
class Tuple2Double(val a:double, val b:double)
not
class Tuple2Double(val a:double, val b:double, val unused1:Object, val unused2:Object)
Am 18.01.2012 21:33, schrieb √iktor Ҡlang:
2mkdimOiDPaW-JwnHt7jh_CO1OPNA [at] mail [dot] gmail [dot] com" type="cite">
On Wed, Jan 18, 2012 at 9:29 PM, HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star [at] gmx [dot] de> wrote:
why are there 4 members instead of 2?
How else do you store a primitive without boxing it?
--
Viktor Klang
Akka Tech Lead Typesafe - The software stack for applications that scale
Twitter: @viktorklang










Re: tuples and specialization - surprise
Therefore, unfortunately, it inherits the now-unused fields _1 and _2 (and the extra 8 bytes of storage that those require).
A scheme where there was a common base class that has no fields (just accessors) and the object-containing fields were in the (default) subclass would avoid this problem (albeit at the cost of confusing all the class names even when the specialized version wasn't used).
--Rex
2012/1/18 HamsterofDeath <h-star [at] gmx [dot] de>
Re: tuples and specialization - surprise
On 18 January 2012 23:04, Rex Kerr <ichoran [at] gmail [dot] com> wrote:
Right, so if a class is specialized, perhaps this should cause specific sub-classes to be generated for the Any cases in addition to the primitive ones? Who knows, it may even clean up some of the implementation ;)
Matthew
--
Dr Matthew PocockIntegrative Bioinformatics Group, School of Computing Science, Newcastle Universitymailto: turingatemyhamster [at] gmail [dot] com gchat: turingatemyhamster [at] gmail [dot] commsn: matthew_pocock [at] yahoo [dot] co [dot] uk irc.freenode.net: drdozerskype: matthew.pococktel: (0191) 2566550mob: +447535664143