Re: Static unittests?

2013-08-18 Thread Borislav Kosharov
On Saturday, 17 August 2013 at 17:48:04 UTC, Andrej Mitrovic wrote: On 8/17/13, Borislav Kosharov wrote: I really think that this should be added to the language, because it doesn't break stuff and it is useful. And the 'static' keyword is already used in many places like mod

Re: Guys, what have I done xD

2013-08-17 Thread Borislav Kosharov
On Saturday, 10 August 2013 at 18:28:26 UTC, H. S. Teoh wrote: On Wed, Aug 07, 2013 at 09:52:10PM +0200, Borislav Kosharov wrote: I played around and used D's flexible syntax and I managed to create this: https://gist.github.com/nikibobi/6169035 It prints the song's lyrics and I

Re: Static unittests?

2013-08-17 Thread Borislav Kosharov
monarch_dodra got my point. So a static unittest is just like a normal one, but it will be executed in compile time. And every assert in it is a static assert. They will be only used to test CTFE's results and to insure that all constants are initialized correctly. I really think that this sh

Re: std.json parsing real numbers.

2013-08-10 Thread Borislav Kosharov
On Saturday, 10 August 2013 at 18:28:31 UTC, H. S. Teoh wrote: On Thu, Aug 08, 2013 at 08:46:15PM +0200, Borislav Kosharov wrote: On Thursday, 8 August 2013 at 16:05:56 UTC, Nick Sabalausky wrote: >On Thu, 08 Aug 2013 17:20:16 +0200 >"Borislav Kosharov" wrote: > >>O

Re: @property - take it behind the woodshed and shoot it?

2013-08-10 Thread Borislav Kosharov
On Saturday, 10 August 2013 at 10:29:51 UTC, Stian Pedersen wrote: To add to the mess - or maybe suggest a new approach, what about: class A { int foo(); void foo=(int a); private foo_; } Then a.foo = 42; calls the foo= method. No other conversions from a=b to a method invocation.

Multiple alias for multiple functions?

