Re: rehabilitating Juno

2014-06-25 Thread Jason King via Digitalmars-d-learn
FYI after running coffimplib over SDK versions of oleaut32.lib and gdiplus.lib I've gotten all the examples in the makefile to run. Next up for me is to get tlbimpld compiling and I'll fork and do a pull request to add that to the makefile.

Re: Equivalent of C++ std::function

2014-06-25 Thread Yuushi via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 05:13:00 UTC, Olivier Pisano wrote: On Wednesday, 25 June 2014 at 03:33:15 UTC, Yuushi wrote: Thanks a ton - I guess I need to do a fair bit more reading about alias. In this case, alias acts as typedef in C++. What is important here is the function

Re: Equivalent of C++ std::function

2014-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/24/2014 08:33 PM, Yuushi wrote: I guess I need to do a fair bit more reading about alias. It is probably too basic for you but somebody else may find it useful: http://ddili.org/ders/d.en/lambda.html Ali

Re: Is their a way for a Child process to modify its Parent's environment?

2014-06-25 Thread Jacob Carlborg via Digitalmars-d-learn
On 2014-06-25 03:53, WhatMeWorry wrote: I open a command line window, and run the following 6 line program void main() { string envPath = environment[PATH]; writeln(PATH is: , envPath); envPath ~= r;F:\dmd2\windows\bin; environment[PATH] = envPath; envPath =

Re: Equivalent of C++ std::function

2014-06-25 Thread Ali Çehreli via Digitalmars-d-learn
On 06/24/2014 11:23 PM, Yuushi wrote: Yeah, I realised that when I went back and looked at what I'd tried: function string(string) transform; That gets me all the time! :-/ That is the long version of the function literal syntax: auto f = function string(string s) { return

[OT]I throw in the towel

2014-06-25 Thread Orfeo via Digitalmars-d-learn
I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github.com/pszturmaj/ddb) The application should run on WinXp or Win7. After a week of work I throw in the towel ... 1. The first problem $ dub build Unexpected

Assosiative array pop

2014-06-25 Thread seany via Digitalmars-d-learn
Given an assosiative array : int[string] k, is there a way (either phobos or tango) to pop the first element of this array and append it to another array? I can come up with a primitive soluiton: int[string] k; // populate k here int[string] j; foreach(sttring key, int val; k) { j[key] =

Re: Assosiative array pop

2014-06-25 Thread seany via Digitalmars-d-learn
Aso, I wanted to mention that I did not find much info in the manual page on this.

Exception style

2014-06-25 Thread Sean Campbell via Digitalmars-d-learn
i know you can use both throw new Exception(msg); and module test; class testException { this (string msg) { super(some error info : ~msg); } } throw new testException(msg); but which one is better conforms to the d style?

Re: Exception style

2014-06-25 Thread bearophile via Digitalmars-d-learn
Sean Campbell: but which one is better conforms to the d style? Both are valid. Use the second when you want a more precise exception in your code, this is common in larger programs. Keep in mind that you can allocate an exception in a point and throw it in another. This reduces the

Re: Assosiative array pop

2014-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 25, 2014 09:30:48 seany via Digitalmars-d-learn wrote: Given an assosiative array : int[string] k, is there a way (either phobos or tango) to pop the first element of this array and append it to another array? I can come up with a primitive soluiton: int[string] k; //

Re: Assosiative array pop

2014-06-25 Thread bearophile via Digitalmars-d-learn
seany: int[string] k; // populate k here int[string] j; foreach(sttring key, int val; k) { j[key] = val; break; } This is OK, and you can encapsulate this into a little function. But you are not removing the pair from the first associative array. So you have to remove the item before

Re: Exception style

2014-06-25 Thread Sean Campbell via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 09:54:16 UTC, bearophile wrote: Sean Campbell: but which one is better conforms to the d style? Both are valid. Use the second when you want a more precise exception in your code, this is common in larger programs. Keep in mind that you can allocate an

Re: Assosiative array pop

2014-06-25 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 09:30:54 UTC, seany wrote: Given an assosiative array : int[string] k, is there a way (either phobos or tango) to pop the first element of this array and append it to another array? I can come up with a primitive soluiton: int[string] k; // populate k here

Any GPL video games in D2

2014-06-25 Thread Binarydepth via Digitalmars-d-learn
I would like to show D in action to other programmers/students. Anyone knows of a Video Game coded in D2 ? Thank you

Re: How to I call D code from C# Project?

2014-06-25 Thread FrankLike via Digitalmars-d-learn
On Thursday, 19 June 2014 at 13:59:25 UTC, Kagamin wrote: On Wednesday, 18 June 2014 at 20:55:09 UTC, GoD wrote: D, very fast programming language. But I can not WinForm applications from D. I'm using C# for WinForm applications. DWT and TkD didn't work for you? Can you give us some Design

Re: How to I call D code from C# Project?

2014-06-25 Thread Binarydepth via Digitalmars-d-learn
On Thursday, 19 June 2014 at 04:07:30 UTC, Jesse Phillips wrote: On Wednesday, 18 June 2014 at 23:41:43 UTC, GoD wrote: @Jesse How to use in C# projects? You'll have to access it through a COM interface on the C# side. http://msdn.microsoft.com/en-us/library/aa645736%28v=vs.71%29.aspx If

Re: Any GPL video games in D2

2014-06-25 Thread Leandro Motta Barros via Digitalmars-d-learn
Hi, Some time ago I wrote this Tetris-like game: https://bitbucket.org/lmb/anytris (also on GitHub: https://github.com/lmbarros/Anytris) Nothing fancy. I am sure there are better examples out there. And maybe this is not the best code to show to students ;-) Also, license is ZLib -- I assume it

Using attributes inside template instantiation

2014-06-25 Thread Uranuz via Digitalmars-d-learn
I'm trying to declare format for database record in compile time. I consider to use attributes fo this. Can I do something similar to this code? struct RecordFormat(T) {} alias Format = RecordFormat!( @(cool) int ); pragma( msg, Format ); void main() { } Or I want something strange

Re: Any GPL video games in D2

2014-06-25 Thread Namespace via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote: I would like to show D in action to other programmers/students. Anyone knows of a Video Game coded in D2 ? Thank you Here are two: http://dgame-dev.de/?page=show

Re: Using attributes inside template instantiation

2014-06-25 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
UDA's are compile-time metadata associated with a specific declaration. So in something like: @foo int x; The @foo is attached to x, but is not part of the type.

Re: Using attributes inside template instantiation

2014-06-25 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jun 25, 2014 at 05:10:06PM +, Chris Nicholson-Sauls via Digitalmars-d-learn wrote: UDA's are compile-time metadata associated with a specific declaration. So in something like: @foo int x; The @foo is attached to x, but is not part of the type. The term attribute is a bit

DDoc and private members / mixins / UDAs

2014-06-25 Thread Stefan Frijters via Digitalmars-d-learn
Let me preface this by admitting that I'm not sure I'm using the DDoc functionality properly at all, so let me know if my questions are bogus. Is it possible to: - Add private members to documentation? - Have DDoc do its thing after mixins have been handled? - Access UDAs? To expand on the

expose class declared in unittest

