CURL review request

David Nadlinger see at klickverbot.at
Wed Aug 31 19:29:55 PDT 2011


On 8/25/11 8:53 AM, Jacob Carlborg wrote:
> On 2011-08-24 20:36, jdrewsen wrote:
>>
>> One way that may improve this would be to move the static methods
>> outside the class and make them into module functions instead.
>>
>> The drawbacks of this is:
>>
>> 1, When importing the module there would be more symbols polluting the
>> namespace.
>>
>> […]
> You could wrap the free functions in a Curl struct:
>
> Curl.get(...);
>

Please don't (ab)use classes/structs as namespace if you don't have a 
really good reason to do so – D offers static and/or selective imports 
for situation where one doesn't want to pollute the scope when importing 
something. When using free functions, one can always do »static import 
etc.curl;«, but there is no way back once a dummy struct is used (well, 
technically I think it would be possible to write a mixin template that 
aliases all struct members into the local scope, but…).

David


More information about the Digitalmars-d mailing list