2013-08-08 Thread Borislav Kosharov
I want to make a simple Vector struct class: struct Vector { alias _data this; alias data!0 x, width; alias data!1 y, height; private: @property float data(int i)() { return _data[i]; } @property void data(int i)(float value) { _data[i] = value; }

Re: std.json parsing real numbers.

2013-08-08 Thread Borislav Kosharov
On Thursday, 8 August 2013 at 16:05:56 UTC, Nick Sabalausky wrote: On Thu, 08 Aug 2013 17:20:16 +0200 "Borislav Kosharov" wrote: On Thursday, 8 August 2013 at 10:13:51 UTC, khurshid wrote: > On Thursday, 8 August 2013 at 10:11:07 UTC, MrSmith wrote: >> On Thursday, 8 Augu

Re: std.json parsing real numbers.

2013-08-08 Thread Borislav Kosharov
On Thursday, 8 August 2013 at 10:13:51 UTC, khurshid wrote: On Thursday, 8 August 2013 at 10:11:07 UTC, MrSmith wrote: On Thursday, 8 August 2013 at 08:04:49 UTC, khurshid wrote: I just check std.json for parsing real numbers. import std.json; import std.stdio: writeln; int main() {

Re: parseJSON bug

2013-08-08 Thread Borislav Kosharov
On Thursday, 8 August 2013 at 13:56:15 UTC, Dicebot wrote: On Thursday, 8 August 2013 at 13:49:22 UTC, bearophile wrote: In my opinion we should follow the formal JSON grammar. This. Anyone who wants JavaScript behavior can use own third-party library bust standard library must behave accordi

Maybe add init template to std.conv?

2013-08-07 Thread Borislav Kosharov
I have created 2 probably useful and short templates that enhance .init ///Returns Source's .init converted with std.conv.to to Target @property auto init(Source, Target)() { return init!Source.to!Target; } ///Sets target to Source's .init value @property void init(Source, Target)(out Targe

Re: Guys, what have I done xD

2013-08-07 Thread Borislav Kosharov
On Wednesday, 7 August 2013 at 19:54:32 UTC, Brad Anderson wrote: On Wednesday, 7 August 2013 at 19:52:13 UTC, Borislav Kosharov wrote: I played around and used D's flexible syntax and I managed to create this: https://gist.github.com/nikibobi/6169035 It prints the song's lyrics

Guys, what have I done xD

2013-08-07 Thread Borislav Kosharov
I played around and used D's flexible syntax and I managed to create this: https://gist.github.com/nikibobi/6169035 It prints the song's lyrics and I have used aliases, templates, constants, the fact that f(a) == a.f() == a.f and many more small things. I tough that it was funny and strange an

std.array string.split("") bug

2013-08-07 Thread Borislav Kosharov
Something strange happens when I do this: unittest { import std.array, std.string; string s = "test"; //assert(s.toUpper.split("").join("-") == "T-E-S-T"); //"Memory allocation failed" //[Finished in 26.5s] //CPU: 1% -> 50% | 2.7GHz dual core //RAM: 1.6GB -> 2.6GB | 1G

Re: Evangelizing Your Cool Product

2013-08-07 Thread Borislav Kosharov
On Wednesday, 7 August 2013 at 14:12:32 UTC, eles wrote: On Wednesday, 7 August 2013 at 02:27:42 UTC, Walter Bright wrote: On 8/6/2013 4:28 PM, MattCoder wrote: It simply isn't enough to create a great product. I did try. At my job. Basically, answers that I received were like: "it's unfinish

Re: Why I can't call toHash in const context?

2013-08-06 Thread Borislav Kosharov
On Tuesday, 6 August 2013 at 18:18:43 UTC, Peter Alexander wrote: On Tuesday, 6 August 2013 at 18:14:29 UTC, Borislav Kosharov wrote: Am I missing something? It's a long story :-) Issue 1824 - Object not const correct http://d.puremagic.com/issues/show_bug.cgi?id=1824 Issue 9771 - R

Re: Why I can't call toHash in const context?

2013-08-06 Thread Borislav Kosharov
On Tuesday, 6 August 2013 at 18:18:43 UTC, Peter Alexander wrote: On Tuesday, 6 August 2013 at 18:14:29 UTC, Borislav Kosharov wrote: Am I missing something? It's a long story :-) Issue 1824 - Object not const correct http://d.puremagic.com/issues/show_bug.cgi?id=1824 Issue 9771 - R

Why I can't call toHash in const context?

2013-08-06 Thread Borislav Kosharov
I have this code: class Animation { string name; } struct Key { Animation from; Animation to; this(Animation from, Animation to) { this.from = from; this.to = to; } const hash_t opHash() { return from.toHash() ^ to.toHash(); } const bool

Re: Evangelizing Your Cool Product

2013-08-05 Thread Borislav Kosharov
On Monday, 5 August 2013 at 19:44:12 UTC, Walter Bright wrote: This is a bit of a generic reply to a constant theme I see here. It pains me to see a lot of great D projects languish in obscurity, and often the author(s) eventually get frustrated with that and abandon them. The problem is tha

Re: request switch statement with common block

2013-08-05 Thread Borislav Kosharov
On Monday, 5 August 2013 at 19:58:21 UTC, ron wrote: On Monday, 5 August 2013 at 08:46:54 UTC, Andre Artus wrote: On Monday, 5 August 2013 at 06:28:12 UTC, luminousone wrote: perhaps a more generic solution should be looked at, extend contracts to work with all scope blocks. switch(somenumber

Re: D game development: a call to action

2013-08-05 Thread Borislav Kosharov
On Monday, 5 August 2013 at 19:33:59 UTC, Namespace wrote: I'm working currently on Dgame: http://dgame-dev.de/ I'm almost finished, but the documentation, the tutorials and the download there is not up to date, but that will change in the next few days (now that I had my last exam today). My f

Re: D game development: a call to action

2013-08-05 Thread Borislav Kosharov
... Oh and I completely forgot to mention that I am working on a D version of the spine runtime (http://esotericsoftware.com/). If you haven't heard of it it is a 2D skeletal animation tool that exports to bin or json(other formats too). And there are many runtime libraries for many language

Re: D game development: a call to action

2013-08-05 Thread Borislav Kosharov
On Monday, 5 August 2013 at 19:03:29 UTC, Jonathan A Dunlap wrote: Take a look at https://github.com/Jebbs/DSFML The autor, aubade, me and few other guys are trying to maintain the project. I wrote a small tutorial on the wiki. And we have plans on documenting it, adding unittests and much mor

Re: D game development: a call to action

2013-08-05 Thread Borislav Kosharov
On Monday, 5 August 2013 at 18:18:30 UTC, Jonathan A Dunlap wrote: I am one of the few who have taken a keen interest in D for game development. The concise language and modern conveniences may be able to reduce many hours worth of development time off a game project, while making the code more