Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread bearophile via Digitalmars-d-learn
Yuriy: but I like D, and i strongly believe it's the next big language. Oh, good. Do you want to briefly explain why? :) Bye, bearophile

Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread Yuriy via Digitalmars-d-learn
Imho, offtop, also i'm a C++/Obj-C guy and that might partially explain my preferences, but here are some more reasons: 1. I like the concept of CT-reflection and CTFE a lot. This makes metaprogramming extremely powerful without any RT overheads. It brings a lot more control to what goes to RT.

Avoiding __traits(getAttributes, ...) on alias

2014-05-09 Thread Stefan Frijters via Digitalmars-d-learn
I've been playing with UDAs a bit and I wanted to find all variables with a particular attribute in various modules. I thought I had it cracked, until I added a module that contains an alias declaration, which makes it choke when trying to execute __traits(getAttributes, ...). A small example

Re: Avoiding __traits(getAttributes, ...) on alias

2014-05-09 Thread Stefan Frijters via Digitalmars-d-learn
On Friday, 9 May 2014 at 12:19:12 UTC, John Colvin wrote: On Friday, 9 May 2014 at 11:53:59 UTC, Stefan Frijters wrote: I've been playing with UDAs a bit and I wanted to find all variables with a particular attribute in various modules. I thought I had it cracked, until I added a module that

Re: Down the VisualD0.3.38-1.exe ,found virus!

2014-05-09 Thread Orvid King via Digitalmars-d-learn
Trend Micro and Comodo have (from my limited experience) been pretty good about dealing with false positives, so does anyone want to inform them and the others as well? On 5/8/14, sigod via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 9 May 2014 at 01:02:39 UTC,

sort struct of arrays

2014-05-09 Thread via Digitalmars-d-learn
If you have an array of structs, such as... struct Foo { int x; int y; } Foo[] foos; ...and you wanted to sort the foos then you'd do something like... foos.sort!(a.x b.x), ..and, of course, both of the fields x and y get sorted together. If you

Re: sort struct of arrays

2014-05-09 Thread anonymous via Digitalmars-d-learn
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote: If you have an array of structs, such as... struct Foo { int x; int y; } Foo[] foos; ...and you wanted to sort the foos then you'd do something like... foos.sort!(a.x b.x), ..and, of

Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread flamencofantasy via Digitalmars-d-learn
One thing I hate about C# (which is what I use professionally) is the sync block index in every single class instance. Why not have the developer decide when he needs a Monitor and manually use it?! I am disappointed D took the same route.

Re: sort struct of arrays

2014-05-09 Thread via Digitalmars-d-learn
On Friday, 9 May 2014 at 14:48:50 UTC, anonymous wrote: std.range.zip(fooX, fooY).sort!((a, b) = a[0] b[0]); I wasn't sure if that's supposed to work. Turns out the documentation on zip [1] has this exact use case as an example. [1] http://dlang.org/phobos/std_range.html#zip Ha! Awesome!

Re: sort struct of arrays

2014-05-09 Thread John Colvin via Digitalmars-d-learn
On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote: If you have an array of structs, such as... struct Foo { int x; int y; } Foo[] foos; ...and you wanted to sort the foos then you'd do something like... foos.sort!(a.x b.x), ..and, of

Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread John Colvin via Digitalmars-d-learn
On Friday, 9 May 2014 at 14:56:21 UTC, flamencofantasy wrote: One thing I hate about C# (which is what I use professionally) is the sync block index in every single class instance. Why not have the developer decide when he needs a Monitor and manually use it?! I am disappointed D took the same

Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread Yuriy via Digitalmars-d-learn
flamencofantasy, thanx for that! Where do we vote here? =)

Re: sort struct of arrays

2014-05-09 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 9 May 2014 at 15:52:51 UTC, John Colvin wrote: On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote: If you have an array of structs, such as... struct Foo { int x; int y; } Foo[] foos; ...and you wanted to sort the foos then you'd do something

Re: sort struct of arrays

2014-05-09 Thread John Colvin via Digitalmars-d-learn
On Friday, 9 May 2014 at 16:26:22 UTC, Rene Zwanenburg wrote: On Friday, 9 May 2014 at 15:52:51 UTC, John Colvin wrote: On Friday, 9 May 2014 at 14:23:41 UTC, Luís Marques wrote: If you have an array of structs, such as... struct Foo { int x; int y; } Foo[] foos;

core.sync.rwmutex example

