Re: Public API method naming for NSString * / const char * parameters
Re: Public API method naming for NSString * / const char * parameters
- Subject: Re: Public API method naming for NSString * / const char * parameters
- From: Roland King <email@hidden>
- Date: Mon, 03 Mar 2014 22:59:02 +0800
I would say that adding UTF8 to the method names implies that the framework expects UTF8, if that's true, that's a good method name.
If you want to support other encodings then a method name which takes a char* and an encoding would be better, still including a UTF8 version which just calls the char*+encoding version with a fixed UTF8 encoding.
I would say that in this encoding-enlightened day and age
+(XX)xxWithName:(char*)name;
is lacking. If that name is meant to be UTF-8, say so, it's a few extra characters.
On 3 Mar, 2014, at 10:37 pm, email@hidden wrote:
> I am pondering the following framework public API method signatures.
>
> The API requires a mixture of const char* and NSString * parameters.
>
> The question is whether to precede const char * parameter names with UTF8 e.g.:
>
> + (MonoClass *)monoClassWithName:(char *)className fromAssemblyName:(const char *)assemblyName;
>
> becomes
>
> + (MonoClass *)monoClassWithUTF8Name:(char *)className fromAssemblyUTF8Name:(const char *)assemblyName;
>
> I have doubts in case that NSString * convenience variants become desirable in the future.
>
> Just wondering how others have approached this.
>
> ===
>
> + (MonoClass *)monoClassWithName:(char *)className fromAssemblyName:(const char *)assemblyName;
> - (MonoClass *)monoClassWithName:(char *)className fromAssemblyName:(const char *)name;
> + (MonoClass *)monoClassWithName:(char *)className fromAssembly:(MonoAssembly *)assembly;
> + (MonoClass *)corlibMonoClassWithName:(char *)className;
>
> + (MonoClass *)dubrovnikMonoClassWithName:(char *)className;
> + (MonoMethod *)dubrovnikMonoMethodWithName:(char *)methodName className:(char *)className argCount:(int)argCount;
>
> - (MonoAssembly *)loadedAssemblyWithName:(const char *)name;
> - (MonoAssembly *)loadedAssembly:(NSString *)name;
>
> - (MonoAssembly *)openAssemblyWithName:(const char *)name;
> - (MonoAssembly *)openAssemblyWithPath:(NSString *)assemblyPath;
> - (MonoAssembly *)openAssembly:(NSString *)name path:(NSString *)assemblyPath;
> - (MonoAssembly *)openAssemblyWithName:(const char *)name path:(NSString *)path;
>
> Jonathan
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden