Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Omid
On Monday, 7 January 2013 at 18:59:25 UTC, Ali Çehreli wrote: On 01/07/2013 06:42 AM, Omid wrote: > Hi. As I am learning D as my first language, it may sound crazy. I really don't think it is crazy at all. Compared especially to C and C++ I think D is extremely easy to learn. I have written a

Re: foreach range construction bug?!!?!?!?

2013-01-07 Thread Mike Parker
On Monday, 7 January 2013 at 18:11:14 UTC, Phil Lavoie wrote: I have looked around the a while and I can say that the invalid calling convention is the most probable cause, though I am still wondering what is the best way to create en import library from a .dll that will export symbols matching

Unexpected behavior of std.json.toJSON

2013-01-07 Thread Peter Sommerfeld
Sample code: --- import std.stdio; import std.json; void main(string[] args){ string text = "{ \"url\":\"http://www.boost.org\"; }"; JSONValue json = parseJSON(text); writeln(toJSON(&json)); // prints: { "url":"http\/\/www.boost.org\" } // The same happens when writing

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Matthew Caron
On 01/07/2013 05:00 PM, Omid wrote: Thanks all, specially bearophile. I said "as my first language" but I didn't mean that I don't know anything about programming. I passed pascal around 18 years ago in my undergrad but never did programming since then. I should say, learning D is more fun and lo

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Omid
Thanks all, specially bearophile. I said "as my first language" but I didn't mean that I don't know anything about programming. I passed pascal around 18 years ago in my undergrad but never did programming since then. I should say, learning D is more fun and logical for me, compared to my sever

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Era Scarecrow
On Monday, 7 January 2013 at 21:28:20 UTC, Era Scarecrow wrote: 3) Iterators not been based on arrays and likely gone more with a range design. s/arrays/pointers/

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Era Scarecrow
On Monday, 7 January 2013 at 18:59:25 UTC, Ali Çehreli wrote: I really don't think it is crazy at all. Compared especially to C and C++ I think D is extremely easy to learn. I have written a book that attempts to teach programming as a first language: It could have been easier to learn, but c

Re: asynchronous communication between threads

2013-01-07 Thread Dmitry Olshansky
05-Jan-2013 08:15, Charles Hixson пишет: On 01/04/2013 02:56 AM, Dmitry Olshansky wrote: 04-Jan-2013 10:36, Charles Hixson пишет: [snip] Certainly TDPL talks about them sequentially, and implies that there is a tight connection between shared variables and synchronized classes. It is as if a sy

Re: LZW & Huffman - BitArray implimentations & examples

2013-01-07 Thread Dmitry Olshansky
07-Jan-2013 01:54, Era Scarecrow пишет: On Sunday, 6 January 2013 at 21:14:08 UTC, Dmitry Olshansky wrote: 07-Jan-2013 00:51, Era Scarecrow wrote: Nearly done. Got a working LZW, multi-level huffman working, only cleanup/refactoring to do, and a way to save/load the tree structure for externa

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread Jacob Carlborg
On 2013-01-07 15:42, Omid wrote: Hi. As I am learning D as my first language, it may sound crazy. But I would appreciate if somebody tell me how to read and write a class (say with two objects, an integer an a char[20]) to a file (text or binary). You can serialize it using Orange: https://git

Re: foreach range construction bug?!!?!?!?

2013-01-07 Thread Phil Lavoie
I have looked around the a while and I can say that the invalid calling convention is the most probable cause, though I am still wondering what is the best way to create en import library from a .dll that will export symbols matching to extern( Windows ) "_...@int". Implib from digital mars doe

Re: Reading and writing a class to a (binary) file

2013-01-07 Thread bearophile
Omid: As I am learning D as my first language, it may sound crazy. D is one of the most complex languages, so your have to learn a LOT. Learning about static typing is important, but usually as first language I suggest Python, despite Python is not perfect. But I would appreciate if someb

How are windows import library created

2013-01-07 Thread Phil Lavoie
Hi, I am currently trying to create an import library for opengl32.dll. I used this command: implib /noi /system ... To create the import library. However, the exported symbols do not have the at suffix (@someInt) (supposed to be _stdcall, so translated to extern( Windows ), which expects @..

Re: Troublemaker dmd 2.061 - Templates?

2013-01-07 Thread nazriel
On Saturday, 5 January 2013 at 18:45:26 UTC, David wrote: LOL mixin template get_packets_mixin(alias Module) { template get_packets() { alias NoDuplicates!(get_packets_impl!(get_members!())) get_packets; } template get_members() { alias TypeTuple!(__traits(allMember

Re: foreach range construction bug?!!?!?!?

2013-01-07 Thread Phil Lavoie
On Monday, 7 January 2013 at 09:16:00 UTC, Mike Parker wrote: On Monday, 7 January 2013 at 07:57:39 UTC, Tavi Cacina wrote: Am 06.01.2013 19:59, schrieb Phil Lavoie: Now here is what is really troubling me, the non defined version (using the import library) crashes when the range constructor is

Reading and writing a class to a (binary) file

2013-01-07 Thread Omid
Hi. As I am learning D as my first language, it may sound crazy. But I would appreciate if somebody tell me how to read and write a class (say with two objects, an integer an a char[20]) to a file (text or binary).

Re: foreach range construction bug?!!?!?!?

2013-01-07 Thread Mike Parker
On Monday, 7 January 2013 at 07:57:39 UTC, Tavi Cacina wrote: Am 06.01.2013 19:59, schrieb Phil Lavoie: Now here is what is really troubling me, the non defined version (using the import library) crashes when the range constructor is called inside the foreach statement, which is weird by itself

Re: Linking with FFmpeg

2013-01-07 Thread Johannes Pfau
Am Mon, 07 Jan 2013 03:31:51 +0100 schrieb "MrOrdinaire" : > > I agree with you. > > One quick question, why do you need a pair of parentheses in > these declarations, ref (ubyte*)[4] and (ubyte*)[4]? The compiler > doesn't complain if I remove it. I wasn't sure if it's necessary. Imho it mak

Re: foreach range construction bug?!!?!?!?

2013-01-07 Thread Tavi Cacina
Am 06.01.2013 19:59, schrieb Phil Lavoie: Now here is what is really troubling me, the non defined version (using the import library) crashes when the range constructor is called inside the foreach statement, which is weird by itself. In addition, in DOES NOT crash when the functions are artifica