Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 18:20:16 UTC, Ola Fosheim Grøstad wrote: I'm not sure if the current collector scans all registers, or just scans the stack? According to the docs it scans all registers, but even then one must be careful and do addRoot before the pointer is set, otherwise

Re: Simple template constraint question

2015-09-19 Thread anonymous via Digitalmars-d-learn
On Saturday 19 September 2015 19:09, WhatMeWorry wrote: > And a more open ended question. Is there a more elegant solution > for the > below function? Maybe a one-liner? I have a knack for making > simple solutions > complex :) > > > > // Calculate the number of components for openGL

[Issue 15079] Assertion `fd->semanticRun == PASSsemantic3done' failed.

2015-09-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15079 Martin Nowak changed: What|Removed |Added CC||c...@dawg.eu --- Comment #1

Re: Contracts with interface

2015-09-19 Thread BBasile via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:33:12 UTC, tchaloupka wrote: This bites me again: import std.stdio; interface ITest { void test(); void test2() in { writeln("itest2"); } void test3() in { writeln("itest3"); } void test4() in { writeln("itest4");

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread anonymous via Digitalmars-d-learn
On Sunday 20 September 2015 00:09, Random D user wrote: > class Gui > { > enum MouseButton { Left = 0, Right }; > > private: > > struct ClickPair > { > MouseButton button = MouseButton.Left; > }; > > struct ClickPair // Second struct ClickPair with the enum

text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole.

Re: text wrap

2015-09-19 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote: What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole. http://dlang.org/phobos/std_string.html#.wrap

[Issue 15087] DDoc: Add function attributes section for templates

2015-09-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15087 --- Comment #2 from Jack Stouffer --- I was thinking of a tabular format, like "given these types of inputs it has these attributes". --

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote: So I've got type and value of each member, but I want their actual names? http://dlang.org/phobos/std_traits.html#FieldNameTuple You can also do something

Re: Templated opIndex?

2015-09-19 Thread Ali Çehreli via Digitalmars-d-learn
On 09/19/2015 02:33 AM, OlaOst wrote: > Here is a class with a templated opIndex method, and an attempt to use it: > > class Test > { > int[] numbers = [1, 2, 3]; > string[] texts = ["a", "b", "c"]; > > Type opIndex(Type)(int index) > { > static if (is(Type == int))

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] > Thanks. But now I have an even more fundamental problem. I keep > getting a FieldNameTuple is not defined. But I've clearly got the > import statement. I even copied the example from Phobos verbatim:

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread Ali Çehreli via Digitalmars-d-learn
On 09/19/2015 10:21 PM, WhatMeWorry wrote: On Saturday, 19 September 2015 at 19:54:45 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote: So I've got type and value of each member, but I want their actual names?

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread Ali Çehreli via Digitalmars-d-learn
On 09/19/2015 10:30 PM, H. S. Teoh via Digitalmars-d-learn wrote: On Sun, Sep 20, 2015 at 05:21:03AM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] Thanks. But now I have an even more fundamental problem. I keep getting a FieldNameTuple is not defined. But I've clearly got the

How can a value of a constant be varied through a pointer ?

2015-09-19 Thread RADHA GOGIA via Digitalmars-d-learn
I went through these two links and found that this behaviour is undefined , but the only issue which I have is that in one sense we say that since local variables live on stack , hence they cannot be located on read only memory region but if this is so then if I try to alter the value of the

Re: Dmd master tests are failing with segmentation fault

2015-09-19 Thread Andrei Alexandrescu via Digitalmars-d
On 09/19/2015 01:41 PM, Guillaume Chatelet wrote: On Saturday, 19 September 2015 at 17:38:40 UTC, Guillaume Chatelet wrote: hmm so it's probably coming from druntime or phobos not being build with the correct dmd version... Indeed it was this, sorry for the noise. I wonder how we could make

Re: I'll like to learn D

2015-09-19 Thread DlangLearner via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:42:50 UTC, uNknow123 wrote: On Saturday, 19 September 2015 at 15:09:38 UTC, WhatMeWorry wrote: On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote: Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty similar, but not so similar, if you

Re: Can D do some sort of automatic template to "dynamic template" wrapping

2015-09-19 Thread bitwise via Digitalmars-d
On Saturday, 19 September 2015 at 17:46:27 UTC, Adam wrote: Does any of that make sense? ;) No. Where exactly do these magical dynamic objects come from? How exactly do you expect user input to generate an object which would require an implementation that was not foreseeable at compile

Re: This is probably trivial or impossible Code Introspection...

2015-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 19 September 2015 at 19:52:56 UTC, WhatMeWorry wrote: So I've got type and value of each member, but I want their actual names? http://dlang.org/phobos/std_traits.html#FieldNameTuple You can also do something like `foo.tupleof[idx]["foo.".length .. $]` for an individual thing

This is probably trivial or impossible Code Introspection...

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
given some struct: writeln("face.glyph.bitmap = ", face.glyph.bitmap); which displays the following: face.glyph.bitmap = FT_Bitmap(30, 25, 25, 4105948, 256, 2, 0, null) Is there a way for D to display the variable names within the FT_Bitmap? For instance, the following code snippet

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread Random D user via Digitalmars-d-learn
On Saturday, 19 September 2015 at 07:25:58 UTC, ponce wrote: On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote: So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go

Re: text wrap

2015-09-19 Thread Doxin via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote: What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole. a common method works as follows. first you split your string into chunks

Re: text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:22:17 UTC, Joel wrote: What is simple way to wrap a string into strings? Eg from: I went for a walk and fell down a hole. To (6 max width): I went for a walk and fell down a hole. Actually, I did a search and found this. import std.string.wrap;

Re: Go 1.5

2015-09-19 Thread Daniel Kozak via Digitalmars-d-announce
No, collection could not occure if we speaking about current D GC implementation. So it safe to set pointer before addRoot. Dne 19. 9. 2015 21:00 napsal uživatel "Ola Fosheim Grøstad via Digitalmars-d-announce" : > On Saturday, 19 September 2015 at 18:20:16

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 19:17:38 UTC, Daniel Kozak wrote: No, collection could not occure if we speaking about current D GC implementation. So it safe to set pointer before addRoot. It can be triggered by another thread. Wrong: ptr = somestack.pop(); someglobalptr = ptr; // ptr

Re: Desperately looking for a work-around to load and unload D shared libraries from C on OSX

2015-09-19 Thread Jacob Carlborg via Digitalmars-d
On 2015-09-19 18:53, Martin Nowak wrote: Yikes, pinning the library is really ugly hack around the actual issue. Anyone has an idea how to use the crappy dyld API w/o crashing on unload? I don't think it possible since there's no API to unregister the callback. If nothing helps we could try

Re: Desperately looking for a work-around to load and unload D shared libraries from C on OSX

2015-09-19 Thread bitwise via Digitalmars-d
On Saturday, 19 September 2015 at 16:53:28 UTC, Martin Nowak wrote: On Thursday, 17 September 2015 at 21:13:46 UTC, bitwise wrote: He can simply create a second empty callback in VSTPluginMain which will pin his library: Yikes, pinning the library is really ugly hack around the actual issue.

Re: Release D 2.068.1

2015-09-19 Thread Vladimir Panteleev via Digitalmars-d-announce
On Wednesday, 16 September 2015 at 18:34:48 UTC, Martin Nowak wrote: On Tuesday, 15 September 2015 at 08:39:43 UTC, John Colvin wrote: Where is the VERSION file documented? Why does it need manual intervention only for patch releases and pre-releases? We should prolly remove the manually

How do you handle OutOfMemoryError?

2015-09-19 Thread Enjoys Math via Digitalmars-d-learn
Here's my code: https://drive.google.com/file/d/0B3LYxKGJ4ZI_MV91SkxPVVlSOW8/view?usp=sharing I don't have access to a debugger. Run the code for a few minutes and it tends to crash with a core OutOfMemoryError. Any suggestions welcome including regularly cleaning up memory used. Thanks.

Re: text wrap

2015-09-19 Thread Doxin via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:28:23 UTC, Doxin wrote: I'll get to work on some example code. here you go: http://dpaste.dzfl.pl/e6e715c54c1b do mind that this code has a couple issues, for example handing it a word longer than the break width will make it loop infinitely. word wrap

Re: dmd: failed to launch executable

2015-09-19 Thread Jacob Carlborg via Digitalmars-d
On 2015-09-19 12:21, Rinzler wrote: I don't even have a tool called "type"? Should I install it just for testing this? What? "type" is a shell builtin. -- /Jacob Carlborg

[Issue 15056] [REG2.068.1] Unstored RAII struct return yields bogus error: "cannot mix core.std.stdlib.alloca() and exception handling"

2015-09-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15056 --- Comment #8 from Martin Nowak --- Indeed there is a problem that the dtor codegen for expressions doesn't account for nothrow.

LDC 0.16.0 alpha4 is out! We need your feedback!

2015-09-19 Thread Kai Nacke via Digitalmars-d-announce
Hi everyone, LDC 0.16.0 alpha4, the LLVM-based D compiler, is available for download! This release is based on the 2.067.1 frontend and standard library and supports LLVM 3.1-3.7 (OS X: no support for 3.3). Don't miss to check if your preferred system is supported by this release. There is

Re: Can D do some sort of automatic template to "dynamic template" wrapping

2015-09-19 Thread Adam via Digitalmars-d
On Saturday, 19 September 2015 at 18:36:49 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2015 at 17:46:27 UTC, Adam wrote: I doubt anyone would read all so I'll stop now ;) What you're asking is actually pretty easy. You can just write a function that loops to form the object list

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread Random D user via Digitalmars-d-learn
On Saturday, 19 September 2015 at 21:48:25 UTC, Random D user wrote: Assertion failure: 'type->ty != Tstruct || ((TypeStruct *)type)->sym == this' on line 957 in file 'struct.c' Ok managed to reduce this one to my own copy paste bug. This is invalid code, but compiler shouldn't crash... I'm

Re: How can a value of a constant be varied through a pointer ?

2015-09-19 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:09:52 UTC, RADHA GOGIA wrote: I went through these two links and found that this behaviour is undefined , but the only issue which I have is that in one sense we say that since local variables live on stack , hence they cannot be located on read only memory

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 19:25:31 UTC, Ola Fosheim Grøstad wrote: On Saturday, 19 September 2015 at 19:17:38 UTC, Daniel Kozak wrote: No, collection could not occure if we speaking about current D GC implementation. So it safe to set pointer before addRoot. It can be triggered by

Re: Simple template constraint question

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:18:23 UTC, Daniel Kozak wrote: WhatMeWorry píše v So 19. 09. 2015 v 17:09 +: [...] http://dlang.org/expression.html#IsExpression 3. is ( Type == TypeSpecialization ) import std.stdio; struct S { } class C { } void f(T)(T someStruct) if (is (T ==

Re: Go 1.5

2015-09-19 Thread Daniel Kozak via Digitalmars-d-announce
Dne 19.9.2015 v 21:30 Ola Fosheim Grøstad via Digitalmars-d-announce napsal(a): On Saturday, 19 September 2015 at 19:25:31 UTC, Ola Fosheim Grøstad wrote: On Saturday, 19 September 2015 at 19:17:38 UTC, Daniel Kozak wrote: No, collection could not occure if we speaking about current D GC

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-19 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 September 2015 at 15:01:06 UTC, WhatMeWorry wrote: Sorry, meant to get back but got busy. Yes, works great! Thanks! Not sure why I had so much trouble finding a freetype.dll library. Had no problems with OpenAL and FreeImage. I'm curious how you compiled the DLL that

Re: dmd: failed to launch executable

2015-09-19 Thread Jacob Carlborg via Digitalmars-d
On 2015-09-19 17:32, Laeeth Isharc wrote: He means type ie enter the following line in the console: dmd | head -n 1 No, "type" is a command, a shell builtin, that's why it was inside the quotes. $ type type type is a shell builtin -- /Jacob Carlborg

[Issue 15087] DDoc: Add function attributes section for templates

2015-09-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15087 --- Comment #3 from Jakob Ovrum --- (In reply to Jack Stouffer from comment #2) > I was thinking of a tabular format, like "given these types of inputs it has > these attributes". We can do that without special syntax. I think

Re: Go 1.5

2015-09-19 Thread thedeemon via Digitalmars-d-announce
On Saturday, 19 September 2015 at 09:22:40 UTC, Ola Fosheim Grøstad wrote: Please, let's stop pretending you only have to scan the GC heap. You have to scan all pointers that somehow can lead to something that can lead to something... that points into the GC heap. Yes, good point. One

Re: Get AA key and value type

2015-09-19 Thread Marc Schütz via Digitalmars-d-learn
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote: Hi everybody, I would like to extract key and value type from AA. You can also do it with built-in syntax: template AATypes(AA : K[V], K, V) { alias Key = K; alias Value = V; }

Re: Debugging D shared libraries

2015-09-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 19 September 2015 at 17:41:39 UTC, Laeeth Isharc wrote: On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code:

Re: dmd: failed to launch executable

2015-09-19 Thread Rinzler via Digitalmars-d
On Saturday, 19 September 2015 at 17:44:22 UTC, John Colvin wrote: On Saturday, 19 September 2015 at 16:44:38 UTC, Rinzler wrote: Quick point about paths and so on: if you don't understand what's going on, or have just made a change and want to be sure whether it worked, always open a new

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 17:56:23 UTC, thedeemon wrote: Yes, good point. One should keep root ranges small too. If we carefully use addRoot() and addRange() for data directly pointing to GC heap I think we don't need to let GC scan everything that can lead to this data. This is

Re: Can D do some sort of automatic template to "dynamic template" wrapping

2015-09-19 Thread Adam D. Ruppe via Digitalmars-d
On Saturday, 19 September 2015 at 17:46:27 UTC, Adam wrote: I doubt anyone would read all so I'll stop now ;) What you're asking is actually pretty easy. You can just write a function that loops to form the object list yourself or you could make the template add a static module constructor

Re: Go 1.5

2015-09-19 Thread thedeemon via Digitalmars-d-announce
On Friday, 18 September 2015 at 19:26:27 UTC, Rory wrote: The new GC in Go 1.5 seems interesting. What they say about is certainly interesting. They went the way of classical GC-ed language where write barriers are used actively, allowing to make concurrent, incremental and (eventually, if

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread ponce via Digitalmars-d-learn
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote: So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go away if I disable the optimizer. I get: tym = x1d Internal

Re: Tried release build got ICE, does anyone have a clue what might cause this?

2015-09-19 Thread John Colvin via Digitalmars-d-learn
On Friday, 18 September 2015 at 22:54:43 UTC, Random D user wrote: So I tried to build my project in release for the first time in a long while. It takes like 25x longer to compile and finally the compiler crashes. It seems to go away if I disable the optimizer. I get: tym = x1d Internal

Re: How do you get the min / max of two numbers a, b?

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 03:53:12 UTC, Enjoys Math wrote: I know there's fmax for floats, but what about ints? Thanks. http://p0nce.github.io/d-idioms/#Minimum-or-maximum-of-numbers

Re: broken program, silly error messages, dub

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. To reset DUB state completely: - remove .dub/ directory in the project directory -

Re: Go 1.5

2015-09-19 Thread Dmitry Olshansky via Digitalmars-d-announce
On 18-Sep-2015 23:46, Jack Stouffer wrote: On Friday, 18 September 2015 at 19:26:27 UTC, Rory wrote: [snip] The reason Go has a better GC than D is that Go users have no choice but to use the GC, while D users have a bunch more options. To put it differently - D is a big language that has

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Friday, 18 September 2015 at 19:26:27 UTC, Rory wrote: The new GC in Go 1.5 seems interesting. What they say about is certainly interesting. http://blog.golang.org/go15gc Go 1.6 GC roadmap: https://docs.google.com/document/d/1kBx98ulj5V5M9Zdeamy7v6ofZXX3yPziAf0V27A64Mo/preview

Re: broken program, silly error messages, dub

2015-09-19 Thread Joel via Digitalmars-d-learn
On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote: On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated errors. I've tried resetting dub. To reset DUB state

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 08:36:51 UTC, thedeemon wrote: full heap every time. And that leads to different usage pattern where GC heap should remain small and GC allocation rate low. Please, let's stop pretending you only have to scan the GC heap. You have to scan all pointers that

Re: Why do abstract class functions require definitions?

2015-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-09-18 17:45, Jakob Ovrum wrote: That's `export`. Right, my bad. D has too many attributes :) -- /Jacob Carlborg

Re: dmd: failed to launch executable

2015-09-19 Thread Rinzler via Digitalmars-d
On Saturday, 19 September 2015 at 10:17:21 UTC, Jacob Carlborg wrote: On 2015-09-19 12:05, Rinzler wrote: what does "which dmd" give you? Nothing... And "type dmd | head -n 1"? If that gives you some kind of path, what does then "file " print? I don't even have a tool called "type"?

Re: broken program, silly error messages, dub

2015-09-19 Thread Joel via Digitalmars-d-learn
On Saturday, 19 September 2015 at 08:33:05 UTC, Joel wrote: On Saturday, 19 September 2015 at 07:24:01 UTC, ponce wrote: On Saturday, 19 September 2015 at 01:54:08 UTC, Joel wrote: I accidentally wiped off a small source file. I've been trying to put it back together. Now I get unrelated

Re: dmd: failed to launch executable

2015-09-19 Thread Rinzler via Digitalmars-d
what does "which dmd" give you? Nothing...

Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code: extern(C) double sequential(const int n, const double delta) { Runtime.initialize(); const pi = 4.0 * delta * reduce!(

Re: Jai Primer

2015-09-19 Thread Klaim - Joël Lamotte via Digitalmars-d
On 18 September 2015 at 14:35, qznc via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > > I don't see any runtime polymorphism. Isn't that desirable for games? > This language is experimental work in progress made on spare time, so the author think about what he wants to add or not add

Re: Debugging D shared libraries

2015-09-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). [...] I heard it crashed during the talk. Bummer. I should really be there, seeing as I

Re: dmd: failed to launch executable

2015-09-19 Thread Jacob Carlborg via Digitalmars-d
On 2015-09-19 12:05, Rinzler wrote: what does "which dmd" give you? Nothing... And "type dmd | head -n 1"? If that gives you some kind of path, what does then "file " print? -- /Jacob Carlborg

Re: Templated opIndex?

2015-09-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 September 2015 at 09:33:02 UTC, OlaOst wrote: Here is a class with a templated opIndex method, and an attempt to use it: class Test { int[] numbers = [1, 2, 3]; string[] texts = ["a", "b", "c"]; Type opIndex(Type)(int index) {

Re: Get AA key and value type

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote: So how can I get types without instance ? Thanks for help. -->8- template AATypes(T) { // todo: static assert if T is no AA type here alias ArrayElementType!(typeof(T.init.keys)) key; alias

[Issue 14263] Missing sections core.sys.windows.dll & std.c.windows.windows in runtime documentation

2015-09-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14263 --- Comment #5 from Anton Pastukhov --- Err.. core.stdc docs are missing as well. --

Templated opIndex?

2015-09-19 Thread OlaOst via Digitalmars-d-learn
Here is a class with a templated opIndex method, and an attempt to use it: class Test { int[] numbers = [1, 2, 3]; string[] texts = ["a", "b", "c"]; Type opIndex(Type)(int index) { static if (is(Type == int))

Contracts with interface

2015-09-19 Thread tchaloupka via Digitalmars-d-learn
This bites me again: import std.stdio; interface ITest { void test(); void test2() in { writeln("itest2"); } void test3() in { writeln("itest3"); } void test4() in { writeln("itest4"); assert(false); } } class Test: ITest { void test() in {

Re: Debugging D shared libraries

2015-09-19 Thread ponce via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code: extern(C) double sequential(const int n, const double delta)

Get AA key and value type

2015-09-19 Thread Pierre via Digitalmars-d-learn
Hi everybody, I would like to extract key and value type from AA. I found this answer on forum : template AATypes(T) { // todo: static assert if T is no AA type here alias ArrayElementType!(typeof(T.keys)) key; alias ArrayElementType!(typeof(T.values)) value; } But compiler failed,I

I'll like to learn D

2015-09-19 Thread uNknow123 via Digitalmars-d-learn
Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty similar, but not so similar, if you understan me. In Pawn we have to write just some words, and the Plugin is done, why Plugin, 'cuse Pawn = Scripting for Cs 1.6 and Sa:Mp. So, I am a rookie, can you help me please?

Re: Templated opIndex?

2015-09-19 Thread OlaOst via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:16:58 UTC, John Colvin wrote: On Saturday, 19 September 2015 at 09:33:02 UTC, OlaOst wrote: [...] 2 approaches: 1) use a function instead. E.g. test.get!int(0); isn't too bad 2) If you really want to use [], do something like this: [...] Thanks, option

Re: Templated opIndex?

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
And this: class TestInt: Test { alias opIndex = super.opIndex!int; } class TestString: Test { alias opIndex = super.opIndex!string; }

Re: Go 1.5

2015-09-19 Thread Rory McGuire via Digitalmars-d-announce
The impression I got reading the article was that their GC was very much like our current one except that the marking part of the algorithm was run concurrently. That is the only reason I shared the article. To me it seems one should be to mark variables/types with which style of memory

Re: Templated opIndex?

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
And this? auto ref qua(T)(Test t){ struct wrap { Test t; T opIndex(int i){ return t.opIndex!T(i); } } return wrap(t); } void main() { auto test = new Test(); writeln(test.qua!string[0], test.qua!int[0]); }

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 18 September 2015 at 16:34:16 UTC, BBasile wrote: On Friday, 18 September 2015 at 00:13:41 UTC, BBasile wrote: On Thursday, 17 September 2015 at 22:22:22 UTC, WhatMeWorry wrote: [...] After hours of reading existing freetype/derelict documents, I'm stuck again. Any suggestions.

Re: Go 1.5

2015-09-19 Thread Ola Fosheim Grøstad via Digitalmars-d-announce
On Saturday, 19 September 2015 at 14:12:10 UTC, Rory McGuire wrote: The impression I got reading the article was that their GC was very much like our current one except that the marking part of the algorithm was run concurrently. It is quite different. As mentioned they also protect writes to

Re: I'll like to learn D

2015-09-19 Thread WhatMeWorry via Digitalmars-d-learn
On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote: Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty similar, but not so similar, if you understan me. In Pawn we have to write just some words, and the Plugin is done, why Plugin, 'cuse Pawn = Scripting for Cs 1.6 and

Re: Get AA key and value type

2015-09-19 Thread Pierre via Digitalmars-d-learn
On Saturday, 19 September 2015 at 12:52:19 UTC, ponce wrote: On Saturday, 19 September 2015 at 12:50:51 UTC, Pierre wrote: So how can I get types without instance ? Thanks for help. -->8- template AATypes(T) { // todo: static assert if T is no AA type here alias

Dmd master tests are failing with segmentation fault

2015-09-19 Thread Guillaume Chatelet via Digitalmars-d
Is this a known issue ? Why Auto Tester didn't catch it ? 0. OS: ArchLinux 64bits 1. Get clean dmd from master 2. make -f posix.mak AUTO_BOOTSTRAP=1 3. ./src/dmd DMD64 D Compiler v2.069-devel-b99a53f 4. make -f posix.mak test make[1]: Entering directory '/home/auser/dlang/dmd/test' Building

Re: dmd: failed to launch executable

2015-09-19 Thread Laeeth Isharc via Digitalmars-d
On Saturday, 19 September 2015 at 10:21:30 UTC, Rinzler wrote: On Saturday, 19 September 2015 at 10:17:21 UTC, Jacob Carlborg wrote: On 2015-09-19 12:05, Rinzler wrote: what does "which dmd" give you? Nothing... And "type dmd | head -n 1"? If that gives you some kind of path, what does

Re: Simple template constraint question

2015-09-19 Thread Daniel Kozak via Digitalmars-d-learn
WhatMeWorry píše v So 19. 09. 2015 v 17:09 +: > Does D provide complete template constraint granularity? > > In other words, I want to only accept structs in the template > below. > I've find the isAggregateType which is close but no cigar. Am I > missing > some other filters? > > And a

Re: What's wrong with this code?

2015-09-19 Thread Chris via Digitalmars-d-learn
On Saturday, 19 September 2015 at 02:45:54 UTC, Adam D. Ruppe wrote: On Saturday, 19 September 2015 at 02:30:39 UTC, Chris wrote: bmove.addOnClicked (delegate void (Button aux) { What's the context of this call? If it is inside a struct and you are accessing local

Re: What's wrong with this code?

2015-09-19 Thread Chris via Digitalmars-d-learn
Update: If I add *also* a auto vec2 = vec; now the code works. So it looks like this now: voxel_vec [string] move_buttons = [ "button_xp" : voxel_vec ([ 1, 0, 0 ]), "button_xm" : voxel_vec ([ -1, 0, 0 ]),

Re: Dmd master tests are failing with segmentation fault

2015-09-19 Thread Guillaume Chatelet via Digitalmars-d
On Saturday, 19 September 2015 at 13:34:27 UTC, Guillaume Chatelet wrote: Is this a known issue ? Why Auto Tester didn't catch it ? It's coming from d_do_test, gdb gives this stacktrace. Program received signal SIGSEGV, Segmentation fault. 0x00460b64 in rt.deh_win64_posix.terminate()

Re: I'll like to learn D

2015-09-19 Thread uNknow123 via Digitalmars-d-learn
On Saturday, 19 September 2015 at 15:09:38 UTC, WhatMeWorry wrote: On Saturday, 19 September 2015 at 13:41:03 UTC, uNknow123 wrote: Hi! I'll like to learn D Lang. I knew some Pawn, it is pretty similar, but not so similar, if you understan me. In Pawn we have to write just some words, and the

Re: Dmd master tests are failing with segmentation fault

2015-09-19 Thread Guillaume Chatelet via Digitalmars-d
On Saturday, 19 September 2015 at 17:38:40 UTC, Guillaume Chatelet wrote: hmm so it's probably coming from druntime or phobos not being build with the correct dmd version... Indeed it was this, sorry for the noise.

Re: Debugging D shared libraries

2015-09-19 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 19 September 2015 at 10:45:22 UTC, Russel Winder wrote: Calling D from Python. I have two functions in D, compiled to a shared object on Linux using LDC (but I get same problem using DMD). The sequential code: extern(C) double sequential(const int n, const double delta)

Re: dmd: failed to launch executable

2015-09-19 Thread John Colvin via Digitalmars-d
On Saturday, 19 September 2015 at 16:44:38 UTC, Rinzler wrote: Quick point about paths and so on: if you don't understand what's going on, or have just made a change and want to be sure whether it worked, always open a new terminal session and try again. There are caches that can need

Re: Can D do some sort of automatic template to "dynamic template" wrapping

2015-09-19 Thread Adam via Digitalmars-d
On Saturday, 19 September 2015 at 15:56:23 UTC, Laeeth Isharc wrote: On Friday, 18 September 2015 at 20:55:06 UTC, Adam wrote: Fact: Templates are static! But templates are still normal functioning code and can actually work dynamically. We can see this by including a D compiler inside an

Re: text wrap

2015-09-19 Thread Joel via Digitalmars-d-learn
On Sunday, 20 September 2015 at 00:48:39 UTC, Doxin wrote: On Sunday, 20 September 2015 at 00:28:23 UTC, Doxin wrote: I'll get to work on some example code. here you go: http://dpaste.dzfl.pl/e6e715c54c1b do mind that this code has a couple issues, for example handing it a word longer than

Re: Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2015-09-19 at 12:21 +, ponce via Digitalmars-d-learn wrote: > […] > > Try using an explicit TaskPool and destroying it with scope(exit). > > > Also if using LDC, you can use global ctor/dtor to deal with the > runtime. > > > --->8- > >

Re: dmd: failed to launch executable

2015-09-19 Thread Rinzler via Digitalmars-d
On Saturday, 19 September 2015 at 15:32:33 UTC, Laeeth Isharc wrote: On Saturday, 19 September 2015 at 10:21:30 UTC, Rinzler wrote: On Saturday, 19 September 2015 at 10:17:21 UTC, Jacob Carlborg wrote: On 2015-09-19 12:05, Rinzler wrote: what does "which dmd" give you? Nothing... And

Re: Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2015-09-19 at 15:58 +, ponce via Digitalmars-d-learn wrote: > On Saturday, 19 September 2015 at 15:42:15 UTC, Russel Winder > wrote: > > > > Hummm… I now do not get a segfault, and the code runs as > > expected : > > -) but the program never terminates. :-( > > Where is it

Re: Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2015-09-19 at 11:07 +, John Colvin via Digitalmars-d-learn wrote: > […] > I heard it crashed during the talk. Bummer. I should really be > there, seeing as I live about 15 mins away. If you get a chance > to talk to Alex Bishop, don't be too harsh on D to him, I'm > trying to

Re: Debugging D shared libraries

2015-09-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 September 2015 at 16:25:28 UTC, Laeeth Isharc wrote: On Saturday, 19 September 2015 at 12:21:02 UTC, ponce wrote: [...] What is the difference between shared static this and the global constructor ? Russell, if you use shared static this for dmd does it work ? Laeeth.

Re: Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2015-09-19 at 17:15 +0100, Russel Winder wrote: > […] > Sadly the: > > pragma(LDC_global_crt_ctor, 0) > void initRuntime() { > import core.runtime: Runtime; > Runtime.initialize(); >} > > will not compile under DMD :-( On the otherhand using a: version(LDC) {

Re: Debugging D shared libraries

2015-09-19 Thread John Colvin via Digitalmars-d-learn
On Saturday, 19 September 2015 at 16:15:45 UTC, Russel Winder wrote: Sadly the: pragma(LDC_global_crt_ctor, 0) void initRuntime() { import core.runtime: Runtime; Runtime.initialize(); } will not compile under DMD :-( version(LDC){ /* ... */ } not that it helps make

Re: Debugging D shared libraries

2015-09-19 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2015-09-19 at 16:33 +, John Colvin via Digitalmars-d-learn wrote: > On Saturday, 19 September 2015 at 16:15:45 UTC, Russel Winder > wrote: > > Sadly the: > > > > pragma(LDC_global_crt_ctor, 0) > > void initRuntime() { > > import core.runtime: Runtime; > >

  1   2   >