[phobos] Proposal of StopWatch module

Andrei Alexandrescu andrei at erdani.com
Thu Aug 19 08:29:30 PDT 2010


On 08/19/2010 08:38 AM, SHOO wrote:
> (2010/08/19 2:38), Jonathan M Davis wrote:
>> On Wednesday, August 18, 2010 10:21:56 SHOO wrote:
>>>> Line 414: no need for @trusted, casting numbers is not unsafe.
>>>
>>> Error: cast from const(long) to real not allowed in safe code
>>
>> Maybe to!long will work.
>>
>
> But, to!real(long) is system function unfortunately.

I think we should change that to @trusted and file a bug that explicit 
cast from real to long is @safe.

> What is the reason why all types must have .init property?
> I think that structs may not need to have .init property.

The reason is that important primitives such as swap() and move() must 
make sure there exists an "empty" state for all values.

> ... However, I think that this is a very sensitive problem ATST.
>
> In the first place, should we use class keyword for the classes(of OOP)?
> Although there is scope class which seems to satisfy these demands, it
> does not function well.
> Isn't improving scope more strongly better than marking scope deprecated?

I agree. The problem is that improving scope in any interesting way is 
next to impossible without interprocedural analysis, which has many 
disadvantages. Therefore I think scope has no chance but deprecation, 
and that we definitely shouldn't design library elements that require or 
recommend it.


Andrei


More information about the phobos mailing list