time measurement under linux?

2009-01-19 Thread Trass3r
I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli- or nanoseconds under linux? Want to make it portable :) module time; version(Windows) import std.c.windows.windows; long frequency; /// frequency of the high

Re: loop through specific class members

2009-01-19 Thread Daniel Keep
Trass3r wrote: Is there any way to loop through specific members of a class, e.g. all public functions? I've already seen a function getMembers in druntime's ClassInfo class but I can't find anything related to the attributes there. Assuming you're using D2,

Re: time measurement under linux?

2009-01-19 Thread Daniel Keep
Trass3r wrote: I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli- or nanoseconds under linux? Want to make it portable :) [snip] Check std.perf; it's documented, but sadly doesn't show up in the docs. -- Daniel

Re: loop through specific class members

2009-01-19 Thread Trass3r
Daniel Keep schrieb: Assuming you're using D2, http://digitalmars.com/d/2.0/traits.html might prove to be of interest. -- Daniel It is indeed of interest though being not exactly what I want. Seems like there's currently no way to get attributes like public etc. But I think an acceptable

Re: loop through specific class members

2009-01-19 Thread Lutger
Trass3r wrote: Daniel Keep schrieb: Assuming you're using D2, http://digitalmars.com/d/2.0/traits.html might prove to be of interest. -- Daniel It is indeed of interest though being not exactly what I want. Seems like there's currently no way to get attributes like public etc. But

Re: IndexExpression

2009-01-19 Thread Jarrett Billingsley
On Mon, Jan 19, 2009 at 12:57 PM, Ellery Newcomer ellery-newco...@utulsa.edu wrote: IndexExpression: PostfixExpression [ ArgumentList ] The only place I can think of ArgumentList containing more than one element is in some sort of overloaded operator case. You're precisely right.

Re: Delegate contravariance

2009-01-19 Thread Jason House
Silvio Ricardo Cordeiro wrote: Is there any good reason why the following code doesn't work? The function foo requires as its argument a delegate that receives a B. This means that, because of the type soundness of the D language, the delegate will only be called with instances of B. Now,

Re: druntime

2009-01-19 Thread Jason House
Steven Schveighoffer wrote: Hoenir wrote So why don't they port tango to that D1 version of druntime? What is the need? I can only think of one reason: When porting Tango to D2, it'll be one less thing to do.

Re: base class access specifier[s]

2009-01-19 Thread BCS
Reply to Ellery, I don't buy that. Not that I'm a C guru or anything, but it looks to me that Parser::BaseClasses could be easily edited to make the point in question go away. it's not a parser thing but a grammar thing. It would be complex to define a grammar that allows one each of the

Re: time measurement under linux?

2009-01-19 Thread Bill Baxter
On Tue, Jan 20, 2009 at 2:19 AM, Trass3r mrmoc...@gmx.de wrote: Daniel Keep schrieb: Check std.perf; it's documented, but sadly doesn't show up in the docs. -- Daniel Cool, is similar to my design. Though GetTickCount64 could be added. That's odd. I made some updates to std.perf a while

Re: loop through specific class members

2009-01-19 Thread BCS
Reply to Lutger, Another possible hack: if used from a different module, you could use the 'compiles' trait with allMembers to find out if a member can be accessed. you could define a template in another module that does the check and returns the result.

Re: time measurement under linux?

2009-01-19 Thread Jarrett Billingsley
On Mon, Jan 19, 2009 at 1:46 PM, Jason House jason.james.ho...@gmail.com wrote: Trass3r wrote: I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli- or nanoseconds under linux? Want to make it portable :) The difficulty of doing platform

Re: loop through specific class members

2009-01-19 Thread Trass3r
BCS schrieb: Reply to Lutger, Another possible hack: if used from a different module, you could use the 'compiles' trait with allMembers to find out if a member can be accessed. you could define a template in another module that does the check and returns the result. Well, it'd indeed

Re: time measurement under linux?

2009-01-19 Thread Bill Baxter
On Tue, Jan 20, 2009 at 4:47 AM, Jarrett Billingsley jarrett.billings...@gmail.com wrote: On Mon, Jan 19, 2009 at 1:46 PM, Jason House jason.james.ho...@gmail.com wrote: Trass3r wrote: I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli- or

Re: time measurement under linux?

2009-01-19 Thread Trass3r
Jarrett Billingsley schrieb: On Mon, Jan 19, 2009 at 10:41 AM, Daniel Keep daniel.keep.li...@gmail.com wrote: Trass3r wrote: I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli- or nanoseconds under linux? Want to make it portable :) [snip]

Re: loop through specific class members

2009-01-19 Thread BCS
Reply to Daniel, It depends on what exactly you're trying to do. Some time ago, I wrote a library that created XML loaders for structs, and it needed to know the names of fields. Pre-traits, this is what I used: struct Stuff { int foo; char[] bar; alias Tuple!(foo, bar) _fields; } Then I

Re: time measurement under linux?

2009-01-19 Thread Bill Baxter
On Tue, Jan 20, 2009 at 6:04 AM, Trass3r mrmoc...@gmx.de wrote: Jarrett Billingsley schrieb: On Mon, Jan 19, 2009 at 10:41 AM, Daniel Keep daniel.keep.li...@gmail.com wrote: Trass3r wrote: I wrote a module to ease time measurement in my projects. Does anyone know how to get elapsed milli-

Re: array initialization problem

2009-01-19 Thread Rainer Deyke
Denis Koroskin wrote: Arrays in D are reference types. Besides, it's best to avoid hidden allocations. Arrays in D are reference types except when they're not. int[] a = [5]; int[] b = a; a[0] = 4; assert(b[0] == 4); a.length = 2; assert(b.length == 1); a[0] = 3; // Is b[0] 3 or 4? --

Re: loop through specific class members

2009-01-19 Thread Trass3r
Daniel Keep schrieb: Another possible hack: if used from a different module, you could use the 'compiles' trait with allMembers to find out if a member can be accessed. you could define a template in another module that does the check and returns the result. Well, it'd indeed be used from a

Re: Delegate contravariance

2009-01-19 Thread Christopher Wright
Jason House wrote: Silvio Ricardo Cordeiro wrote: Is there any good reason why the following code doesn't work? The function foo requires as its argument a delegate that receives a B. This means that, because of the type soundness of the D language, the delegate will only be called with

Re: loop through specific class members

2009-01-19 Thread Daniel Keep
BCS wrote: Reply to Daniel, It depends on what exactly you're trying to do. Some time ago, I wrote a library that created XML loaders for structs, and it needed to know the names of fields. Pre-traits, this is what I used: struct Stuff { int foo; char[] bar; alias Tuple!(foo,

Re: base class access specifier[s]

2009-01-19 Thread Ellery Newcomer
BCS wrote: Reply to Ellery, I don't buy that. Not that I'm a C guru or anything, but it looks to me that Parser::BaseClasses could be easily edited to make the point in question go away. it's not a parser thing but a grammar thing. It would be complex to define a grammar that allows one

Re: base class access specifier[s]

2009-01-19 Thread BCS
Reply to Ellery, BCS wrote: Reply to Ellery, I don't buy that. Not that I'm a C guru or anything, but it looks to me that Parser::BaseClasses could be easily edited to make the point in question go away. it's not a parser thing but a grammar thing. It would be complex to define a grammar

Re: base class access specifier[s]

2009-01-19 Thread BCS
Reply to Ellery, I don't buy that either. The subject was access specifiers for base classes, not storage classes for declarations or access specifiers for statements. In those cases I would grant your point, but a base class has precisely one access specifier and no storage classes. It would