2014-06-25 Thread rcor via Digitalmars-d-learn
I'm trying to create a set of utility functions that cache objects of various types loaded from json files, but having trouble testing it. One function I'd like to test uses new to instantiate an object based on a compile-time parameter: void loadDataFile(T)(string filename) { ... T obj =

Re: expose class declared in unittest

2014-06-25 Thread Meta via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 20:17:35 UTC, rcor wrote: I'm trying to create a set of utility functions that cache objects of various types loaded from json files, but having trouble testing it. One function I'd like to test uses new to instantiate an object based on a compile-time parameter:

Using two flags in conditonal compilation (version)

2014-06-25 Thread Danyal Zia via Digitalmars-d-learn
Hi, In the development of my library, I'm in a position where I need to add support for multiple compilers. For instance, supporting both the assembly of LDC/DMD and GDC. I want to do something like: version(DigitalMars LDC) { } However, it doesn't compile which forces me to rewrote the

Re: expose class declared in unittest

2014-06-25 Thread rcor via Digitalmars-d-learn
I don't completely understand your problem, but have you tried marking the class as static? static class Dummy { ... } I was about to post links to the actual code to make it more clear, but that did the trick. Thanks for the fast reply. Just to make sure - given: unittest { static class

Re: Using two flags in conditonal compilation (version)

2014-06-25 Thread bearophile via Digitalmars-d-learn
Danyal Zia: Is there a way to check both versions at the same time? (I can't seem to find the solution through google, sorry) This is close to being the best solution in D (untested): version(DigitalMars) enum myMars = true; else enum myMars = false; version(LDC) enum myLdc = true; else enum

Re: Using two flags in conditonal compilation (version)

2014-06-25 Thread Justin Whear via Digitalmars-d-learn
On Wed, 25 Jun 2014 20:24:30 +, Danyal Zia wrote: Hi, In the development of my library, I'm in a position where I need to add support for multiple compilers. For instance, supporting both the assembly of LDC/DMD and GDC. I want to do something like: version(DigitalMars LDC) { }

Returning fixed size arrays

2014-06-25 Thread bearophile via Digitalmars-d-learn
Is it possible and a good idea to change the D ABI to make code like this avoid an array copy in 100% of the cases (without inlining)? ubyte[1000] foo() nothrow @safe { typeof(return) data; // some code here. return data; } void main() nothrow { immutable data = foo(); }

Re: Returning fixed size arrays

2014-06-25 Thread bearophile via Digitalmars-d-learn
Is it possible and a good idea to change the D ABI to make code like this avoid an array copy in 100% of the cases (without inlining)? I meant, letting the compiler rewrite that code like this: void foo(ref ubyte[1000] __data) nothrow @safe { __data[] = 0; // some code here. } void

Re: Any GPL video games in D2

2014-06-25 Thread Binarydepth via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 15:35:25 UTC, Leandro Motta Barros via Digitalmars-d-learn wrote: Hi, Some time ago I wrote this Tetris-like game: https://bitbucket.org/lmb/anytris (also on GitHub: https://github.com/lmbarros/Anytris) Nothing fancy. I am sure there are better examples out there.

Re: Any GPL video games in D2

2014-06-25 Thread Binarydepth via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 16:37:13 UTC, Namespace wrote: On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote: I would like to show D in action to other programmers/students. Anyone knows of a Video Game coded in D2 ? Thank you Here are two: http://dgame-dev.de/?page=show

Re: Returning fixed size arrays

2014-06-25 Thread Tobias Pankrath via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 20:55:47 UTC, bearophile wrote: Is it possible and a good idea to change the D ABI to make code like this avoid an array copy in 100% of the cases (without inlining)? ubyte[1000] foo() nothrow @safe { typeof(return) data; // some code here. return

Re: Returning fixed size arrays

2014-06-25 Thread bearophile via Digitalmars-d-learn
Tobias Pankrath: Isn't this a case for Named Return Value Optimization? Perhaps, but then why aren't dmd/ldc doing it? And the question was if that's possible in the ABI, so it always happens (unless the array is very small). Bye, bearophile

Re: expose class declared in unittest

2014-06-25 Thread rcor via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 20:25:50 UTC, rcor wrote: Dummy will not exist unless compiled with -unittest, correct? Never mind, just verified that this is true. Thanks again.

Re: Any GPL video games in D2

2014-06-25 Thread Namespace via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 21:12:23 UTC, Binarydepth wrote: On Wednesday, 25 June 2014 at 16:37:13 UTC, Namespace wrote: On Wednesday, 25 June 2014 at 14:24:11 UTC, Binarydepth wrote: I would like to show D in action to other programmers/students. Anyone knows of a Video Game coded in D2

Re: Returning fixed size arrays

2014-06-25 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 20:59:29 UTC, bearophile wrote: Is it possible and a good idea to change the D ABI to make code like this avoid an array copy in 100% of the cases (without inlining)? I meant, letting the compiler rewrite that code like this: void foo(ref ubyte[1000] __data)

Re: Momentary Eh?! for a Dynamic Language Programmmer. Tuples vs Arrays. Just rambling.

2014-06-25 Thread Chris Williams via Digitalmars-d-learn
On Monday, 23 June 2014 at 22:08:59 UTC, John Carter wrote: On Monday, 23 June 2014 at 21:26:19 UTC, Chris Williams wrote: More likely what you want are variants: Hmm. Interesting. Yes, Variant and VariantArray are much closer to the dynamic language semantics... But the interesting

Re: DDoc and private members / mixins / UDAs

2014-06-25 Thread Mathias LANG via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 18:49:27 UTC, Stefan Frijters wrote: Let me preface this by admitting that I'm not sure I'm using the DDoc functionality properly at all, so let me know if my questions are bogus. Is it possible to: - Add private members to documentation? - Have DDoc do its thing

Re: Using two flags in conditonal compilation (version)

2014-06-25 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
version(DigitalMars) version = DMDAsm; version(LDC) version = DMDAsm; version(DMDAsm) asm { //dmd/ldc asm here } version(GDC) asm { //gdc asm here } http://dlang.org/version.html#VersionSpecification

Re: Using attributes inside template instantiation

2014-06-25 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 17:21:21 UTC, H. S. Teoh via Digitalmars-d-learn wrote: The term attribute is a bit confusing, especially since property is also used in the language to refer to something completely different. A better term is perhaps annotation. The @foo is an annotation on x,