Re: static init of associative array of enums not working.. why?

2016-02-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 27 February 2016 at 04:37:24 UTC, Øivind wrote: Should I file a ticket for this? It is already known, just nobody has fixed it yet (and probably won't for a long time still)

Re: static init of associative array of enums not working.. why?

2016-02-26 Thread Øivind via Digitalmars-d-learn
On Saturday, 27 February 2016 at 04:35:41 UTC, Adam D. Ruppe wrote: It just isn't implemented in the compiler. Instead, you can declare it outside and set it in a static module constructor: That was quick! Thank you. Should I file a ticket for this?

Re: static init of associative array of enums not working.. why?

2016-02-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 27 February 2016 at 04:15:06 UTC, Øivind wrote: Shouldn't this work? According to "Static Initialization of AAs" on this page, it should: https://dlang.org/spec/hash-map.html It just isn't implemented in the compiler. Instead, you can declare it outside and set it in a static mod

static init of associative array of enums not working.. why?

2016-02-26 Thread Øivind via Digitalmars-d-learn
Shouldn't this work? According to "Static Initialization of AAs" on this page, it should: https://dlang.org/spec/hash-map.html enum DevicePropDataType { dString, dDateTime } enum DevicePropValType { property, miscDate } immutable DevicePropDataType[DevicePropValType] propDType = [

Re: Calling python code from D

2016-02-26 Thread cym13 via Digitalmars-d-learn
On Friday, 26 February 2016 at 17:15:02 UTC, Wyatt wrote: On Thursday, 25 February 2016 at 22:28:52 UTC, jmh530 wrote: I think PyD is really your best option. That's what I figured, but I wanted to be sure because, well... http://pyd.readthedocs.org/en/latest/embed.html ...these are some s

Re: GStreamer and D

2016-02-26 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2016-02-26 at 14:40 +, Kagamin via Digitalmars-d-learn wrote: > https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html > /chapter-helloworld.html#section-helloworld - Hello world. > https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html > /index.html - GStr

Re: Calling python code from D

2016-02-26 Thread John Colvin via Digitalmars-d-learn
On Friday, 26 February 2016 at 17:15:02 UTC, Wyatt wrote: On Thursday, 25 February 2016 at 22:28:52 UTC, jmh530 wrote: I think PyD is really your best option. That's what I figured, but I wanted to be sure because, well... http://pyd.readthedocs.org/en/latest/embed.html ...these are some s

Re: Calling python code from D

2016-02-26 Thread Wyatt via Digitalmars-d-learn
On Thursday, 25 February 2016 at 22:28:52 UTC, jmh530 wrote: I think PyD is really your best option. That's what I figured, but I wanted to be sure because, well... http://pyd.readthedocs.org/en/latest/embed.html ...these are some sparse docs. I did stumble into them, but it feels like a b

Re: Shared static constructors from C# EXE

2016-02-26 Thread Thalamus via Digitalmars-d-learn
On Friday, 26 February 2016 at 08:37:35 UTC, Benjamin Thaut wrote: On Thursday, 25 February 2016 at 17:46:18 UTC, Thalamus wrote: On Thursday, 25 February 2016 at 16:05:37 UTC, Benjamin Thaut wrote: [...] Thanks Benjamin. When I went to whittle this down to its barest essentials, though, the

Re: dub: how to reference a compiled package

2016-02-26 Thread Chris Wright via Digitalmars-d-learn
On Fri, 26 Feb 2016 03:19:26 +, mahdi wrote: > Great! Thanks. > > I was looking for a feature like `jar` files in Java or `assemblies` in > C# where all compiled code and metadata/symbols are stored together > inside a single binary file. C# and Java provide their own linkers and specify the

Re: Minimise and collect by GC when OutOfMemory

2016-02-26 Thread Chris Wright via Digitalmars-d-learn
On Fri, 26 Feb 2016 05:47:08 +, tcak wrote: > Would it be a good idea to call "collect" and "minimize" methods of > core.memory.GC when OutOfMemory error is received FOR A LONG RUNNING > PROGRAM? or there won't be any benefit of that? > > Example program: A web server that allocates and relea

Re: GStreamer and D

2016-02-26 Thread Kagamin via Digitalmars-d-learn
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html#section-helloworld - Hello world. https://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html - GStreamer Application Development Manual http://docs.gstreamer.com/display/GstSDK/Bas

Re: Dynamic pitch shift

2016-02-26 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 26 February 2016 at 13:21:12 UTC, Guillaume Piolat wrote: We are not talking of the same thing. I was thinking about the table frequency cutoff which is 2x lower every level of mipmap Ok. I think is most common to use high levels of oversampling for tables so one can get better SNR

Re: how to initialise const variables

2016-02-26 Thread cym13 via Digitalmars-d-learn
On Friday, 26 February 2016 at 03:18:02 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 02:48:35 UTC, cym13 wrote: On Friday, 26 February 2016 at 02:32:44 UTC, Nicholas Wilson wrote: struct A { const (void *) p; } struct B { Aa; this(void * _p) { a.p = _

Re: Template this parameter in constructor

2016-02-26 Thread Vlad Leberstein via Digitalmars-d-learn
On Sunday, 21 February 2016 at 21:48:21 UTC, Steven Schveighoffer wrote: This isn't a bug. Here is what happens. 1. template this is assigned the compile-time type of the object *when the function is called*. 2. A base class constructor is called from the next derived constructor. So C2's c

Re: Dynamic pitch shift

2016-02-26 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 25 February 2016 at 07:02:24 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 24 February 2016 at 17:52:39 UTC, Guillaume Piolat wrote: Though it isn't fantastic aliasing-wise on the last octave, I should try something than power-of-2s next time I need it. Why would it help to not us

Re: Dynamic pitch shift

2016-02-26 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Thursday, 25 February 2016 at 15:15:20 UTC, Luis wrote: - Wavetables - band-limited resampling algorithm aka BLIP or BLEP algorithms (See http://www.cs.cmu.edu/~eli/L/icmc01/hardsync.html and http://slack.net/~ant/libs/audio.html#Blip_Buffer ) I suggest just porting STK from C++ to D. It i

Re: Using double value in string template mixin

2016-02-26 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:37:32 UTC, BBasile wrote: Erratum! Actually you can, example: import std.stdio; string foo(double a)() { return "auto value = " ~ a.stringof ~ ";"; } void main(string[] args) { mixin(foo!0.1); writeln(value); // 0.1 writeln(typeof(value).string

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:26:51 UTC, BBasile wrote: No you cannot because you would have to convert the values to string using std.conv.to or std.format.format(), but they don't work at compile time (see https://issues.dlang.org/show_bug.cgi?id=13568). Erratum! Actually you can, examp

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:13:08 UTC, Dibyendu Majumdar wrote: I am trying something like this: template MyTAlloc(int n_vars, double v) { const char[] MyT = "MyT_init(cast(MyT *) alloca(alloc_size(" ~ n_vars ~ ")), " ~ n_vars ~ ", " ~ v ~ ")"; No you cannot because you would have to co

Re: Using double value in string template mixin

2016-02-26 Thread Dibyendu Majumdar via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:07:28 UTC, BBasile wrote: On Friday, 26 February 2016 at 11:03:43 UTC, Dibyendu Majumdar wrote: How do I use a double value in a mixin template that is generating string? Have you an example of what's failing right now to show ? I am trying something like th

Re: Using double value in string template mixin

2016-02-26 Thread BBasile via Digitalmars-d-learn
On Friday, 26 February 2016 at 11:03:43 UTC, Dibyendu Majumdar wrote: Hi, How do I use a double value in a mixin template that is generating string? Thanks and Regards Dibyendu Have you an example of what's failing right now to show ?

Using double value in string template mixin

2016-02-26 Thread Dibyendu Majumdar via Digitalmars-d-learn
Hi, How do I use a double value in a mixin template that is generating string? Thanks and Regards Dibyendu

GStreamer and D

2016-02-26 Thread Russel Winder via Digitalmars-d-learn
Has anyone got any examples of using GStreamer from D. I found that GtkD packages a GStreamer API which is great, but there are very few example codes – at least that I have found. -- Russel. = Dr Russel Winder t: +4

Re: how do you append arrays?

2016-02-26 Thread Ali Çehreli via Digitalmars-d-learn
On 02/26/2016 01:01 AM, Ali Çehreli wrote: On 02/26/2016 12:47 AM, asdf wrote: Trying to uncook the terminal failed however. It can't recognize struct tag-declarations I think: I've just found the following code among my collection of D snippets, which uses a different method and supports Ct

Re: how do you append arrays?

2016-02-26 Thread Ali Çehreli via Digitalmars-d-learn
On 02/26/2016 12:47 AM, asdf wrote: Trying to uncook the terminal failed however. It can't recognize struct tag-declarations I think: The following compiles and seems to work. I've marked my changes with // Ali: /* copy-paste code from: http://tldp.org/HOWTO/Serial-Programming-HOWTO/x

Re: how do you append arrays?

2016-02-26 Thread asdf via Digitalmars-d-learn
On Friday, 26 February 2016 at 00:40:40 UTC, Steven Schveighoffer wrote: ugh! history = line ~ history[0 .. $ - 1]; That works alot better =) Trying to uncook the terminal failed however. It can't recognize struct tag-declarations I think: /* copy-paste code from: http://tldp.org/HO

Re: Shared static constructors from C# EXE

2016-02-26 Thread Benjamin Thaut via Digitalmars-d-learn
On Thursday, 25 February 2016 at 17:46:18 UTC, Thalamus wrote: On Thursday, 25 February 2016 at 16:05:37 UTC, Benjamin Thaut wrote: [...] Thanks Benjamin. When I went to whittle this down to its barest essentials, though, the repro is pretty simple. It involves LIBs, but not Dlls, and it doe

Re: Installing DUB on OSX

2016-02-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-02-25 22:38, Joel wrote: .dub is grayed out on Finder, and isn't writable. I'm suspecting that you don't own that directory. You can see the owner by running this: ls -l -a ~/ | grep dub The third column is the owner. You change the owner like this from the Terminal: sudo chown