Memory Management in Objective-C
Subject:   (Q) interchangeable pointers and objects
Date:   2001-07-30 20:30:20
From:   psheldon
Toward the end of the last page, Mike Beam writes "Convenience constructors also make it less cumbersome to nest messages". I noted something puzzling here that I also vaguely remember from another object oriented language, Apple's object oriented pascal course I took long ago.
Note above this sentence on nesting that the variable string points to a NSString, the star prefix on string is saying the thing pointed to by the variable string is an NSString type. The method setStringValue accepts this pointer. But, when we collapse things into a nest, it accepts, not a pointer to, but rather the NSString type itself.
I might windily say that "the compiler is smart enough to forgive" or "the language is not context free in interpretation", but I think there is something deeper going on that makes all object oriented languages "forgive" this way, that this is "a feature and not a bug", a feature I might better exploit if I don't simply rationalize away with these windy words, but put into some sort of new rules for my writing code, rules to not merely rationalize what I have seen but also predict and help me write code I haven't seen.
Perhaps there is an introductory remark somewhere, something toward these rules, so I will more fearlessly let the compiler forgive me and not fuss with such things.

1 to 2 of 2
  1. Object Semantics
    2001-07-31 07:29:27  canyonrat [View]

    • Object Semantics
      2001-07-31 10:42:35  psheldon [View]

      • Where is the folklore
        2001-08-01 20:54:55  canyonrat [View]

        • Where is the folklore
          2001-08-02 14:21:24  psheldon [View]

          • cocoa-dev with browser-nomail option
            2001-08-02 21:24:14  psheldon [View]

          • Where is the folklore
            2001-08-02 20:46:40  canyonrat [View]

            • thanks, checked omnigroup (nomail?)
              2001-08-02 21:40:48  psheldon [View]

              • thanks, checked omnigroup (nomail?)
                2001-08-03 07:29:38  canyonrat [View]

  2. (Q) interchangeable pointers and objects
    2001-07-31 07:23:03  justinarmstrong [View]

    • (Q) interchangeable pointers and objects
      2003-12-09 17:35:27  anonymous2 [View]

1 to 2 of 2