2014-05-09 Thread Charles Hixson via Digitalmars-d-learn
The example code from core.sync.rwmutex seems bugged. After copying it I added an import for core.sync.rwmutex, and moved the executions of runTest into...well: void main() {runTest(ReadWriteMutex.Policy.PREFER_READERS); runTest(ReadWriteMutex.Policy.PREFER_WRITERS); } Then I tried to

Re: CMake for D

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Dragos What is the best way to specify a mixin

why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
Error: non-shared const method is not callable using a shared mutable object Why not? If the method is const, it can't modify the object anyway.

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 09 May 2014 17:37:35 -0400, Vlad Levenfeld vlevenf...@gmail.com wrote: Error: non-shared const method is not callable using a shared mutable object Why not? If the method is const, it can't modify the object anyway. Non-shared methods cannot be called on shared objects.

Re: CMake for D

2014-05-09 Thread Trent Forkert via Digitalmars-d-learn
On Friday, 9 May 2014 at 21:11:54 UTC, Chris Piker wrote: On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
Is this still the case if the method is const or pure?

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
Is there any way to declare a method as safe regardless of shared/mutability/etc (or some other way to avoid cast(Type)object.property every time I want to check a property which won't affect any state)?

Re: core.sync.rwmutex example

2014-05-09 Thread Joshua Niehus via Digitalmars-d-learn
Hi Charles, would the following work (just a shot in the dark) ? //--- module test; import std.stdio; import std.concurrency; void spawnedFuncFoo(Tid tid, Tid tidBar) { receive( (int i) { writeln(Foo Received the number , i); send(tidBar, i, thisTid);

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
I mean I thought that's what pure was for but the compiler complains all the same.

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On Fri, 09 May 2014 17:45:37 -0400, Vlad Levenfeld vlevenf...@gmail.com wrote: Is there any way to declare a method as safe regardless of shared/mutability/etc (or some other way to avoid cast(Type)object.property every time I want to check a property which won't affect any state)? Not

Re: CMake for D

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
On Friday, 9 May 2014 at 21:43:04 UTC, Trent Forkert wrote: The way I've tackled that in my (still work-in-progress) CMake fork[1] is to add an `include_directories(TEXT ...)` signature. I like that, it seems clean. Unfortunately, you'll need to build my CMake from source, though that isn't

Re: Improving IO Speed

2014-05-09 Thread flamencofantasy via Digitalmars-d-learn
Try this; import std.mmfile; scope mmFile = new MmFile(T201212A.IDX); TaqIdx* arr = cast(TaqIdx*)mmFile[0..mmFile.length].ptr; for (ulong i = 0; i mmFile.length/TaqIdx.sizeof; ++i) { // do something... writeln(arr[i].symbol); } On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: I

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
Let me see if I understand this right... let's say I have some (unshared) class that launches threads to do its real work in. class Foo { this () {thread = spawn (work);} shared void work () {...}; void send_message (T) (T msg) {thread.send (msg);} Tid thread; } It has an unshared

Recommendation on option parsing

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
Phobos' std.getopt is a bit spare for my taste, as there is no builtin general help facility with word-wrapping. Does anyone have a recommendation on which of the existing command line option parsing libraries floating around in the wild to use? If it doesn't compile against the current version

Re: core.sync.rwmutex example

2014-05-09 Thread Charles Hixson via Digitalmars-d-learn
On 05/09/2014 02:51 PM, Joshua Niehus via Digitalmars-d-learn wrote: Hi Charles, would the following work (just a shot in the dark) ? //--- module test; import std.stdio; import std.concurrency; void spawnedFuncFoo(Tid tid, Tid tidBar) { receive( (int i) {

Re: Avoiding __traits(getAttributes, ...) on alias

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
I've recently found out that you can deal with the abundance of backticks and escapes in a couple of ways: q{ your code here... } will resolve to a string but your editor can still highlight it as D code, making it more readable. also, turning things like: mixin (if (~expr~)) into: if

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
PS After reading your post I experimented with overloading shared/unshared methods in my code and came up with this solution: shared Id!Service id ()() const if (is (typeof(this) == shared)) { return (cast(Service)this).id; } Id!Service id () const { return service_id; } I like this better

Re: why can't I call const methods on shared objects?

2014-05-09 Thread Vlad Levenfeld via Digitalmars-d-learn
aaand on further experimentation it turns out I don't need a template at all, I can just overload it... strange, I seem to remember not being able to do that before.

Kìtchèń Desìgners Hertfordsìre

2014-05-09 Thread dondong via Digitalmars-d-learn
Kìtchèń Desìgners Hertfordsìre. Thirty €x Display K ìtcheńs To Clear. W W W . è x d ì S p l a y K ì t C H è ń S 1 . c o . u k £ 595 EAch wIth appliańcès.