Re: Interior pointers and fast GC

2017-01-21 Thread Nick Treleaven via Digitalmars-d
On Saturday, 14 January 2017 at 15:30:42 UTC, Rainer Schuetze wrote: In addition, you need to lookup the pool anyway to figure out if the pointer points to non-managed memory (stack, global data, malloc'd memory). Makes me wonder about a GC'd language where each pointer is actually a member

Profiling calls to small functions

2017-01-21 Thread albert-j via Digitalmars-d-learn
Let's say I want to create an array of random numbers and do some operations on them: void main() { import std.random; //Generate array of random numbers int arrSize = 1; double[] arr = new double[](arrSize); foreach (i; 0..arrSize) arr[i] = uniform01();

Re: Pixel Perfect Engine (formerly known as VDP-Engine) version 0.9.1-rc1 released

2017-01-21 Thread Dmitry via Digitalmars-d-announce
On Friday, 20 January 2017 at 23:15:51 UTC, solidstate1991 wrote: Github: https://github.com/ZILtoid1991/pixelperfectengine Any documentation?

Re: Profiling calls to small functions

2017-01-21 Thread pineapple via Digitalmars-d-learn
On Saturday, 21 January 2017 at 12:33:57 UTC, albert-j wrote: Now I dmd -profile it and look at the performance of funcA with d-profile-viewer. Inside funcA, only 20% of time is spend in funcB, but the rest 80% is self-time of funcA. How is it possible, when funcB has three times the

Re: @nogc and opengl errors check

2017-01-21 Thread Xavier Bigand via Digitalmars-d-learn
Le 21/01/2017 à 13:24, Jerry a écrit : On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote: Hi, I am writing some code with opengl commands that I want to check in debug, so I am using the function checkgl (from glamour lib). The issue is that checkgl throw exception and can't be

Re: cannot alias array ;/

2017-01-21 Thread Dukc via Digitalmars-d-learn
On Thursday, 19 January 2017 at 08:06:04 UTC, ketmar wrote: alias is not a macro, it is alias to *symbol*. only symbol, not any arbitrary expression. In fact, it can nowadays be. You just have to mark it so, with a lambda: void main() { import std.stdio; auto myArray = [2, 3, 5, 6];

[Issue 17055] this(...) hides this() of mixed in template

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17055 --- Comment #2 from Ralph Alexander Bariz --- // mixin template Foo() { int x; this() { this.x=5; } } class Bar { mixin Foo; this(int

[Issue 17055] this(...) hides this() of mixed in template

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17055 --- Comment #3 from Ralph Alexander Bariz --- // mixin template Foo() { int x; this() { this.x=5; } } class Bar { mixin Foo; } void main()

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sat, 21 Jan 2017 04:01:06 +, bitwise wrote: > On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: >> [...] > > I can see that 'TypedAllocator' exists, but with a different interface > than the rest of the allocators. Why wouldn't all allocators just have a > common interface?

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread ZombineDev via Digitalmars-d
On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make containers. But since allocate() returns void[], casts are required before using that memory, which is unsafe. Is my only

Re: Pixel Perfect Engine (formerly known as VDP-Engine) version 0.9.1-rc1 released

2017-01-21 Thread solidstate1991 via Digitalmars-d-announce
On Saturday, 21 January 2017 at 01:55:54 UTC, Chris Wright wrote: This would have been the perfect place for you to describe what this project is about. Pixel Perfect Engine is a 2d graphics system based on SDL and FreeImage. It appears to be tile-based and incorporate a map editor. It's

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread ZombineDev via Digitalmars-d
On Saturday, 21 January 2017 at 09:56:29 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make containers. But since allocate() returns void[], casts are

Re: Need a std::numeric_limits::lowest() equivalent

2017-01-21 Thread Xavier Bigand via Digitalmars-d
Le 21/01/2017 à 10:54, John Colvin a écrit : On Saturday, 21 January 2017 at 00:03:11 UTC, Xavier Bigand wrote: std::numeric_limits::lowest() is describe as "A finite value x such that there is no other finite value y * where y < x." According to what I presume that definition means

Re: Testing in the D Standard Library

2017-01-21 Thread Jacob Carlborg via Digitalmars-d-announce
On 2017-01-21 03:59, Jack Stouffer wrote: But 2.073 isn't released yet. It's in release candidate. The current output is pretty embarrassing. -- /Jacob Carlborg

Re: @nogc and opengl errors check

2017-01-21 Thread Jerry via Digitalmars-d-learn
On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote: Hi, I am writing some code with opengl commands that I want to check in debug, so I am using the function checkgl (from glamour lib). The issue is that checkgl throw exception and can't be @nogc, I had try to use

Re: Profiling calls to small functions

2017-01-21 Thread albert-j via Digitalmars-d-learn
I'm not sure if it's what happening in this case but, in code as simple as this, function calls can sometimes be the bottleneck. You should see how compiling with/without -O affects performance, and adding `pragma(inline)` to funcB. When compiled with -inline, the profiler does not report the

Re: Catching Errors

2017-01-21 Thread cym13 via Digitalmars-d
On Friday, 20 January 2017 at 14:22:23 UTC, Adam D. Ruppe wrote: On Friday, 20 January 2017 at 07:50:23 UTC, Jacob Carlborg wrote: That doesn't work well with a unit test framework that want to catch assertions to be able to continue with other tests. I'd suggest writing a new assert handler

Re: Need a std::numeric_limits::lowest() equivalent

2017-01-21 Thread John Colvin via Digitalmars-d
On Saturday, 21 January 2017 at 00:03:11 UTC, Xavier Bigand wrote: std::numeric_limits::lowest() is describe as "A finite value x such that there is no other finite value y * where y < x." According to what I presume that definition means ("no other finite value" means "no other

Re: Pixel Perfect Engine (formerly known as VDP-Engine) version 0.9.1-rc1 released

2017-01-21 Thread solidstate1991 via Digitalmars-d-announce
On Saturday, 21 January 2017 at 14:27:35 UTC, Dmitry wrote: On Friday, 20 January 2017 at 23:15:51 UTC, solidstate1991 wrote: Github: https://github.com/ZILtoid1991/pixelperfectengine Any documentation? Documentation is in the works with a few sample codes, but currently I have a lot of

Re: D for scripting?

2017-01-21 Thread Jacob Carlborg via Digitalmars-d
On 2017-01-21 00:52, 岩倉 澪 wrote: This has already been fixed? Is this fix in a stable release yet? I might not be on the latest version... It's fixed in DMD, _not_ in RDMD. -- /Jacob Carlborg

Re: Got the official feedback for my GDC Europe talk

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/20/2017 04:26 AM, Ethan Watson wrote: Landed in my inbox while I was on holiday in Australia (why did I leave it three and a half years between visits jeez never do that again you fool). http://imgur.com/a/I6GrF In summary: * 4.5 out of 5 audience rating. Average was 4.22. * Head count

[Issue 17102] std.write.file generates a segmentation fault when the file name is a string with a default value

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17102 --- Comment #9 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/e80d3b5745e7875980f6c69a2c09cccb647fa9a6 Fix Issue 17102: std.write.file generates a

Re: Got the official feedback for my GDC Europe talk

2017-01-21 Thread Ethan Watson via Digitalmars-d
On Saturday, 21 January 2017 at 16:32:36 UTC, Andrei Alexandrescu wrote: Congratulations, that looks like a very good performance! Could you please explain a bit how the Google Slides feature you mentioned works? -- Andrei The core functionality is that a web link is provided that allows

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a special deallocation function, see e.g. http://en.cppreference.com/w/c/memory/aligned_alloc. -- Andrei This

Compile to C?

2017-01-21 Thread Nestor via Digitalmars-d-learn
Hi friends, Is there a way to "compile" d code to C, similar to what nim does? That would be cool for greater portability.

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/21/2017 12:14 PM, bitwise wrote: On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a special deallocation function, see e.g.

Re: Interior pointers and fast GC

2017-01-21 Thread deadalnix via Digitalmars-d
On Saturday, 14 January 2017 at 04:37:01 UTC, Chris Wright wrote: Unfortunately, given an interior pointer, you can't identify the base of its heap object in constant time. 1. Split the heap in chunk of size n being a power of 2, say 4M. Align them 4M. 2. Find the chunk an alloc is part of in

Re: D for scripting?

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/20/2017 09:15 AM, Russel Winder via Digitalmars-d wrote: On Fri, 2017-01-20 at 07:10 +, Andrei Alexandrescu via Digitalmars- d wrote: […] It would be worth it. I think a fix takes some thinking because if I remember correctly the compiler does not accept files without an extension as

Re: Pixel Perfect Engine (formerly known as VDP-Engine) version 0.9.1-rc1 released

2017-01-21 Thread solidstate1991 via Digitalmars-d-announce
On Saturday, 21 January 2017 at 17:41:58 UTC, NVolcz wrote: Any screenshots? https://github.com/ZILtoid1991/pixelperfectengine/issues/1 There's even a video showcasing the scrolling capabilities of the engine. I made more during development, most of them are about the bugs.

Re: iterating through members of bitfields

2017-01-21 Thread Nestor via Digitalmars-d-learn
Thank you both!

Re: Compile to C?

2017-01-21 Thread Joakim via Digitalmars-d-learn
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote: Hi friends, Is there a way to "compile" d code to C, similar to what nim does? That would be cool for greater portability. The wiki says there was a dmd fork that attempted this 5 years ago, don't know how far he got:

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 10:15:46 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 09:56:29 UTC, ZombineDev wrote: On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote: When std.experimental.allocator was created, I was under the impression it was meant to be used to make

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 01/21/2017 01:06 AM, Eugene Wissner wrote: On Saturday, 21 January 2017 at 05:52:49 UTC, bitwise wrote: I hadn't noticed this, but I immediately see two problems: 1) there is no alignedDeallocate() which is needed because aligned allocators usually prepend metadata containing a pointer to

Re: Pixel Perfect Engine (formerly known as VDP-Engine) version 0.9.1-rc1 released

2017-01-21 Thread NVolcz via Digitalmars-d-announce
On Friday, 20 January 2017 at 23:15:51 UTC, solidstate1991 wrote: Github: https://github.com/ZILtoid1991/pixelperfectengine Any screenshots?

Re: Compile to C?

2017-01-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote: That would be cool for greater portability. The hard part in porting to a new platform is rarely the code generation - gdc and ldc have diverse backends already (indeed, they tend to work for D as well as C there). But you still

Re: Compile to C?

2017-01-21 Thread Jack Stouffer via Digitalmars-d-learn
On Saturday, 21 January 2017 at 18:38:22 UTC, Nestor wrote: Hi friends, Is there a way to "compile" d code to C, similar to what nim does? That would be cool for greater portability. No, and this is actually a terrible idea. See

Re: GSoC 2017 Ideas!

2017-01-21 Thread Craig Dillabaugh via Digitalmars-d
On Sunday, 15 January 2017 at 05:17:10 UTC, Adam D. Ruppe wrote: On Sunday, 15 January 2017 at 04:11:06 UTC, Craig Dillabaugh wrote: I've been trying to find something on this, but haven't yet, but I am not sure if website work would be considered appropriate. The website is still a program,

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei Alexandrescu wrote: On 1/21/17 5:44 PM, bitwise wrote: About alignedMalloc: In C++ for example, I may want to use a vector full some SIMD type: class alignas(16) Vec4 { union { struct { float x, y, z, w; }; __m128 m;

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 17:26:35 UTC, Andrei Alexandrescu wrote: On 01/21/2017 12:14 PM, bitwise wrote: On Saturday, 21 January 2017 at 16:28:16 UTC, Andrei Alexandrescu wrote: alignedAllocate provides access to OS/clib-provided primitives for aligned allocation. Those don't require a

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Ali Çehreli via Digitalmars-d-learn
Simplified: import std.stdio; struct Widget { private int[] array; this(uint length) { array = new int[length]; writefln("ctor called : %s", array.ptr); } this(this) { writef( "this(this) called: %s", array.ptr ); array = array.dup;

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Andrei Alexandrescu via Digitalmars-d
On 1/21/17 5:44 PM, bitwise wrote: About alignedMalloc: In C++ for example, I may want to use a vector full some SIMD type: class alignas(16) Vec4 { union { struct { float x, y, z, w; }; __m128 m; }; }; std::vector points = { ... }; In C++ however, 'new' does not

[Issue 17066] [REG2.073a] std.regex captures got immutable

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17066 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/4d19d0ad3aab77a9a4a9b2dedaccbacfdeb4e45e Fix issue 17066

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sat, 21 Jan 2017 22:44:49 +, bitwise wrote: > So I use a custom aligned allocator: > > template > class AlignedAllocator { > T* allocate(size_type n) { > return (T*)_aligned_malloc(ALIGN, n * sizeof(T)); > } > }; > > SIMD operations(aligned load and store) can now

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Ali Çehreli via Digitalmars-d-learn
On 01/21/2017 03:19 PM, Ali Çehreli wrote: this(this) { TIL! Change the signature and it works without copies: this(const(this)) { // ... } How did I miss this for so long? Ali

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Sunday, 22 January 2017 at 00:13:10 UTC, Chris Wright wrote: On Sat, 21 Jan 2017 22:44:49 +, bitwise wrote: So I use a custom aligned allocator: template class AlignedAllocator { T* allocate(size_type n) { return (T*)_aligned_malloc(ALIGN, n * sizeof(T)); } }; SIMD

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 00:53:45 +, bitwise wrote: > I understand this, but I've given a solid example which supports the > former, and haven't seen a counter example which supports the latter. Because examples that are easy to generate are small and small examples don't have coarse-grained

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Ali Çehreli via Digitalmars-d-learn
On 01/21/2017 03:36 PM, Ali Çehreli wrote: > Change the signature and it works without copies: > > this(const(this)) { > // ... > } Ugh... :( It's not a post-blit. Then what is it? Ali

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Sunday, 22 January 2017 at 01:02:09 UTC, Chris Wright wrote: On Sun, 22 Jan 2017 00:53:45 +, bitwise wrote: I understand this, but I've given a solid example which supports the former, and haven't seen a counter example which supports the latter. Because examples that are easy to

Less-than-optimal decimal real literal conversion to x86 extended floats

2017-01-21 Thread pineapple via Digitalmars-d
I'm not sure whether this should be counted as a bug, but I ran into it and thought it deserved mentioning. I've been testing this with DMD on Windows. I wrote this function to support parsing of strings as floating point values:

Re: Less-than-optimal decimal real literal conversion to x86 extended floats

2017-01-21 Thread pineapple via Digitalmars-d
On Sunday, 22 January 2017 at 01:54:59 UTC, pineapple wrote: When you write `real x = 0.0005;` x in fact represets a value of about 0.00050032187251995663412884596255025826394. This is a about 3.2 * 10^-23 more than 0.0005. The output of my function in this case was about

Re: @safe containers with std.experimental.allocator

2017-01-21 Thread bitwise via Digitalmars-d
On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei Alexandrescu wrote: Andrei Anyways, design opinions aside, I would be satisfied if an aligned allocator were included in std.allocators that provided aligned heap memory using allocate()/deallocate(). The rest is just details with no

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Ali Çehreli via Digitalmars-d-learn
On 01/21/2017 07:22 PM, Basile B. wrote: On Sunday, 22 January 2017 at 00:31:38 UTC, Ali Çehreli wrote: On 01/21/2017 03:36 PM, Ali Çehreli wrote: > Change the signature and it works without copies: > > this(const(this)) { > // ... > } Ugh... :( It's not a post-blit. Then what

Re: Interior pointers and fast GC

2017-01-21 Thread Araq via Digitalmars-d
On Sunday, 22 January 2017 at 06:28:35 UTC, Chris Wright wrote: On Sun, 22 Jan 2017 05:02:43 +, Araq wrote: It's an O(1) that requires a hash table lookup in general because allocations can exceed the chunk size and so you cannot just mask the pointer and look at the chunk header because

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Basile B. via Digitalmars-d-learn
On Sunday, 22 January 2017 at 03:42:21 UTC, Ali Çehreli wrote: On 01/21/2017 07:22 PM, Basile B. wrote: [...] Wow! Thanks. I know about 'alias this' but this (pun!) is new to me. TIL indeed and WAT (four exclamation marks is right in this case. :o) ) import std.stdio; struct S {

[Issue 17112] New: Simple writeln call produces cryptic error message

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17112 Issue ID: 17112 Summary: Simple writeln call produces cryptic error message Product: D Version: D2 Hardware: x86_64 OS: Mac OS X Status: NEW Severity: normal

Re: CTFE Status

2017-01-21 Thread Stefan Koch via Digitalmars-d
On Saturday, 21 January 2017 at 05:59:32 UTC, Stefan Koch wrote: On Friday, 20 January 2017 at 19:08:28 UTC, Stefan Koch wrote: Druntime and phobos broke, the reason being that, I did test against an outdated version of druntime/phobos. I am working on getting them to compile again. Adding

Re: Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Basile B. via Digitalmars-d-learn
On Sunday, 22 January 2017 at 00:31:38 UTC, Ali Çehreli wrote: On 01/21/2017 03:36 PM, Ali Çehreli wrote: > Change the signature and it works without copies: > > this(const(this)) { > // ... > } Ugh... :( It's not a post-blit. Then what is it? Ali This is a __ctor that takes

[Issue 17112] Simple writeln call produces cryptic error message

2017-01-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17112 --- Comment #1 from Gillett --- issue 16661 - https://issues.dlang.org/show_bug.cgi?id=16661 - seemed to have the same error but in a different form. it was the only issue i found that had a similar error message after searching

Re: Interior pointers and fast GC

2017-01-21 Thread Chris Wright via Digitalmars-d
On Sun, 22 Jan 2017 05:02:43 +, Araq wrote: > It's an O(1) that requires a hash table lookup in general because > allocations can exceed the chunk size and so you cannot just mask the > pointer and look at the chunk header because it might not be a chunk > header at all. Know any production

Re: Interior pointers and fast GC

2017-01-21 Thread Araq via Digitalmars-d
On Saturday, 21 January 2017 at 17:42:46 UTC, deadalnix wrote: 1. Split the heap in chunk of size n being a power of 2, say 4M. Align them 4M. 2. Find the chunk an alloc is part of in O(1) bu masking the lower bits (22 bits to mask in our 4M case). 3. Have a table of page descriptor in the

Calls `this(this)` extra with delegate stuff in the code

2017-01-21 Thread Joel via Digitalmars-d-learn
Compile this and see, (it's crazy!): import std.stdio; struct Widget { private int[] array; this(uint length) { array = new int[length]; } this(this) { writeln( "this(this) called" ); array = array.dup; }

?????? Iup4D 1.0 alpha

2017-01-21 Thread . via Digitalmars-d-announce
Just import iup like this: import iup; // for IUP import im; // for Imaging Toolkit import cd; // for 2D Graphics Library -- -- ??: "Jordan Wilson via Digitalmars-d-announce";; :

LDC talk @ FOSDEM'17

2017-01-21 Thread Kai Nacke via Digitalmars-d-announce
Hi everybody! Last year turned out to be difficult for D development for me. I try to come back this year. Here's my start: I am a speaker in the LLVM toolchain devroom @ FOSDEM'17. My talk is about profile guided optimization in LDC and of course I will promote D. My talk is based on