Re: Problem with creating a new account on wiki.dlang.org

2015-02-03 Thread Zach the Mystic via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 23:52:18 UTC, Piotrek wrote: Hi, I wanted to create my account at wiki.dlang.org: Went to: http://wiki.dlang.org/?title=Special:UserLoginreturnto=Wish+listtype=signup And got: No questions found; set some in LocalSettings.php using the format from

Re: Constructing a tuple dynamically

2015-02-03 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 10:32:47 UTC, Pena wrote: How can I use this code or something similar to dynamically construct a tuple containing types of fields marked as @Cloneable? import std.traits, std.typetuple; template CloneableTypes(S) { template IsCloneable(string M) { enum

Re: Problem with creating a new account on wiki.dlang.org

2015-02-03 Thread Zach the Mystic via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 23:52:18 UTC, Piotrek wrote: Went to: http://wiki.dlang.org/?title=Special:UserLoginreturnto=Wish+listtype=signup And got: No questions found; set some in LocalSettings.php using the format from QuestyCaptcha.php. Anyone familiar with the issue? Piotrek

Re: Conway's game of life

2015-02-03 Thread Paul via Digitalmars-d-learn
On Monday, 2 February 2015 at 16:58:43 UTC, bearophile wrote: The quality of the D GC is not important for a simple Life implementation, you just need two arrays. Here's my 30 minute sandwich-break version, sorry it's not very arractive 'D'... import std.stdio; import std.random; void

Re: Conway's game of life

2015-02-03 Thread Paul via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 13:35:37 UTC, Paul wrote: On Monday, 2 February 2015 at 16:58:43 UTC, bearophile wrote: The quality of the D GC is not important for a simple Life implementation, you just need two arrays. Here's my 30 minute sandwich-break version, sorry it's not very

Re: Conway's game of life

2015-02-03 Thread Paul via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 14:01:51 UTC, bearophile wrote: Paul: enum WORLDSIZE = 20; enum INITIALPOP = 70; //experimental enum DEAD = 0; enum ALIVE = 1; D enums don't need to be ALL UPPERCASE :-) int world[WORLDSIZE][WORLDSIZE]; Don't

Re: Constructing a tuple dynamically

2015-02-03 Thread Kagamin via Digitalmars-d-learn
Try variadic templates with recursion. For example see http://dpaste.dzfl.pl/f49a97e35974

Re: Conway's game of life

2015-02-03 Thread bearophile via Digitalmars-d-learn
Paul: Regarding the immutable loop variable, I've conditioned myself never to interfere with loop control values But adding immutable you don't risk modifying the variable by mistake. It's another design mistake of D. Variables (like foreach loop indexes) must be immutable by default

Allegro 5 in C - installing on OSX

2015-02-03 Thread Joel via Digitalmars-d-learn
How do you install Allegro 5 (OSX)? Like, using 'Home Brew'.

Creating a JSON file

2015-02-03 Thread solidstate1991 via Digitalmars-d-learn
I wrote my graphics engine with CodeBlocks, and I only used dub when I complied the derelict SDL2 libs. https://github.com/ZILtoid1991/VDP-engine You can find the sources here.

Re: Allegro 5 in C - installing on OSX

2015-02-03 Thread Mike Parker via Digitalmars-d-learn
On 2/3/2015 5:37 PM, Joel wrote: How do you install Allegro 5 (OSX)? Like, using 'Home Brew'. This really isn't the place for that. At allegro.cc there are Allegro-specific forums [1] and an Allegro wiki info on building/installing, where you can find [2]. [1]

Re: Conway's game of life

2015-02-03 Thread bearophile via Digitalmars-d-learn
Paul: enum WORLDSIZE = 20; enum INITIALPOP = 70; //experimental enum DEAD = 0; enum ALIVE = 1; D enums don't need to be ALL UPPERCASE :-) int world[WORLDSIZE][WORLDSIZE]; Don't forget to compile with warnings active (it's a design error of the D

Code coverage during CTFE

2015-02-03 Thread Stefan Frijters via Digitalmars-d-learn
Recently I've hooked my code up to coveralls.io using the convenient doveralls[1]. At first, I just did a dub test command before sending the data to coveralls, but my simulation code also has runnable tests in addition to unittests, which reaches many more lines. Today I've added an option

Want to read a whole file as utf-8

2015-02-03 Thread Foo via Digitalmars-d-learn
How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do that with C++, maybe D is a better choice, then we would probably move our whole project from C++ to D.

Symbol References Pass in DMD

2015-02-03 Thread Per Nordlöw via Digitalmars-d-learn
Is there any part of Dmd that keeps track of references to symbols? If not do you have any advice on where and how to add them?

Re: Want to read a whole file as utf-8

2015-02-03 Thread FG via Digitalmars-d-learn
On 2015-02-03 at 19:53, Foo wrote: How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do that with C++, maybe D is a better choice, then we would probably move our whole project from C++ to D. Looks

Re: Want to read a whole file as utf-8

2015-02-03 Thread Tobias Pankrath via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote: On 2015-02-03 at 19:53, Foo wrote: How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do that with C++, maybe D is a better choice, then we would

Re: Want to read a whole file as utf-8

2015-02-03 Thread FG via Digitalmars-d-learn
On 2015-02-03 at 20:50, Tobias Pankrath wrote: Use std.utf.validate instead of decode. It will only allocate one exception if necessary. Looks to me like it uses decode internally... But Foo, do you have to use @nogc? It still looks like it's work in progress, and lack of it doesn't mean

Re: Want to read a whole file as utf-8

2015-02-03 Thread Foo via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 19:56:37 UTC, FG wrote: On 2015-02-03 at 20:50, Tobias Pankrath wrote: Use std.utf.validate instead of decode. It will only allocate one exception if necessary. Looks to me like it uses decode internally... But Foo, do you have to use @nogc? It still looks like

Re: Want to read a whole file as utf-8

2015-02-03 Thread Foo via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote: On 2015-02-03 at 19:53, Foo wrote: How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do that with C++, maybe D is a better choice, then we would

Re: Want to read a whole file as utf-8

2015-02-03 Thread Nordlöw
On Tuesday, 3 February 2015 at 18:53:28 UTC, Foo wrote: How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do that with C++, maybe D is a better choice, then we would probably move our whole project

Constructing a tuple dynamically

2015-02-03 Thread Pena via Digitalmars-d-learn
I want to create a simple clone operator based on UDAs. First step is to create a tuple of the fields with desired UDA value and construct a clone method which uses that tuple. import std.traits; enum Cloneable; struct Foo { @Cloneable int cloneableInt; @Cloneable string cloneableStr;

Re: Want to read a whole file as utf-8

2015-02-03 Thread FG via Digitalmars-d-learn
On 2015-02-04 at 00:07, Foo wrote: How would I use decoding for that? Isn't there a way to read the file as utf8 or event better, as unicode? Well, apparently the utf-8-aware foreach loop still works just fine. This program shows the file size and the number of unicode glyps, or whatever

Re: Want to read a whole file as utf-8

2015-02-03 Thread Tobias Pankrath via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 23:07:03 UTC, Foo wrote: On Tuesday, 3 February 2015 at 19:44:49 UTC, FG wrote: On 2015-02-03 at 19:53, Foo wrote: How can I do that without any GC allocation? Nothing in std.file seems to be marked with @nogc I'm asking since it seems very complicated to do

Re: Allegro 5 in C - installing on OSX

2015-02-03 Thread Joel via Digitalmars-d-learn
Ok, thanks Mike.

Problem with creating a new account on wiki.dlang.org

2015-02-03 Thread Piotrek via Digitalmars-d-learn
Hi, I wanted to create my account at wiki.dlang.org: Went to: http://wiki.dlang.org/?title=Special:UserLoginreturnto=Wish+listtype=signup And got: No questions found; set some in LocalSettings.php using the format from QuestyCaptcha.php. Anyone familiar with the issue? Piotrek

Re: Want to read a whole file as utf-8

2015-02-03 Thread Namespace via Digitalmars-d-learn
On Tuesday, 3 February 2015 at 23:55:19 UTC, FG wrote: On 2015-02-04 at 00:07, Foo wrote: How would I use decoding for that? Isn't there a way to read the file as utf8 or event better, as unicode? Well, apparently the utf-8-aware foreach loop still works just fine. This program shows the

Re: Want to read a whole file as utf-8

2015-02-03 Thread FG via Digitalmars-d-learn
On 2015-02-04 at 01:56, Namespace wrote: FILE* f = fopen(filename.ptr, rb); fseek(f, 0, SEEK_END); immutable size_t fsize = ftell(f); fseek(f, 0, SEEK_SET); That's quite a smart way to get the size of the file. I started with std.file.getSize (which obviously isn't