LWN.net Logo

Day: GNOME OS

Day: GNOME OS

Posted Aug 8, 2012 23:47 UTC (Wed) by mathstuf (subscriber, #69389)
In reply to: Day: GNOME OS by nix
Parent article: Day: GNOME OS

Not sure I feel the same about virtual because of the "only pay for what you use" principle. Another thing: something like a 'delayed const' (similar to 'final' in Java IINM) so that you can modify a variable and then 'constify' it so that it doesn't change after that point (something the compiler could enforce rather than assignment to a const& and relying on people to not use the pre-const& variable after).


(Log in to post comments)

Day: GNOME OS

Posted Aug 10, 2012 7:49 UTC (Fri) by nix (subscriber, #2304) [Link]

The 'delayed const' sounds like a finer-grained 'mutable'.

(But don't mention Java. Java's lack of constness is *awful*. More than once I have introduced horrible bugs because I accidentally modified a hash key due to the silent aliasing and lack of const of java.util.Map -- meanwhile such bugs never ever happen in the STL, not due to its nifty space-age genericity, but simply because its data structures copy the types handed into them, and won't give you something back that shouldn't be modified without a const on it. For that matter I have written data structures in poor old crude C with the same 'always copy, use const' rules as the STL, and *they* never suffered from this either.)

Day: GNOME OS

Posted Aug 10, 2012 8:10 UTC (Fri) by jezuch (subscriber, #52988) [Link]

> But don't mention Java. Java's lack of constness is *awful*.

Yes, that's one of the very few features that I truly miss in Java. There are workarounds like defensive copies and immutable wrappers but they're no fun.

Day: GNOME OS

Posted Aug 10, 2012 17:42 UTC (Fri) by mathstuf (subscriber, #69389) [Link]

Also typedefs. I hated using Strings for everything and 5 parameters all of String to Android APIs means having to look up what the order is. At least the ordering is consistent where I used it (unlike, e.g., PHP)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds