home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso / answers / Objective-C / answers next >
Encoding:
Internet Message Format  |  1993-12-20  |  25.6 KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!xlink.net!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!sun4nl!tuegate.tue.nl!krait.es.ele.tue.nl!tiggr
  2. From: tiggr@es.ele.tue.nl (Tiggr)
  3. Newsgroups: comp.lang.objective-c,comp.answers,news.answers
  4. Subject: comp.lang.objective-c FAQ, part 1/3: Answers
  5. Supersedes: <answers_753551527@es.ele.tue.nl>
  6. Followup-To: comp.lang.objective-c
  7. Date: 20 Dec 1993 16:26:16 GMT
  8. Organization: Eindhoven University of Technology, the Netherlands
  9. Lines: 630
  10. Approved: news-answers-request@mit.edu
  11. Expires: 29 Jan 1994 16:26:13 GMT
  12. Message-ID: <answers_756404773@es.ele.tue.nl>
  13. Reply-To: tiggr@es.ele.tue.nl (Tiggr)
  14. NNTP-Posting-Host: krait.es.ele.tue.nl
  15. Summary: This first part of the comp.lang.objective-c FAQ postings
  16.     tries to answer all your Objective-C questions.
  17. Originator: tiggr@krait.es.ele.tue.nl
  18. Xref: senator-bedfellow.mit.edu comp.lang.objective-c:1828 comp.answers:3101 news.answers:16031
  19.  
  20. Archive-name: Objective-C/answers
  21. Version: $Id: answers,v 2.7 1993/12/01 07:34:52 tiggr Exp $
  22.  
  23.  
  24.                  Answers to
  25.  
  26.              FREQUENTLY ASKED QUESTIONS
  27.  
  28.                concerning Objective-C
  29.  
  30.  
  31. This is the first in a series of three informational postings concerning
  32. comp.lang.objective-c.  This first part answers FAQs; the second part lists
  33. available class libraries and the third part is a simple sample Objective-C
  34. program.
  35.  
  36. This posting answers the following questions:
  37.  
  38.  1   What is Objective-C?
  39.  2   What is the difference between Objective-C and C?
  40.  3   What is the difference between Objective-C and C++?
  41.  4   What exactly is it that makes Objective-C have `classes similar to
  42.      Smalltalk', and what are the resulting capabilities of Objective-C?
  43.  5   What are the `nice features' of Objective-C?
  44.  6   What are some of the common problems of the language and how can I work
  45.      around them?
  46.  7   What are Protocols?
  47.  8   What is the difference between the NeXTSTEP, Stepstone and GNU CC
  48.      versions of Objective-C?
  49.  9   What written information concerning Objective-C is available?
  50.  10  What kind of Objective-C support is provided by Stepstone?
  51.  11  What kind of Objective-C support is provided by NeXT?
  52.  12  What kind of Objective-C support is provided by GNU?
  53.  13  What kind of Objective-C support is provided by BPG.
  54.  14  What are the newsgroups to read or mailing lists to subscribe to in order
  55.      to stay up-to-date on developments for GNU Objective-C?
  56.  15  Are there any FTP sites with Objective C code?  Where?
  57.  16  What class libraries are available for Objective C?
  58.  17  So show me a program, a simple example.
  59.  18  How can garbage collection be applied to Objective-C?
  60.  19  What object encapsulation does Objective-C provide?
  61.  
  62. (To find a question search on the question number starting a line.)
  63.  
  64. 1   What is Objective-C?
  65.  
  66.     Objective-C is an object oriented computer programming language.  It is
  67.     a superset of ANSI C and provides classes and message passing similar to
  68.     Smalltalk.
  69.  
  70. 2   What is the difference between Objective-C and C?
  71.  
  72.     Objective-C is a superset of ANSI C.  It is an object oriented language
  73.     that has extensions similar to Smalltalk that are integrated into C
  74.     syntax without taking anything away.
  75.  
  76.     It includes a few more keywords and constructs.
  77.     New Keywords:
  78.      @class
  79.      @interface
  80.      @implementation
  81.      @public
  82.      @selector
  83.      @protocol
  84.      @end
  85.     Constructs:
  86.      [aList add: anObject];  // send a message to an instance
  87.     Types:
  88.      id    // a generic pointer to an object
  89.  
  90.     [This is nowhere near to what I would like it to be.]
  91.  
  92. 3   What is the difference between Objective-C and C++?
  93.  
  94.     C++ follows the Simula 67 school of OO programming, where Objective-C
  95.     follows the Smalltalk school.  In C++ the static type of an object
  96.     determine whether you can send it a message, in Objective-C the dynamic
  97.     type determine it.  The Simula 67 school is safer, in that more errors
  98.     are detected at compile time.  The Smalltalk school is more flexible, as
  99.     some valid programs will execute correctly in Smalltalk, where they
  100.     would be rejected by Simula 67.
  101.  
  102.     Stepstone's Objective-C allows you to chose between the dynamic and
  103.     static binding, GNU and NeXT do not.  ANSI C++ allows you to use dynamic
  104.     binding, but discourages you from doing so.
  105.  
  106.     In many ways, the difference between C++ and Objective-C is more a
  107.     question of mindset than technical barriers.  Are you willing to offer
  108.     some flexibility for some safety?  Advocates for the Simula 67 school
  109.     claims that a well designed program doesn't need the extra flexibility
  110.     (a lie), while advocates for the Smalltalk school claims that the errors
  111.     are no problem in practice (another lie).
  112.  
  113.     Pragmatic differences between Objective-C and C++ include:
  114.  
  115.     C++ has operator overloading.  Some consider this to be `syntactic
  116.     sugar', and it is, but it can be a quite handy bit of sugar.
  117.  
  118.     C++ has multiple inheritance.  There are several ways to `get
  119.     around' this in Objective-C (see below).
  120.  
  121.     The added syntax and semantics of C++ is huge, while Objective-C is
  122.     C plus just a small number of new features.
  123.  
  124. 4   What exactly is it that makes Objective-C have `classes similar to
  125.     Smalltalk', and what are the resulting capabilities of Objective-C?
  126.  
  127.     Objective-C is as close to Smalltalk as a compiled language allows.  The
  128.     following is a list of the features `taken' from Smalltalk:
  129.  
  130.       * Objective-C is compiled---Smalltalk is only partially compiled.  The
  131.     current Objective-C implementations are all *much* faster than any
  132.     Smalltalk.  For example ParcPlace Smalltalk-80/4 is at least 3 times
  133.     slower than both the GNU and NeXT Objective-C's.  (This was measured
  134.     using the Self/Smalltalk benchmark suite available by FTP from
  135.     `self.stanford.edu:pub/Self-2.0.1'.)
  136.  
  137.       * You may add or delete methods and classes at runtime.  (This is done
  138.     via dynamic loading of object code.  This is currently supported by
  139.     both NeXT and Stepstone Compilers [?].)
  140.  
  141.       * Much of the syntax, i.e. Smalltalk uses method names like
  142.     `a:method:name:', as does Objective-C.  In Objective-C, the message
  143.     sending construct is enclosed in square brackets, like this:
  144.     `[anObject aMessage: arg]' whereas Smalltalk uses something like
  145.     `anObject aMessage: arg'.
  146.  
  147.       * The basic class hierarchy, that is, having class `Object' in the very
  148.     top, and letting most other classes inherit from it.
  149.  
  150.       * Most method names in class object is the same.  E.g. `respondsTo:'.
  151.     What is called `doesNotUnderstand:' in Smalltalk is called
  152.     `doesNotRecognize:' in Objective-C.
  153.  
  154.       * Smalltalk normally uses `doesNotUnderstand:' to implement
  155.     forwarding, delegation, proxies etc.  In Objective-C, these tasks
  156.     are different:
  157.  
  158.         forwarding/delegation: `forward::' can be overridden to
  159.         implement forwarding.  On the NeXT, `forward::' is even used
  160.         when passing to super.
  161.  
  162.         proxies: (Next) An instance of the NXProxy class forwards all
  163.         methods and their arguments to the remote object via Mach
  164.         messages.
  165.  
  166.       * Objective-C has meta classes mostly like Smalltalk.
  167.  
  168.       * Objective-C does not have class variables like Smalltalk, but pool
  169.     variables and globals are easily emulated via static variables.
  170.  
  171. 5   What are the `nice features' of Objective-C?
  172.  
  173.     The possibility to load class definitions and method definitions
  174.     (which extend a class) at run time.
  175.  
  176.     Objects are dynamically typed: Typing information is available at
  177.     run time.  A prime example of this is NeXTSTEP's `-[Application
  178.     loadNibSection:owner:]'
  179.  
  180.     Persistence [...].
  181.  
  182.     Remote objects [...].
  183.  
  184.     Delegation and target/action protocols [...].
  185.  
  186. 6   What are some of the common problems of the language and how can I work
  187.     around them?
  188.  
  189.     There are some `common problems':
  190.  
  191.     There is no innate multiple inheritance (of course some see this as
  192.     a benefit).
  193.  
  194.         To get around it you can create a compound class, i.e. a class
  195.         with instance variables that are ids of other objects.
  196.         Instances can specifically redirect messages to any combination
  197.         of the objects they are compounded of.  (It isn't *that* much of
  198.         a hassle and you have direct control over the inheritance
  199.         logistics.)  [Of course, this is not `getting around the problem
  200.         of not having multiple inheritance', but just modeling your
  201.         world slightly different in such a way that you don't need
  202.         multiple inheritance.]
  203.  
  204.         Protocols address the absence of multiple inheritance (MI) to
  205.         some extent: Technically, protocols are equivalent to MI for
  206.         purely "abstract" classes (see the answer on `Protocols' below).
  207.  
  208.         [How does Delegation fit in here?  Delegation is extending a
  209.         class' functionality in a way anticipated by the designer of
  210.         that class, without the need for subclassing.  One can, of
  211.         course, be the delegate of several objects of different
  212.         classes.  ]
  213.  
  214.     There are no class variables.
  215.  
  216.         You can get around this by defining a static variable in the
  217.         implementation file, and defining access methods for it.  This
  218.         is actually a more desirable way of designing a class hierarchy,
  219.         because subclasses shouldn't access superclass storage (this
  220.         would cause the subclass to break if the superclass was
  221.         reimplemented), and allows the subclass to override the storage
  222.         (if the classes access all their own variables via methods).
  223.  
  224.         [The question remains what the exact syntax of class variables
  225.         should be: Should a class object A be seen as an instance of its
  226.         meta-class MA, which has a super class MB being the meta-class
  227.         of A's super, B, and, as such, should A have seperate instances
  228.         of class variables defined for B?  Or not?]
  229.  
  230. 7   What are Protocols?
  231.  
  232.     Protocols are an addition to Objective-C that allows you to organize
  233.     related methods into groups that form high-level behaviors.  Protocols
  234.     are currently available in NeXTSTEP (since 3.0) and GCC (since 2.4).
  235.  
  236.     Protocols address the MI issue.  When you design an object with multiple
  237.     inheritance, you usually don't want *all* the features of both A and B,
  238.     you want feature set X from A and feature set Y from B.  If those
  239.     features are methods, then encapsulating X and Y in protocols allows you
  240.     to say exactly what you want in your new object.  Furthermore, if
  241.     someone changes objects A or B, that doesn't break your protocols or
  242.     your new object.  This does not address the question of new instance
  243.     variables from A or B, only methods.
  244.  
  245.     Protocols allow you to get type-checking features without sacrificing
  246.     dynamic binding.  You can say "any object which implements the messages
  247.     in Protocol Foo is OK for this use", which is usually what you want -
  248.     you're constraining the functionality, not the implementation or the
  249.     inheritance.
  250.  
  251.     Protocols give library builders a tool to identify sets of standard
  252.     protocols, independent of the class hierarchy.  Protocols provide
  253.     language support for the reuse of design, whereas classes support the
  254.     reuse of code.  Well designed protocols can help users of an application
  255.     framework when learning or designing new classes.  Here is a simple
  256.     protocol definition for archiving objects:
  257.  
  258.     @protocol Archiving
  259.     -read: (Stream *) stream;
  260.     -write: (Stream *) stream;
  261.     @end
  262.  
  263.     Once defined, protocols can be referenced in a class interface as
  264.     follows:
  265.  
  266.     /* MyClass inherits from Object and conforms to the
  267.        Archiving protocol.  */
  268.     @interface MyClass: Object <Archiving>
  269.     @end
  270.  
  271.     Unlike copying methods to/from other class interfaces, any incompatible
  272.     change made to the protocol will immediately be recognized by the
  273.     compiler (the next time the class is compiled).  Protocols also provide
  274.     better type checking without compromising the flexibility of untyped,
  275.     dynamically bound objects.
  276.  
  277.     MyClass *obj1 = [MyClass new];
  278.  
  279.     // OK: obj1 conforms to the Archiving protocol.
  280.     id <Archiving> obj2 = obj1;
  281.  
  282.     // Error: obj1 does not conform to the TargetAction protocol.
  283.     id <TargetAction> obj3 = obj1;
  284.  
  285.     Another use of protocols is that you can declare an ID to conform to
  286.     some protocol in order to help the compiler to resolve method name
  287.     conflicts:
  288.  
  289.     @interface Foo: Object
  290.     -(int) type;
  291.     @end
  292.  
  293.     @protocol Bar
  294.     -(const char *) type;
  295.     @end
  296.  
  297.     -blah1: d
  298.     {
  299.       id t = [d someMethod];
  300.       do_something_with ([t type]);
  301.     }
  302.  
  303.     -blah2: d
  304.     {
  305.       id <Bar> t = [d someMethod];
  306.       do_something_with ([t type]);
  307.     }
  308.  
  309.     In this example, there are two kinds of the `-type' method.  In the
  310.     method `-blah1:', the compiler doesn't know what return type to expect
  311.     from `[t type]', since it has seen both declarations of `-type'.  In
  312.     method `-blah2:', it knows that `t' conforms to the `Bar' protocol and
  313.     thus that `t' implements the `-type' method returning a `const char *'.
  314.  
  315. 8   What is the difference between the NeXTSTEP, Stepstone and GNU CC
  316.     versions of Objective-C?
  317.  
  318.     NeXT extended Stepstone's definition of the language to include new
  319.     constructs, such as protocols, which are touted to deal with some
  320.     aspects of multiple inheritance.
  321.  
  322.     Stepstone supports static _binding_, whereas NeXTSTEP and GNU CC don't.
  323.     All implementations do support static _typing_.
  324.  
  325.     Stepstone has a standard set of Foundation class libraries that work
  326.     across all supported machines, including NeXTSTEP.  NEXTSTEP comes with
  327.     its own set of libraries (called `kits').  GNU libobjc.a currently only
  328.     includes the `Object' class, though people are busy on a Real library
  329.     (see part two of this FAQ (The ClassWare Listing) for details).
  330.  
  331.     The `Object' class of all implementations differ.
  332.  
  333.     NeXTSTEP and GNU CC support Categories, Stepstone doesn't.
  334.  
  335.     NeXT has a native language debugger, Stepstone and GNU don't.  [This is
  336.     not really true, since NeXT's debugger is gdb, the GNU debugger, and
  337.     their extensions are available.  I think I've seen them on the Fall 1992
  338.     Edu CD.  Their extensions haven't appeared in the official FSF
  339.     distribution yet.]
  340.  
  341.     NeXTSTEP (from version 3.0) and GCC (from version 2.4) support protocols
  342.     and forward declarations of classes, Stepstone currently does not.
  343.  
  344. 9   What written information concerning Objective-C is available?
  345.  
  346.     Books:
  347.  
  348.     Brad J. Cox, Andrew J. Novobilski: Object Oriented Programming: An
  349.     Evolutionary Approach.  Addison-Wesley Publishing Company, Reading,
  350.     Massachusetts, 1991.  ISBN: 0-201-54834-8.
  351.  
  352.     abstract:    The first book on Objective-C.
  353.  
  354.  
  355.  
  356.     Lewis J. Pinson, Richard S. Wiener: Objective-C: Object Oriented
  357.     Programming Techniques.  Addison-Wesley Publishing Company, Reading,
  358.     Massachusetts, 1991. ISBN 0-201-50828-1.
  359.  
  360.     abstract:       Includes many examples, discusses both Stepstone's
  361.                     and NeXT's versions of Objective-C, and the
  362.                     differences between the two.
  363.  
  364.  
  365.     Timothy Budd: An Introduction to Object-Oriented Programming.
  366.     Addison-Wesley Publishing Company, Reading, Massachusetts.
  367.     ISBN 0-201-54709-0.
  368.  
  369.     abstract:       An intro to the topic of OOP, as well as a comparison
  370.                     of C++, Objective-C, Smalltalk, and Object Pascal
  371.  
  372.  
  373.     Simson L. Garfinkel, Michael K. Mahoney: NeXTSTEP Programming Step
  374.     ONE: Object-Oriented Applications.  TELOS/Springer-Verlag, 1993
  375.     (tel: (800)SPR-INGE).
  376.  
  377.     abstract:       It's updated to discuss NeXTSTEP 3.0 features
  378.                     (Project Builder, new development environment)
  379.                     but doesn't discuss 3DKit or DBKit.
  380.  
  381.  
  382.     NeXTSTEP Object Oriented Programming and the Objective C Language.
  383.     Addison-Wesley Publishing Company, Reading, Massachusetts, 1993.
  384.     ISBN 0-201-63251-9.
  385.  
  386.     abstract:     This book describes the Objective-C language as it
  387.             is implemented for NeXTSTEP.  While clearly targeted
  388.             at NeXTSTEP, it is a good first-read to get to learn
  389.             Objective-C.
  390.  
  391.     Articles
  392.  
  393.     `Why I need Objective-C', by Christopher Lozinski.
  394.     Journal of Object-Oriented Programming (JOOP) September 1991.
  395.  
  396.     Abstract:    This article discusses the differences between C++
  397.             and Objective-C in great detail and explains why
  398.             Objective-C is a better object oriented language.
  399.  
  400.     `Concurrent Object-Oriented C (cooC)', by Rajiv Trehan et. al.
  401.     ACM SIGPLAN Notices, Vol. 28, No 2, February 1993.
  402.  
  403.     Abstract:    This article discusses cooC, a language based on the
  404.             premise that an object not only provides an
  405.             encapsulation boundary but should also form a
  406.             process boundary.  cooC is a superset of
  407.             Objective-C.
  408.  
  409.     `Porting NEXTSTEP Applications to Microsoft Windows',
  410.     by Christopher Lozinski.  NEXTWORLD EXPO Conference Proceedings,
  411.     San Francisco, CA, May 25-27, 1993.  Updated version of the article
  412.     available from the author.  Contact lozinski@cup.portal.com
  413.  
  414.     Abstract:    This article describes how to develop Objective-C
  415.             applications for both Microsoft Windows and
  416.             NEXTSTEP.
  417.  
  418.     GNU Documentation
  419.  
  420.     The GNU project needs a free manual describing the Objective-C
  421.     language features.  Because of its cause, GNU cannot include the
  422.     non-free books in the GNU system, but the system needs to come with
  423.     documentation.
  424.  
  425.     Anyone who can write good documentation, please think about giving
  426.     it to the GNU project.  Contact rms@gnu.ai.mit.edu.
  427.  
  428. 10  What kind of Objective-C support is provided by Stepstone?
  429.  
  430.     Compilers and runtime for: Apple Macintosh (running Mac Programmers
  431.     Workshop), DEC Stations (ULTRIX), Data General AViiON (DG/UX),
  432.     HP9000/300,400,700,800 (HP-UX), IBM RISC System/6000 (AIX), MIPS,
  433.     NeXT, PC-AT (MS-DOS), PS/2 (AIX or OS/2), SCO/NCR UNIX SYS V, Sun 3, 4,
  434.     SPARCstations (SunOS or Solaris), Silicon Graphics INDIGO and VAX(VMS).
  435.     Other ports available by market demands or consulting services.
  436.  
  437.     ICpak101 Foundation Class Library is avaliable on all the above.
  438.     ICpak201 GUI Class Library is available on platforms that support
  439.     XWindows, Motif, OpenWindows and SunView.
  440.  
  441.        The Stepstone Corporation
  442.     (203) 426-1875 - (800) BUY-OBJEct voice / (203) 270-0106 fax
  443.     75 Glen Road
  444.     Sandy Hook, CT 06482
  445.  
  446. 11  What kind of Objective-C support is provided by NeXT?
  447.  
  448.     The Objective-C compiler and libraries come bundled with the
  449.     NEXTSTEP Developer CD.  The compiler essentially is GNU CC.  For
  450.     information on the Kits which are part of NEXTSTEP, see the
  451.     ClassWare Listing (part 2 of this FAQ).
  452.  
  453.     Products are:
  454.  
  455.         NEXTSTEP 3.1 for NeXT or Intel Computers
  456.  
  457.         ObjectWare Catalogue (lists available classes, both commercial
  458.         and those freely available).
  459.  
  460.     NeXT Computer, Inc.
  461.     900 Chesapeake Drive
  462.     Redwood City, CA 94063
  463.     tel: 800 848 NEXT
  464.     fax: 415 780 2801
  465.     email: NeXTanswers@NeXT.COM
  466.  
  467. 12  What kind of Objective-C support is provided by GNU?
  468.  
  469.     GNU CC, since version 2, comes with an Objective-C compiler.  The
  470.     current distribution of GNU CC (version 2.5.0) includes an Objective-C
  471.     compiler and runtime library.  The latter includes the `Object' class.
  472.     Some people are working on GNU libraries, see part two of this FAQ (The
  473.     ClassWare Listing) for details.
  474.  
  475.     If you haven't switched to a GNU CC as recent as 2.4 yet, here's one
  476.     reason to do so: The new runtime (as of 2.4) is more than 3 times as
  477.     fast as the old runtime (pre 2.4) w.r.t. method invocation.
  478.  
  479.     Free Software Foundation
  480.     675 Massachusetts Avenue
  481.     Cambridge, MA  02139
  482.     +1-617-876-3296
  483.  
  484.     General questions about the GNU Project can be asked to
  485.     gnu@prep.ai.mit.edu.
  486.  
  487.     GNU CC comes with an Objective-C compiler and runtime library which
  488.     includes the Object class.
  489.  
  490.     For information on how to order GNU software on tape, floppy or
  491.     cd-rom, check the file etc/DISTRIB in the GNU Emacs distribution, or
  492.     e-mail a request to: gnu@prep.ai.mit.edu
  493.  
  494.     GNU software is available from the following sites:
  495.  
  496.         Asia: utsun.s.u-tokyo.ac.jp:/ftpsync/prep,
  497.           ftp.cs.titech.ac.jp, cair.kaist.ac.kr:/pub/gnu
  498.         Australia: archie.oz.au:/gnu
  499.         Europe: ftp.informatik.tu-muenchen.de,
  500.           src.doc.ic.ac.uk:/gnu, nic.funet.fi:/pub/gnu,
  501.           ugle.unit.no, isy.liu.se, nic.switch.ch:/mirror/gnu,
  502.           archive.eu.net, ftp.informatik.rwth-aachen.de:/pub/gnu,
  503.           ftp.stacken.kth.se, ftp.win.tue.nl, ftp.denet.dk,
  504.           ftp.eunet.ch, irisa.irisa.fr:/pub/gnu
  505.         United States: wuarchive.wustl.edu, ftp.cs.widener.edu,
  506.           uxc.cso.uiuc.edu, col.hp.com:/mirrors/gnu,
  507.           gatekeeper.dec.com:/pub/GNU, ftp.uu.net:/systems/gnu
  508.  
  509. 13  What kind of Objective-C support is provided by BPG.
  510.  
  511.     BPG provides the Borland Extensions to Objective-C which allows the
  512.     Objective-C translator to be used with the Borland Compiler, and makes
  513.     it easy to develop Objective-C application for Microsoft Windows.
  514.  
  515.     BPG provides the Smalltalk Interface to Objective-C which makes
  516.     Objective-C objects look like Smalltalk Objects.  It can be used to
  517.     build Graphical User Interface on portable Objective-C objects, or to
  518.     sell Objective-C libraries to Smalltalk developers.
  519.  
  520.     BPG provides the Objective-C Message Bus which sends Objective-C messages
  521.     across heterogeneous computer platforms.
  522.  
  523.     BPG has a library of objects for modelling Objective-C programs.  A browser
  524.     application has been built on this library.  Other potential applications
  525.     include adding class variables to Objective-C, adding runtime information
  526.     about instance variables, and method argument types, generating object
  527.     versions, and eventually building a browser/translator.
  528.  
  529.     Christopher Lozinski
  530.     BPG
  531.     35032 Maidstone Court
  532.     Newark, CA 94560
  533.     Tel: (510) 795-6086
  534.     fax: (510) 795-8077
  535.     email: lozinski@cup.portal.com
  536.  
  537. 14  What are the newsgroups to read or mailing lists to subscribe to in order
  538.     to stay up-to-date on developments for GNU Objective-C?
  539.  
  540.     Read comp.lang.objective-c, which is bound to discuss current events.
  541.     There is also a mailing list, gnu-objc@gnu.ai.mit.edu, discussing this
  542.     very topic.  To subscribe to this list, send a mail with your request to
  543.     `gnu-objc-request@gnu.ai.mit.edu.'
  544.  
  545. 15  Are there any FTP sites with Objective C code?  Where?
  546.  
  547.     NeXTSTEP sites:
  548.     sonata.cc.purdue.edu    128.210.15.30
  549.     cs.orst.edu        128.193.32.1
  550.     ftp.stack.urc.tue.nl    131.155.2.71
  551.     ccrma-ftp.stanford.edu    36.49.0.93    (MusicKit)
  552.  
  553.     See also part 2 of this FAQ.
  554.  
  555. 16  What class libraries are available for Objective C?
  556.  
  557.     See the related FAQ file Objective-C/classes.
  558.  
  559. 17  So show me a program, a simple example.
  560.  
  561.     See the related FAQ file Objective-C/sample.
  562.  
  563. 18  How can garbage collection be applied to Objective-C?
  564.  
  565.     Currently, there are two implementations of garbage collection which can
  566.     be used in Objective-C programs [that I'm aware of].  Both methods use a
  567.     radically different approach.
  568.  
  569.     Garbage Collection in an Uncooperative Environment
  570.  
  571.         This implements garbage collection of chunks of memory obtained
  572.         through (its replacement of) malloc(3).  It works for C, C++,
  573.         Objective-C, etc.
  574.  
  575.         @article{bw88,
  576.         title="Garbage Collection in an Uncooperative Environment",
  577.         author="Hans J\"urgen Boehm and Mark Weiser",
  578.         journal="Software Practice and Experience",
  579.         pages=807-820,volume=18,number=9,month=sep,year=1988}
  580.  
  581.         Available as `iesd.auc.dk:/pub/ObjC/gc3.0.tar.z'.
  582.  
  583.     Garbage Collection through Class Abstraction
  584.  
  585.         This implements garbage collection through class abstraction
  586.         (and hence is Objective-C specific).  Anything to be garbage
  587.         collectible must be an object (instance of a subclass of a
  588.         specific class) or have such an object for a wrapper.
  589.  
  590.         Available as `ftp.es.ele.tue.nl:/pub/tiggr/tobjc.tar.gz'
  591.  
  592.     Apart from the obvious radical difference, another difference currently
  593.     is also noteworthy: The first method automatically protects objects
  594.     pointed to from the stack, bss or data segments; the second doesn't.
  595.  
  596. 19  What object encapsulation does Objective-C provide?
  597.  
  598.     Object encapsulation can be discerned at two levels: encapsulation of
  599.     instance variables and of methods.  In Objective-C, the two are quite
  600.     different.
  601.  
  602.     Instance variables:
  603.  
  604.     The keywords @public, @private and @protected are provided to secure
  605.     instance variables from prying eyes to some extent.
  606.  
  607.         @public        anyone can access any instance variable.
  608.         @private    only methods belonging to this object's
  609.                 class or a subclass thereof have access to
  610.                 the instance variables.
  611.         @protected    only methods of this class may access the
  612.                 instance variables.  This excludes methods
  613.                 of a subclass.
  614.  
  615.     If not explicitly set, all instance variables are @private.  (Note
  616.     that full typing information is available through the runtime,
  617.     making all variables @public again.  However, this does solve the
  618.     problem of instance variables moving in an object because of
  619.     recompilation.  Such instance variable lookup is performed on
  620.     NeXTSTEP by the `loadNibSection...' methods, making it completely
  621.     safe.)
  622.  
  623.     Methods:
  624.  
  625.     To the Objective-C runtime, all methods are @public.  The programmer
  626.     can only show his/her intention of making specific methods not
  627.     public by not advertising them in the class' interface.  In
  628.     addition, so-called private methods can be put in a category with a
  629.     special name, like `secret' or `private'.
  630.  
  631.     However, these tricks do not help much if the method is declared
  632.     elsewhere, unless one reverts to indicating the object's type at
  633.     compile time.  And the runtime doesn't care about all this and any
  634.     programmer can easily circumvent the tricks described.  Thus, all
  635.     methods really are always @public.
  636.  
  637. The early version of this FAQ was compiled by Bill Shirley, with the aid of
  638. many people.  The current version is being maintained by Tiggr, aided by a
  639. lot of people, including: Per Abrahamsen, Paul Burchard, Brad Cox,
  640. Christopher Lozinski, Mike Mahoney, Paul Sanchez, Lee Sailer, Bill Shirley,
  641. Subrata Sircar, Ted Slupesky, Richard Stallman and Kersten Krab Thorup,
  642.  
  643. Any text in between `[' and `]' is a comment.  Comments indicate `problems'
  644. with this FAQ, which should be solved.  Send your suggestions, additions,
  645. bug reports, comments and fixes to `tiggr@es.ele.tue.nl'.
  646.  
  647.     The information in this file comes AS IS, WITHOUT ANY WARRANTY.  You may
  648.     use the information contained in this file or distribute this file, as
  649.     long as you do not modify it, make money out of it or take the credits.
  650.