[phobos] Proposal of StopWatch module

Andrei Alexandrescu andrei at erdani.com
Fri Aug 20 14:05:23 PDT 2010


That's fine because UpperCamel is a user-defined type, even if it's just 
an enum.

If you grep std/ for "enum", you'll see that the vast majority of enums 
have type LikeThis and value likeThis.

As use of constants is very widespread in D compared to other languages 
(due to extensive static processing), having all caps names all over the 
place could become annoying.


Andrei

On 08/20/2010 03:36 PM, SHOO wrote:
> (2010/08/21 4:06), Andrei Alexandrescu wrote:
>> On 08/20/2010 02:00 PM, SHOO wrote:
>>> (2010/08/20 19:35), SHOO wrote:
>>>> I rewrote:
>>>> http://ideone.com/5IgYU
>>>> How about it?
>>>>
>>>> P.S. I used an immutable struct for the first time...
>>>
>>> Oops, I forgot AUTOSTART.
>>> http://ideone.com/GiVmf
>>> AutoStart.yes seems to be slightly redundant.
>>> How about making a special type AutoStart with typedef and a AUTOSTART
>>> with constant value(enum)?
>>> See also: Line415, Line469, Line474-487
>>
>> About the general usefulness of
>>
>> enum SomeOption { no, yes }
>>
>> I suggest we ask the newsgroup. Phobos uses it a fair amount and I
>> haven't heard complaints. I think the basic idiom is a net improvement
>> over bool, but I agree that AutoStart.yes is a bit redundant. But then
>> the solution would be to define a constant like AutoStart and then a
>> constant like NoAutoStart. We're back to square one.
>>
>> At any rate, please no all-caps constants :o).
>>
>>
>> Andrei
>
> All right. I guess that's a way as well... But, does not UpperCamel look
> like a user-defined type name?
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list