Re: const correctness

2012-03-19 Thread Ian Joyner
Really const correctness in the first place belonged in the Objective-C group. If you read the rest of my post I'm talking about immutability and const correctness, so although this comment on popularity came first it was just a subtopic and you have picked on this as a sub topic of the

Re: const correctness

2012-03-19 Thread Ian Joyner
On 20 Mar 2012, at 02:43, Nick Zitzmann wrote: > On Mar 19, 2012, at 5:51 AM, Ian Joyner wrote: > >> Actually NSArray. Note NSMutableArray inherits from NSArray because it adds >> extra functionality in methods that can change the object. You can assign an >> NSMutableArray object to an NSArray

Re: const correctness

2012-03-19 Thread Peter Teeson
Amen. On 2012-03-19, at 11:55 AM, Jens Alfke wrote: > I don’t mean to be rude, but I’m about at my personal limit of patience with > the amount of off-topic stuff one has to wade through on the Apple lists > lately (especially xcode-users, but here too.)

Re: const correctness

2012-03-19 Thread Jens Alfke
On Mar 19, 2012, at 4:51 AM, Ian Joyner wrote: > Popularity is more a proof of mass stupidity rather than quality. The cult of > C followed on from what Bob Barton called the cult of FORTRAN in 1963 and > also noted that systems programmers are high priests of a low cult. Please take this off-

Re: const correctness

2012-03-19 Thread Nick Zitzmann
On Mar 19, 2012, at 5:51 AM, Ian Joyner wrote: > Actually NSArray. Note NSMutableArray inherits from NSArray because it adds > extra functionality in methods that can change the object. You can assign an > NSMutableArray object to an NSArray reference, thereby making it unchangeable > via that

Re: const correctness

2012-03-19 Thread Ian Joyner
fusing talking about things in see :-) > > I hate to use Wiki for citation but: > > http://en.wikipedia.org/wiki/Const-correctness > > "In computer science, const-correctness is the form of program correctness > that deals with the proper declaration of objects as mutabl

RE: const correctness

2012-03-18 Thread Shawn Bakhtiar
tability just another word for constant-ability? I hate to use Wiki for citation but: http://en.wikipedia.org/wiki/Const-correctness "In computer science, const-correctness is the form of program correctness that deals with the proper declaration of objects as mutable or immutable. T

Re: const correctness

2012-03-18 Thread Ian Joyner
I think you've nailed it. Immutability is certainly a good concept, but including ideas from C++ is not a good idea because concepts are usually perverted in C++ (and even C - ALGOL carefully removed the junk out of FORTRAN and assembler but C, just put that garbage back in.) Concepts need very

Re: const correctness

2012-03-18 Thread Luther Baker
No no, you've both been very helpful. The time lines and "Mutable" thoughts are great points and more than answer my underlying question. Understanding a bit of the history goes along way when trying to rationalize (and adhere to) current conventions. Many Thanks! -Luther On Sun, Mar 18, 2012 a

Re: const correctness

2012-03-18 Thread Jens Alfke
On Mar 18, 2012, at 11:01 AM, Luther Baker wrote: > Obj-C and Cocoa don't support "const" because they are older? More because they weren’t designed around it. And because the way C++ does ‘const’ gets really problematic in a dynamic OOP language like Obj-C. Say you added ‘const’ object pointe

Re: const correctness

2012-03-18 Thread Jens Alfke
On Mar 17, 2012, at 10:58 PM, Luther Baker wrote: > I was ruminating about it more of a (self) documenting angle as opposed to > runtime enforcement … Cocoa’s idioms are different. In Cocoa you use mutable vs. immutable container types to indicate this. So if a method parameter is NSMutableStr

Re: const correctness

2012-03-18 Thread Scott Ribe
On Mar 18, 2012, at 12:01 PM, Luther Baker wrote: > Obj-C and Cocoa don't support "const" because they are older? Const showed up in C in around '89 or '90. Retrofitting const into large libraries that were designed without it is an absolute nightmare because of the cascading changes required.

Re: const correctness

2012-03-18 Thread Luther Baker
Obj-C and Cocoa don't support "const" because they are older? On Sun, Mar 18, 2012 at 9:44 AM, Scott Ribe wrote: > On Mar 17, 2012, at 11:58 PM, Luther Baker wrote: > > > I was ruminating about it more of a (self) documenting angle as opposed > to > > runtime enforcement ... and indeed, its appl

Re: const correctness

2012-03-18 Thread Scott Ribe
On Mar 17, 2012, at 11:58 PM, Luther Baker wrote: > I was ruminating about it more of a (self) documenting angle as opposed to > runtime enforcement ... and indeed, its application in C++ is what I'm was > thinking of. Well that's fine, but Objective-C and Cocoa predate const by many years. --

Re: const correctness

2012-03-17 Thread Luther Baker
That makes sense ... although the compiler sure does a good job of catching it at compile time :) I was ruminating about it more of a (self) documenting angle as opposed to runtime enforcement ... and indeed, its application in C++ is what I'm was thinking of. Thanks Jens! -Luther On Sun, Mar

Re: const correctness

2012-03-17 Thread Jens Alfke
On Mar 17, 2012, at 10:12 PM, Luther Baker wrote: > Just curious for the reasoning as to why some of the API calls like > [NSDictionary valueForKey:] take an NSString* and not a *const* NSString* ? ‘const’ doesn’t mean anything when applied to Objective-C object pointers. Unlike C++, the langua

const correctness

2012-03-17 Thread Luther Baker
Just curious for the reasoning as to why some of the API calls like [NSDictionary valueForKey:] take an NSString* and not a *const* NSString* ? I guess NSStrings are immutable and maybe most runtime built strings are more commonly not const ... but is everyone simply casting these guys at API invo