New to D: parse a binary file

2011-02-05 Thread scottrick
Hi, I am new to D. I am trying to write a binary file parser for a project of mine and I thought it would be fun to try and learn a new language at the same time. So I chose D! :D I have been struggling however and have not been able to find very many good examples, so I am posting this

Re: Asynchronous concurrency with reference types

2011-02-05 Thread Peter Alexander
On 5/02/11 12:11 AM, Sean Kelly wrote: Peter Alexander Wrote: Things might be easier if the error messages associated with D's concurrent features weren't especially unhelpful (for example, trying to spawn a thread with reference type parameters just gives you a 'no match for spawn template'

Re: Asynchronous concurrency with reference types

2011-02-05 Thread Peter Alexander
On 4/02/11 11:44 PM, Sean Kelly wrote: Peter Alexander Wrote: How would you do it with message passing though? As I understand, all of the std.concurrency message passing routines are blocking, and I need this to be asynchronous. What do you mean by blocking? The receive call will block

Re: Asynchronous concurrency with reference types

2011-02-05 Thread Denis Koroskin
On Sat, 05 Feb 2011 20:42:53 +0300, Peter Alexander peter.alexander...@gmail.com wrote: On 5/02/11 12:11 AM, Sean Kelly wrote: Peter Alexander Wrote: Things might be easier if the error messages associated with D's concurrent features weren't especially unhelpful (for example, trying to

Re: Asynchronous concurrency with reference types

2011-02-05 Thread spir
On 02/05/2011 06:42 PM, Peter Alexander wrote: On 5/02/11 12:11 AM, Sean Kelly wrote: Peter Alexander Wrote: Things might be easier if the error messages associated with D's concurrent features weren't especially unhelpful (for example, trying to spawn a thread with reference type parameters

Re: New to D: parse a binary file

2011-02-05 Thread spir
On 02/05/2011 06:26 PM, scottrick wrote: Hi, I am new to D. I am trying to write a binary file parser for a project of mine and I thought it would be fun to try and learn a new language at the same time. So I chose D! :D I have been struggling however and have not been able to find very

Re: New to D: parse a binary file

2011-02-05 Thread bearophile
spir: Out[] map (In, Out) (In[] source, Out delegate (In) f) { // (0) ... string hex (uint i) { return format(0x%03X, i); } uint[] decs = [1, 3, 9, 27, 81, 243, 729]; auto hexes = map!(uint,string)(decs, hex); ... (0) The func must be declared as delegate (instead of

Setting thread priority

2011-02-05 Thread Peter Alexander
How do you set the priority of a thread, or otherwise control how much CPU time it gets? It appears that std.thread had an answer for this, but it has been removed from Phobos by the looks of things. On a side note, why is std.thread still in the online documentation if it was removed long

Re: Setting thread priority

2011-02-05 Thread Sean Kelly
Peter Alexander Wrote: How do you set the priority of a thread, or otherwise control how much CPU time it gets? Use core.thread. And I believe the method name is setPriority.