[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automatic method generator - prototype (Was: Re: Interface parser)
From: |
Mikko Värri |
Subject: |
Re: Automatic method generator - prototype (Was: Re: Interface parser) |
Date: |
Tue, 27 Jul 2004 09:46:10 +0200 |
On Tue, 27 Jul 2004 08:52:14 +0200, stefan wrote
>
> Citát Mikko Värri <mikko.varri@iglu.net>:
>
> > Using the word 'public' is imho misleading. Typically the 'public' keyword
> > means that the variable is accessible directly, not through accessor
> > methods.
> >
>
> I have moved meaning of that word a bit forward. Nowdays large
> majority of developers does not use direct access to instance
> variables of ObjectiveC objects, they use accessor methods.
> Therefore saying that some instance variable is 'public' means, that
> developer can change it - sense remained. What was shifted was the
> "implementation" of accessing. From direct access to access through methods.
>
My knowledge was based on my copy of 'Objective-C Programming Language' (from
Feb 2003). On page 208 (section Appendix A - Compiler Directives) it says:
"@public: Removes restrictions on the scope of instance variables".
This has the same meaning at least in Java and C++, which is why *I think* it
shouldn't be used for other purposes (see below.)
> > Using '/**' and '*/' as delimiters may conflict with those used for
> > documentation.
> >
>
> I reused the AGSParser, which is GNUstep documentation tool. I have
> made no modifications to it, just used comments for getting
> additional information about ivars, as there is no other way to add it.
>
Ok.
> > Given that developers are lazy to document their source and often headers
> > are
> > a good place to start studying undocumented software, missing method
> > declarations and misleading keyword choices do not help this situation.
> >
>
> I do not understand what do you mean by this. If you mean that in
> the .h file that was posted as an example were no method
> declarations, that was intentional, because they were not needed to
> show the ability generator :-)
>
That's what I was talking about. I thought that the example was to show how
the tool was to be used (in reality).
> Concerning "misleading keyword choices" I am open for any better
> suggestions.
By "keyword choices" I was referring to use of @public. Sorry for not being
clear.
> Later yesterday I changed the keywords to: public, noarchive,
> readonly and object.
>
Umm, so the meaning of the keywords 'public' and 'readonly' is now something
in lines of:
- public: getter and setter methods generated.
- readonly: only getter method generated.
Right? If so, if one of them is default, is it even needed? (Like
noarchive/archive.)
Anyway, I don't really mind what keyword are used in the comments. My main
concern is about the use of @public compiler directive (I'd suggest to use a
keyword inside comments for that functionality too).
> > All in all, personally I would prefer people used a macro-based solution
> > (discussed before on the list) which would at least be obvious to a casual
> > reader.
>
> Excuse me but I do not agree with this. Maco-based solution solves
> nothing, as there is no way how to work with lists in C macros. For
> example, you change a variable name and you have to change it in 1
> dealloc + 2 accessors + 2 encodings + 1 interface = 6 places. Same
> for addition/removal of the variable. With plain attributing of an
> instance variable, you just change the name once.
>
> I'll stay with attributing ivars somewhere in @interface - i think
> that it belongs there and moreover it is more comfortable ;-)
>
Ok, I don't want to argue about this :) Previous thread on the subject was far
too long :)