having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
It seems like `std.algorithm.each` is not executed in the example below. Could anyone tell why? Thank you. import std.algorithm; void main(string[] args) { int[] arr = [1, 2, 3, 4, 5]; arr.each!((ref e) => { writeln(e); // does not print ++e;

Re: having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
DMD 2.069.1 OS Win8.1 Enterprise

vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Nordlöw via Digitalmars-d-learn
Can somebody please show a enlightening example of, so called, "revamp of the REST interface generator" added to release 0.7.26 at: http://vibed.org/blog/posts/vibe-release-0.7.26 I want to use vibe.d to add a modern dynamic web-interface to my knowledge graph I'm currently developing.

Re: Classes as enums in D?

2015-11-30 Thread Marc Schütz via Digitalmars-d-learn
On Monday, 30 November 2015 at 08:08:20 UTC, Meta wrote: class WhiteKey { private immutable int halfStepsToNext; private immutable int halfStepsToPrevious; enum { A = new WhiteKey(2, 2), B = new WhiteKey(2, 1), C =

Re: DUB, Platform specifications and dependencies

2015-11-30 Thread Sönke Ludwig via Digitalmars-d-learn
Am 24.11.2015 um 19:51 schrieb Zardoz: Actually I'm trying to setup dub to not grab a dependency on Windows ( https://github.com/Zardoz89/DEDCPU-16/blob/master/dub.sdl ) : name "dedcpu" authors "Luis Panadero Guardeño" targetType "none" license "BSD 3-clause" description "DCPU-16 tools"

Re: DateTime.opBinary

2015-11-30 Thread Chris Wright via Digitalmars-d-learn
On Mon, 30 Nov 2015 01:30:28 -0800, Jonathan M Davis via Digitalmars-d-learn wrote: > On Sunday, November 29, 2015 23:53:41 Chris Wright via > Digitalmars-d-learn wrote: >> Unfortunately, ddoc doesn't automatically cross-reference these for >> you, >> which results in confusion. (As if it weren't

Re: Any D IDE on Mac OSX with debugging support?

2015-11-30 Thread Bruno Medeiros via Digitalmars-d-learn
On 16/11/2015 06:45, Vadim Lopatin wrote: Hello, Is there any IDE which allows debugging D apps on OSX? I'm trying Mono-D, but getting error "Debugger operation failed A syntax error in expression, near 'sizeof(void*)'" GDB is installed using homebrew. Probably, something is wrong with my

Re: Can't understand how to do server response with vibed

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 29 November 2015 at 07:37:56 UTC, Suliman wrote: On Saturday, 28 November 2015 at 23:21:21 UTC, Sebastiaan Koppe wrote: On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 30 November 2015 at 10:08:17 UTC, Nordlöw wrote: Can somebody please show a enlightening example of, so called, "revamp of the REST interface generator" added to release 0.7.26 at: http://vibed.org/blog/posts/vibe-release-0.7.26 I want to use vibe.d to add a modern dynamic

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread David DeWitt via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:05:42 UTC, Sebastiaan Koppe wrote: Code can be found here: https://bitbucket.org/skoppe/mpc/src Looks good. Have you looked at Redux and Webpack? I am working on a Redux example and we have switched to Webpack and Redux at work and it is nice.

Re: DUB, Platform specifications and dependencies

2015-11-30 Thread Zardoz via Digitalmars-d-learn
On Monday, 30 November 2015 at 16:54:43 UTC, Sönke Ludwig wrote: Am 24.11.2015 um 19:51 schrieb Zardoz: Actually I'm trying to setup dub to not grab a dependency on Windows ( https://github.com/Zardoz89/DEDCPU-16/blob/master/dub.sdl ) : name "dedcpu" authors "Luis Panadero Guardeño"

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:23:48 UTC, David DeWitt wrote: Have you looked at Redux and Webpack? I am working on a Redux example and we have switched to Webpack and Redux at work and it is nice. I know about both yes. Webpack would probably beat browserify, but I haven't gotten the

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread David DeWitt via Digitalmars-d-learn
On Monday, 30 November 2015 at 20:38:12 UTC, Sebastiaan Koppe wrote: On Monday, 30 November 2015 at 20:23:48 UTC, David DeWitt wrote: Have you looked at Redux and Webpack? I am working on a Redux example and we have switched to Webpack and Redux at work and it is nice. I know about both

Re: isAllocator

2015-11-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 01/12/15 3:23 AM, Tofu Ninja wrote: On Monday, 30 November 2015 at 14:21:49 UTC, Tofu Ninja wrote: Is there something like isInputRange for allocators, I tried looking for something but couldn't find anything? If not, why not? Aka, some way to check that type T is an allocator. Doesn't

need help with Windows CreateNamedPipe Security attributes process with undefined symbols at compile time

2015-11-30 Thread Jonathan Villa via Digitalmars-d-learn
Hi, I've been trying to create a NamedPipe with security attributes but at compile time throws: Error 42: Symbol Undefined _InitializeSecurityDescriptor@8 Error 42: Symbol Undefined _SetSecurityDescriptorDacl@16 This is my code, I'm trying to do it using a class: module asi.pipe; import

Re: need help with Windows CreateNamedPipe Security attributes process with undefined symbols at compile time

2015-11-30 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 1 December 2015 at 04:10:55 UTC, Jonathan Villa wrote: Hi, I've been trying to create a NamedPipe with security attributes but at compile time throws: Error 42: Symbol Undefined _InitializeSecurityDescriptor@8 Error 42: Symbol Undefined _SetSecurityDescriptorDacl@16 What is

Re: Classes as enums in D?

2015-11-30 Thread Andrew LaChance via Digitalmars-d-learn
On Monday, 30 November 2015 at 08:08:20 UTC, Meta wrote: This doesn't quite work in D; you'd have to make each WhiteKey const (which is probably not a bad idea anyway if you're using it like an enum). However, it's better to just do this with plain old value-type structs. It's exactly the same

Re: vibe.d-example illustrating Dynamic Textual Web-Interface

2015-11-30 Thread Sönke Ludwig via Digitalmars-d-learn
Am 30.11.2015 um 11:08 schrieb Nordlöw: Can somebody please show a enlightening example of, so called, "revamp of the REST interface generator" added to release 0.7.26 at: http://vibed.org/blog/posts/vibe-release-0.7.26 I want to use vibe.d to add a modern dynamic web-interface to my

Re: Classes as enums in D?

2015-11-30 Thread Andrew LaChance via Digitalmars-d-learn
On Monday, 30 November 2015 at 07:54:49 UTC, Rikki Cattermole wrote: enums don't have to be integral, but for performance reasons it is for the best. enum Foo : string { A = "a", B = "b", C = "d", ERROR = "What are you talking about?" } void main() { import std.stdio :

Re: Classes as enums in D?

2015-11-30 Thread Meta via Digitalmars-d-learn
On Monday, 30 November 2015 at 07:48:37 UTC, Andrew LaChance wrote: Hello, D has intrigued me for a while, and I thought I would finally read up on it! I've been reading "Programming in D" by Ali Çehreli and I've been thinking about how I can use the language in a side project I'm working

Re: Classes as enums in D?

2015-11-30 Thread Mike Parker via Digitalmars-d-learn
On Monday, 30 November 2015 at 07:58:43 UTC, Andrew LaChance wrote: Oh interesting. So you are saying I could have a struct WhiteKey {...} and then an enum that extends WhiteKey? enums can't *extend* anything. You can do this: struct WhiteKeyS { immutable int halfStepsToPrevious;

Re: Classes as enums in D?

2015-11-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 30/11/15 8:58 PM, Andrew LaChance wrote: On Monday, 30 November 2015 at 07:54:49 UTC, Rikki Cattermole wrote: enums don't have to be integral, but for performance reasons it is for the best. enum Foo : string { A = "a", B = "b", C = "d", ERROR = "What are you talking about?"

Re: Constness understanding

2015-11-30 Thread Kagamin via Digitalmars-d-learn
Unfortunately in D constant doesn't mean constant :( it means readonly: you can read it, but it can change in other ways. Immutable means constant - doesn't change in any way.

Re: having problem with `std.algorithm.each`

2015-11-30 Thread anonymous via Digitalmars-d-learn
On 30.11.2015 11:50, visitor wrote: though i don"t understand why it fails silently ?? ref2491's original code is valid, but doesn't have the intended meaning. `e => {foo(e);}` is the same as `(e) {return () {foo(e);};}`, i.e. a (unary) function that returns a (nullary) delegate. Calling it

Re: having problem with `std.algorithm.each`

2015-11-30 Thread visitor via Digitalmars-d-learn
On Monday, 30 November 2015 at 09:56:08 UTC, ref2401 wrote: DMD 2.069.1 OS Win8.1 Enterprise in a multiline statement, i believe you must use : arr.each!((ref e) { writeln(e); ++e; }) "=>" is for oneliner though i don"t understand why it fails silently ??

Re: Constness understanding

2015-11-30 Thread drug via Digitalmars-d-learn
On 30.11.2015 13:27, Kagamin wrote: Unfortunately in D constant doesn't mean constant :( it means readonly: you can read it, but it can change in other ways. Immutable means constant - doesn't change in any way. Thanks, considering 'const' as 'readonly' explains my case rather well.

Pixelbuffer to draw on a surface

2015-11-30 Thread TheDGuy via Digitalmars-d-learn
Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds?

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread lobo via Digitalmars-d-learn
On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote: Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds? Are any of these suitable for your needs? https://github.com/DerelictOrg/DerelictSDL2

Constness understanding

2015-11-30 Thread drug via Digitalmars-d-learn
I have some struct and other struct stores reference to the first one like a pointer to constant. Nevertheless I can change the value of the first struct. Is it some hack? http://dpaste.dzfl.pl/0dfa3dff2df7

Re: DateTime.opBinary

2015-11-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, November 29, 2015 23:53:41 Chris Wright via Digitalmars-d-learn wrote: > Unfortunately, ddoc doesn't automatically cross-reference these for you, > which results in confusion. (As if it weren't confusing enough to have > everything wrapped in templates with filters rather than simply

Re: Classes as enums in D?

2015-11-30 Thread Meta via Digitalmars-d-learn
On Monday, 30 November 2015 at 10:22:54 UTC, Marc Schütz wrote: You're misinterpreting this: enum X { A = new Object, B = new Object, } void main() { import std.stdio; writeln(cast(void*) X.A); writeln(cast(void*) X.A); } # output:

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread TheDGuy via Digitalmars-d-learn
On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote: On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote: Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds? Are any of these suitable for your

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread visitor via Digitalmars-d-learn
but there is no specific solution inside GTKD? for example, in pseudo code auto surf = new Surface(...); // look for cairo.Surface doc auto cr = cairo.Context.Context.create(surf); // pb is an existing gdkpixbuf.Pixbuf gdk.Cairo.setSourcePixbuf(cr, pb, width, height); cr.paint(); adding

Re: having problem with `std.algorithm.each`

2015-11-30 Thread visitor via Digitalmars-d-learn
On Monday, 30 November 2015 at 12:03:08 UTC, anonymous wrote: On 30.11.2015 11:50, visitor wrote: though i don"t understand why it fails silently ?? ref2491's original code is valid, but doesn't have the intended meaning. `e => {foo(e);}` is the same as `(e) {return () {foo(e);};}`, i.e. a

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread drug via Digitalmars-d-learn
On 30.11.2015 16:09, drug wrote: On 30.11.2015 15:49, TheDGuy wrote: On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote: On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote: Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update

Re: Pixelbuffer to draw on a surface

2015-11-30 Thread drug via Digitalmars-d-learn
On 30.11.2015 15:49, TheDGuy wrote: On Monday, 30 November 2015 at 09:09:00 UTC, lobo wrote: On Monday, 30 November 2015 at 08:37:04 UTC, TheDGuy wrote: Hi, is there any possibility, to draw with a pixelbuffer to a surface (for example with GTKD) and to update it every few milliseconds? Are

Re: having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
On Monday, 30 November 2015 at 12:03:08 UTC, anonymous wrote: On 30.11.2015 11:50, visitor wrote: though i don"t understand why it fails silently ?? ref2491's original code is valid, but doesn't have the intended meaning. `e => {foo(e);}` is the same as `(e) {return () {foo(e);};}`, i.e. a

Re: isAllocator

2015-11-30 Thread Tofu Ninja via Digitalmars-d-learn
On Monday, 30 November 2015 at 14:21:49 UTC, Tofu Ninja wrote: Is there something like isInputRange for allocators, I tried looking for something but couldn't find anything? If not, why not? Aka, some way to check that type T is an allocator.

isAllocator

2015-11-30 Thread Tofu Ninja via Digitalmars-d-learn
Is there something like isInputRange for allocators, I tried looking for something but couldn't find anything? If not, why not?

Re: switch with enum

2015-11-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/25/15 12:17 AM, tcak wrote: On Wednesday, 25 November 2015 at 03:59:01 UTC, Steven Schveighoffer wrote: On 11/24/15 10:51 PM, tcak wrote: I have seen a code a while ago, but even by looking at documentation, I couldn't have found anything about it. Let's say I have defined an enum;