[Issue 16091] New: Assertion `thisfd->isNested() || thisfd->vthis' failed.

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16091 Issue ID: 16091 Summary: Assertion `thisfd->isNested() || thisfd->vthis' failed. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 May 2016 at 05:35:33 UTC, Mike Parker wrote: Well then, this completely breaks my understanding of variable scope. OK, I see now at [1] the following: " Immutable data doesn't have synchronization problems, so the compiler doesn't place it in TLS." I've read that page more

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 28 May 2016 at 15:39:44 UTC, ag0aep6g wrote: On 05/28/2016 10:34 AM, Mike Parker wrote: On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote: [...] Is a static const Category c variable a TLS variable ? Yes. All variables are TLS unless explicitly marked with __gshared or

[Issue 16090] New: popFront generates out-of-bounds array index on corrupted utf-8 strings

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16090 Issue ID: 16090 Summary: popFront generates out-of-bounds array index on corrupted utf-8 strings Product: D Version: D2 Hardware: x86 OS: Mac OS X

Re: standard alias for a class name inside the class code?

2016-05-28 Thread dan via Digitalmars-d-learn
On Sunday, 29 May 2016 at 02:44:33 UTC, jhps wrote: On Sunday, 29 May 2016 at 00:48:20 UTC, dan wrote: Especially in a declaration like static typeof(this) make_instance( ) but also in the 'new typeof(this)'. In both cases, 'this' doesn't even exist.

Re: Free the DMD backend

2016-05-28 Thread Joakim via Digitalmars-d
On Sunday, 29 May 2016 at 03:52:33 UTC, open-source-guy wrote: Hi, this is a short ping about one of D's weaknesses - the restrictive license for the backend. IIRC [1, 2, 3] the status is that because some parts have been written by Walter while he was employed by Symantec, it can't get an

Free the DMD backend

2016-05-28 Thread open-source-guy via Digitalmars-d
Hi, this is a short ping about one of D's weaknesses - the restrictive license for the backend. IIRC [1, 2, 3] the status is that because some parts have been written by Walter while he was employed by Symantec, it can't get an open-source license. When I read the backend license [4], I read

Re: Battle-plan for CTFE

2016-05-28 Thread Taylor Hillegeist via Digitalmars-d-announce
On Saturday, 28 May 2016 at 12:27:26 UTC, Stefan Koch wrote: On Friday, 27 May 2016 at 23:31:24 UTC, Stefan Koch wrote: On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote: Hi Guys, I have been looking into the DMD now to see what I can do about CTFE. I will post more details as soon

Scriptlike v0.9.6 - Minor update

2016-05-28 Thread Nick Sabalausky via Digitalmars-d-announce
This is a minor update to Scriptlike: A utility library to help you write script-like programs in D. - Fixed deprecation warnings with DMD 2.070.x and 2.071.0 - Fixes the Travis-CI build which had been a little bit borked. - Interact module properly flushes stdout when prompting for user input

Re: We need to talk about error messages of functions that are passed into other functions at compile time

2016-05-28 Thread Seb via Digitalmars-d
On Saturday, 28 May 2016 at 13:37:55 UTC, maik klein wrote: I really like D's syntax for lambdas and I usually write code like this auto v = validationLayers[].all!((layerName){ return layerProps[].count!((layer){ return strcmp(cast(const(char*))layer.layerName, layerName) == 0;

Re: standard alias for a class name inside the class code?

2016-05-28 Thread jhps via Digitalmars-d-learn
On Sunday, 29 May 2016 at 00:48:20 UTC, dan wrote: Especially in a declaration like static typeof(this) make_instance( ) but also in the 'new typeof(this)'. In both cases, 'this' doesn't even exist. https://dlang.org/spec/declaration.html#Typeof it's another 'this' that has not the

[Issue 16035] Compiler crashes with inout, templates, and recursion

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16035 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/47687ca95af80bc690994491effa18dd7d186034 fix Issue 16035 - Compiler crashes with inout, templates, and

[Issue 16035] Compiler crashes with inout, templates, and recursion

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16035 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 16035] Compiler crashes with inout, templates, and recursion

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16035 Walter Bright changed: What|Removed |Added CC|

[Issue 15925] [REG 2.071] Import declaration from mixin templates are ignored

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15925 github-bugzi...@puremagic.com changed: What|Removed |Added Resolution|INVALID |FIXED --

[Issue 15925] [REG 2.071] Import declaration from mixin templates are ignored

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15925 --- Comment #10 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b86f3b3b357f6d0edc0c8a60552657b922443017 fix Issue 15925 - Import declaration from mixin templates

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Bauss via Digitalmars-d-announce
On Saturday, 28 May 2016 at 21:55:58 UTC, Basile B. wrote: On Saturday, 28 May 2016 at 20:39:18 UTC, Bauss wrote: So there's no way to do it through the editor? Like I don't use a dark theme in my OS, but I do like my editors to be dark. I confirm. Dark theme only available if the OS widget

Re: standard alias for a class name inside the class code?

2016-05-28 Thread dan via Digitalmars-d-learn
On Sunday, 29 May 2016 at 00:28:13 UTC, Mithun Hunsur wrote: On Sunday, 29 May 2016 at 00:14:17 UTC, dan wrote: Is there a standard alias for a class name inside class code? Something like 'this' referring to a class instance, but referring instead to the class itself? [...] typeof(this)

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread maik klein via Digitalmars-d-announce
On Sunday, 29 May 2016 at 00:37:54 UTC, Alex Parrill wrote: On Saturday, 28 May 2016 at 19:32:58 UTC, maik klein wrote: Btw does this even work? I think the struct initializers have to be Foo foo = { someVar: 1 }; `:` instead of a `=` I didn't do this because I actually got autocompletion

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 14:54:13 UTC, Era Scarecrow wrote: Well here's what i got. Maybe someone else will tell me how i did this wrong... Using the pragma to output how the lines were being generated i finally figured out why it kept complaining about the stack pointer and 'this'. So

Re: standard alias for a class name inside the class code?

2016-05-28 Thread Mithun Hunsur via Digitalmars-d-learn
On Sunday, 29 May 2016 at 00:14:17 UTC, dan wrote: Is there a standard alias for a class name inside class code? Something like 'this' referring to a class instance, but referring instead to the class itself? [...] typeof(this) gets you the type of the current class. :)

standard alias for a class name inside the class code?

2016-05-28 Thread dan via Digitalmars-d-learn
Is there a standard alias for a class name inside class code? Something like 'this' referring to a class instance, but referring instead to the class itself? What i would like to do is have something like class Clas { // alias Clas THIS; <- don't want this boilerplate static THIS

Re: The Case Against Autodecode

2016-05-28 Thread Jack Stouffer via Digitalmars-d
On Saturday, 28 May 2016 at 12:04:20 UTC, Andrei Alexandrescu wrote: OK, that's a fair argument, thanks. So it seems there should be no "default" way to iterate a string Yes! So it harkens back to the original mistake: strings should NOT be arrays with the respective primitives. If you're

Re: The Case Against Autodecode

2016-05-28 Thread Andrew Godfrey via Digitalmars-d
On Saturday, 28 May 2016 at 19:04:14 UTC, Walter Bright wrote: On 5/28/2016 5:04 AM, Andrei Alexandrescu wrote: So it harkens back to the original mistake: strings should NOT be arrays with the respective primitives. An array of code units provides consistency, predictability, flexibility,

[Issue 16089] New: Outdated "D on GitHub" link.

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16089 Issue ID: 16089 Summary: Outdated "D on GitHub" link. Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: trivial Priority: P1

Re: Transient ranges

2016-05-28 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 28 May 2016 at 21:32:15 UTC, Brad Roberts wrote: On 5/28/2016 10:27 AM, Joseph Rushton Wakeling via Digitalmars-d wrote: On Saturday, 28 May 2016 at 01:48:08 UTC, Jonathan M Davis wrote: On Friday, May 27, 2016 23:42:24 Seb via Digitalmars-d wrote: So what about the convention to

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Basile B. via Digitalmars-d-announce
On Saturday, 28 May 2016 at 20:39:18 UTC, Bauss wrote: So there's no way to do it through the editor? Like I don't use a dark theme in my OS, but I do like my editors to be dark. I confirm. Dark theme only available if the OS widget set has one.

Re: Transient ranges

2016-05-28 Thread Brad Roberts via Digitalmars-d
On 5/28/2016 10:27 AM, Joseph Rushton Wakeling via Digitalmars-d wrote: On Saturday, 28 May 2016 at 01:48:08 UTC, Jonathan M Davis wrote: On Friday, May 27, 2016 23:42:24 Seb via Digitalmars-d wrote: So what about the convention to explicitely declare a `.transient` enum member on a range, if

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread ag0aep6g via Digitalmars-d-learn
On 05/28/2016 09:54 PM, chmike wrote: The only inconvenience left is that we can't have mutable references to immutable objects. There is std.typecons.Rebindable for that.

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-28 Thread Seb via Digitalmars-d-learn
On Saturday, 28 May 2016 at 20:43:00 UTC, pineapple wrote: On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote: If you are interested how it works under the hood - it's pretty simple & elegant: I checked up on the phobos implementation and found that arrays are mutated when iterated over as

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-28 Thread pineapple via Digitalmars-d-learn
On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote: If you are interested how it works under the hood - it's pretty simple & elegant: I checked up on the phobos implementation and found that arrays are mutated when iterated over as ranges, which didn't rest well with me. Nor did the idea of

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Bauss via Digitalmars-d-announce
On Saturday, 28 May 2016 at 13:08:55 UTC, Basile B. wrote: On Friday, 27 May 2016 at 17:49:18 UTC, Bauss wrote: On Thursday, 26 May 2016 at 23:44:21 UTC, Basile B. wrote: Mostly because an important feature of the library manager was not compatible with DUB > v0.9.24. Otherwise almost

[Issue 16087] Alignment (.alignof) and stack space incorrect for SIMD types.

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16087 ZombineDev changed: What|Removed |Added CC|

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread chmike via Digitalmars-d-learn
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote: I need to create an app wide singleton instance for my class. The singleton is immutable, but I want to allow mutable references to that singleton object so that I can do fast 'is' tests. I declared this class Category { protected

Re: Avoid GC with closures

2016-05-28 Thread Iakh via Digitalmars-d
On Thursday, 26 May 2016 at 21:10:30 UTC, bpr wrote: On Thursday, 26 May 2016 at 18:53:35 UTC, Iakh wrote: Functions with lambdas cannot be @nogc as far as they allocates closures. Counterexample: // Note that this is NOT a good way to do numerical quadrature! double integrate(scope double

Re: Transient ranges

2016-05-28 Thread Seb via Digitalmars-d
On Saturday, 28 May 2016 at 19:09:09 UTC, Stefan Koch wrote: On Saturday, 28 May 2016 at 17:27:17 UTC, Joseph Rushton Wakeling wrote: On Saturday, 28 May 2016 at 01:48:08 UTC, Jonathan M Davis wrote: On Friday, May 27, 2016 23:42:24 Seb via Digitalmars-d wrote: So what about the convention to

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread maik klein via Digitalmars-d-announce
On Saturday, 28 May 2016 at 17:50:30 UTC, Alex Parrill wrote: On Saturday, 28 May 2016 at 10:58:05 UTC, maik klein wrote: derelict-vulcan only works on windows, dvulkan doesn't have the platform dependend surface extensions for xlib, xcb, w32 and wayland. Without them Vulkan is unusable for

Re: Transient ranges

2016-05-28 Thread Stefan Koch via Digitalmars-d
On Saturday, 28 May 2016 at 17:27:17 UTC, Joseph Rushton Wakeling wrote: On Saturday, 28 May 2016 at 01:48:08 UTC, Jonathan M Davis wrote: On Friday, May 27, 2016 23:42:24 Seb via Digitalmars-d wrote: So what about the convention to explicitely declare a `.transient` enum member on a range, if

Re: Copyright for Phobos to D Foundation

2016-05-28 Thread Seb via Digitalmars-d
On Saturday, 28 May 2016 at 18:39:20 UTC, Joseph Rushton Wakeling wrote: On Saturday, 28 May 2016 at 18:30:03 UTC, Seb wrote: On Saturday, 28 May 2016 at 18:11:16 UTC, Joseph Rushton Wakeling wrote: Copyright is extremely under-reported for Phobos, in my experience -- authors of significant

Re: The Case Against Autodecode

2016-05-28 Thread Walter Bright via Digitalmars-d
On 5/28/2016 5:04 AM, Andrei Alexandrescu wrote: So it harkens back to the original mistake: strings should NOT be arrays with the respective primitives. An array of code units provides consistency, predictability, flexibility, and performance. It's a solid base upon which the programmer can

Re: Avoid GC with closures

2016-05-28 Thread Iakh via Digitalmars-d
On Friday, 27 May 2016 at 10:34:38 UTC, Kagamin wrote: On Thursday, 26 May 2016 at 18:53:35 UTC, Iakh wrote: void g() @nogc { catch scope(void); int[N] arr = [/*...*/]; arr[].sort!((a, b) => a > b); } This compiles just fine and doesn't allocate: void g() @nogc { int[2] arr =

[Issue 16088] New: Parse error for import expression in statement

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16088 Issue ID: 16088 Summary: Parse error for import expression in statement Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal

Re: Copyright for Phobos to D Foundation

2016-05-28 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 28 May 2016 at 18:30:03 UTC, Seb wrote: On Saturday, 28 May 2016 at 18:11:16 UTC, Joseph Rushton Wakeling wrote: Copyright is extremely under-reported for Phobos, in my experience -- authors of significant components of modules do not necessarily add their name to the copyright

Re: Copyright for Phobos to D Foundation

2016-05-28 Thread Seb via Digitalmars-d
On Saturday, 28 May 2016 at 18:11:16 UTC, Joseph Rushton Wakeling wrote: Copyright is extremely under-reported for Phobos, in my experience -- authors of significant components of modules do not necessarily add their name to the copyright list or even the author list. Yes that's a huge

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Basile B. via Digitalmars-d-announce
On Saturday, 28 May 2016 at 16:23:41 UTC, Nick Sabalausky wrote: It'd be nice if there was a pre-defined set of dark highlighter attributes that could just be selected and then used out-of-the-box or as a starting point. In general, manually adjusting editor themes can get to be a pain,

Re: Copyright for Phobos to D Foundation

2016-05-28 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 28 May 2016 at 17:50:46 UTC, Seb wrote: Now that D foundation finally got its own page [1], it's probably time to start this dicussion. Is it safe to assume that the entire Phobos source code (except for the external C modules), belongs to the D foundation? No, not at all, and

Copyright for Phobos to D Foundation

2016-05-28 Thread Seb via Digitalmars-d
One thing that confused me a lot in the beginning, is that every Phobos module has it's own copyright - I am not a lawyer, but it sounded for me pretty weird that in theory I could get sued by a lot of Oracle-like patent trolls. I imagine the same effect also for companies when they read a

Re: A ready to use Vulkan triangle example for D

2016-05-28 Thread Alex Parrill via Digitalmars-d-announce
On Saturday, 28 May 2016 at 10:58:05 UTC, maik klein wrote: derelict-vulcan only works on windows, dvulkan doesn't have the platform dependend surface extensions for xlib, xcb, w32 and wayland. Without them Vulkan is unusable for me. I really don't care what I use, I just wanted something

Re: Does this C callback call look correct?

2016-05-28 Thread WhatMeWorry via Digitalmars-d-learn
Never mind. D was fine. Needed an alureUpdate() to trigger the call back.

Re: Transient ranges

2016-05-28 Thread Joseph Rushton Wakeling via Digitalmars-d
On Saturday, 28 May 2016 at 01:48:08 UTC, Jonathan M Davis wrote: On Friday, May 27, 2016 23:42:24 Seb via Digitalmars-d wrote: So what about the convention to explicitely declare a `.transient` enum member on a range, if the front element value can change? Honestly, I don't think that

Re: faster splitter

2016-05-28 Thread qznc via Digitalmars-d
On Saturday, 28 May 2016 at 14:18:10 UTC, Chris wrote: I used dmd, because I don't have ldc on my laptop. qznc's find is clearly the winner. DMD performance feels flaky to me. If performance is important, you should use ldc or gdc. Alternatively, you are Walter Bright and simply optimize

Re: faster splitter

2016-05-28 Thread qznc via Digitalmars-d
On Saturday, 28 May 2016 at 12:47:59 UTC, Andrei Alexandrescu wrote: On 5/28/16 6:56 AM, qznc wrote: The sentinel value is `needleBack+1`, but range elements need not support addition. Finding a sentinel is hard and most certainly requires more assumptions about the ranges. No need for a

Re: Is it possible to forbid synchronization on an object ?

2016-05-28 Thread Meta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 16:24:21 UTC, chmike wrote: In my long quest to implement a flyweight pattern with objects instantiated at compile time, I was indirectly notified of the possible problem of synchronization. In a flyweight pattern the user has the impression there are distinct

[Issue 16087] New: Alignment (.alignof) and stack space incorrect for SIMD types.

2016-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16087 Issue ID: 16087 Summary: Alignment (.alignof) and stack space incorrect for SIMD types. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-28 Thread Seb via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:59:25 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote: I've encountered one remarkable difference: The phobos function accepts arrays and mine does not. add `import std.array;` i think to your module and it should make arrays

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread ag0aep6g via Digitalmars-d-learn
On 05/28/2016 06:09 PM, chmike wrote: In the following instruction of the above commit, what effect has the [] after init ? _store[0 .. __traits(classInstanceSize, T)] = typeid(T).init[]; T is a template argument that is a class derived from Error. I couldn't find an explanation here

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Nick Sabalausky via Digitalmars-d-announce
Also, just a minor wishlist thing, but it'd be nice if the currently active file (or project name, or something) was prepended to the window's title bar, so it's displays on people's taskbar. That comes in handy when using multiple editor windows.

Is it possible to forbid synchronization on an object ?

2016-05-28 Thread chmike via Digitalmars-d-learn
In my long quest to implement a flyweight pattern with objects instantiated at compile time, I was indirectly notified of the possible problem of synchronization. In a flyweight pattern the user has the impression there are distinct instances where in fact objects with the same state (member

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Nick Sabalausky via Digitalmars-d-announce
On 05/28/2016 09:08 AM, Basile B. wrote: On Friday, 27 May 2016 at 17:49:18 UTC, Bauss wrote: On Thursday, 26 May 2016 at 23:44:21 UTC, Basile B. wrote: Mostly because an important feature of the library manager was not compatible with DUB > v0.9.24. Otherwise almost nothing. See

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread chmike via Digitalmars-d-learn
On Saturday, 28 May 2016 at 08:47:48 UTC, Kagamin wrote: For a trick of static mutable allocation see https://github.com/dlang/druntime/pull/1325 In the following instruction of the above commit, what effect has the [] after init ? _store[0 .. __traits(classInstanceSize, T)] =

Re: Easier way to add libraries to visual d?

2016-05-28 Thread Basile B. via Digitalmars-d-learn
On Saturday, 28 May 2016 at 15:31:18 UTC, TheDGuy wrote: On Saturday, 28 May 2016 at 15:29:36 UTC, TheDGuy wrote: Thanks a lot for the fast hot fix, now everything works fine! :) Great IDE! Do you mind implementing an option to reset the layout to default? Because i think i messed up and

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread ag0aep6g via Digitalmars-d-learn
On 05/28/2016 10:34 AM, Mike Parker wrote: On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote: [...] Is a static const Category c variable a TLS variable ? Yes. All variables are TLS unless explicitly marked with __gshared or shared. I don't think that's true. import core.thread;

Re: Easier way to add libraries to visual d?

2016-05-28 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 28 May 2016 at 15:29:36 UTC, TheDGuy wrote: Thanks a lot for the fast hot fix, now everything works fine! :) Great IDE! Do you mind implementing an option to reset the layout to default? Because i think i messed up and no i don't know how i can get the file view for the

Re: Easier way to add libraries to visual d?

2016-05-28 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 28 May 2016 at 13:25:14 UTC, Basile B. wrote: I've released a hot fix yesterday and now it works with latest DUB tag (0.9.25). But registering from the project that's loaded was already working yesterday. I think that you have forgotten to choose the right configuration to

Re: C++ to D converter based on clang

2016-05-28 Thread Loïc HAMOT via Digitalmars-d-announce
On Saturday, 28 May 2016 at 11:26:23 UTC, Seb wrote: On Saturday, 28 May 2016 at 11:02:37 UTC, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D [...] If somebody is interested to use this software, or to

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 14:11:56 UTC, Lodovico Giaretta wrote: On Saturday, 28 May 2016 at 14:01:35 UTC, Era Scarecrow wrote: Do you still want the template i'm building? Thank you very much for your effort. Please if you don't need it, don't make it, because I don't know if I'll use

Re: @trusting generic functions

2016-05-28 Thread ag0aep6g via Digitalmars-d-learn
On 05/28/2016 02:43 PM, Lodovico Giaretta wrote: struct S1 { int doSomething() @safe { // do something safely return 1; } } struct S2 { int doSomething() @system { // do something usafe return 2; } } auto doSomethingDumb(T)(ref

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 14:11:56 UTC, Lodovico Giaretta wrote: On Saturday, 28 May 2016 at 14:01:35 UTC, Era Scarecrow wrote: Do you still want the template i'm building? Thank you very much for your effort. Please if you don't need it, don't make it, because I don't know if I'll use

Re: faster splitter

2016-05-28 Thread Chris via Digitalmars-d
On Saturday, 28 May 2016 at 12:47:59 UTC, Andrei Alexandrescu wrote: On 5/28/16 6:56 AM, qznc wrote: The sentinel value is `needleBack+1`, but range elements need not support addition. Finding a sentinel is hard and most certainly requires more assumptions about the ranges. No need for a

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 14:01:35 UTC, Era Scarecrow wrote: On Saturday, 28 May 2016 at 13:10:56 UTC, Lodovico Giaretta wrote: The only problem is that these structures are parameterized, and the type parameters may have unsafe operations that I use. Do you still want the template i'm

D Embedded Database v0.1 Released

2016-05-28 Thread Piotrek via Digitalmars-d-announce
Short description A database engine for quick and easy integration into any D program. Full compatibility with D types and ranges. Design Goals (none is accomplished yet) - ACID - No external dependencies - Single file storage - Multithread support - Suitable for

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 13:10:56 UTC, Lodovico Giaretta wrote: The only problem is that these structures are parameterized, and the type parameters may have unsafe operations that I use. Do you still want the template i'm building? It doesn't like stack frame pointers, but will work with

Re: faster splitter

2016-05-28 Thread Chris via Digitalmars-d
On Friday, 27 May 2016 at 21:31:48 UTC, David Nadlinger wrote: Just about the only reason I could think of for this to happen is if the compiler fails to inline the range primitives from std.array. Otherwise, the loops should be pretty much equivalent to LLVM's optimiser. This is so

We need to talk about error messages of functions that are passed into other functions at compile time

2016-05-28 Thread maik klein via Digitalmars-d
I really like D's syntax for lambdas and I usually write code like this auto v = validationLayers[].all!((layerName){ return layerProps[].count!((layer){ return strcmp(cast(const(char*))layer.layerName, layerName) == 0; }) > 0; }); But this gives you basically 0 helpful

Re: Easier way to add libraries to visual d?

2016-05-28 Thread Basile B. via Digitalmars-d-learn
On Friday, 27 May 2016 at 19:30:10 UTC, TheDGuy wrote: On Thursday, 26 May 2016 at 22:15:17 UTC, Basile B. wrote: gfm doesn't yield a .lib because of this: https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22 it should be "library" or staticLibrary or "sourceLibrary" thus it can't

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 13:10:56 UTC, Lodovico Giaretta wrote: On Saturday, 28 May 2016 at 13:03:10 UTC, Adam D. Ruppe wrote: What kind of pointer usage do you have? Remember that basic & and * operations ARE @safe. If you have more internally, you might be able to wrap them up in an

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 13:03:10 UTC, Adam D. Ruppe wrote: What kind of pointer usage do you have? Remember that basic & and * operations ARE @safe. If you have more internally, you might be able to wrap them up in an @trusted function to again allow inference to work. Ouch! I was under

Re: Our Sister

2016-05-28 Thread Adam D. Ruppe via Digitalmars-d
On Saturday, 28 May 2016 at 04:15:45 UTC, Manu wrote: This is only true for the owner. If we had 'scope', or something like it (ie, borrowing in rust lingo), then the fat slice wouldn't need to be passed around Right, I agree - if we keep the slice just the way it is now, it all still works

Re: IDE - Coedit 2, update 6 released

2016-05-28 Thread Basile B. via Digitalmars-d-announce
On Friday, 27 May 2016 at 17:49:18 UTC, Bauss wrote: On Thursday, 26 May 2016 at 23:44:21 UTC, Basile B. wrote: Mostly because an important feature of the library manager was not compatible with DUB > v0.9.24. Otherwise almost nothing. See

Re: @trusting generic functions

2016-05-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 28 May 2016 at 11:50:33 UTC, Lodovico Giaretta wrote: Let's say I have a generic function that uses pointers. It will be inferred @system by the compiler, but I know that the pointer usage can be @trusted. What kind of pointer usage do you have? Remember that basic & and *

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 12:45:21 UTC, Era Scarecrow wrote: Fourth, you could create a helper function/template that cycles through a struct of your choice and tells you if any of it's methods fail to be safe. This will require a little more work, but it could be used as a full insurance

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 12:45:21 UTC, Era Scarecrow wrote: On Saturday, 28 May 2016 at 12:25:14 UTC, Lodovico Giaretta wrote: The problem is that T is a type, and I should check for safety of every method of T that I'm using in my function. This does not scale well, and if I change the

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 12:25:14 UTC, Lodovico Giaretta wrote: The problem is that T is a type, and I should check for safety of every method of T that I'm using in my function. This does not scale well, and if I change the body of the function to use a new method, I may forget to add it

Re: faster splitter

2016-05-28 Thread Andrei Alexandrescu via Digitalmars-d
On 5/28/16 6:56 AM, qznc wrote: The sentinel value is `needleBack+1`, but range elements need not support addition. Finding a sentinel is hard and most certainly requires more assumptions about the ranges. No need for a sentinel really so long as you first search for the last element of the

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 12:33:28 UTC, Era Scarecrow wrote: On Saturday, 28 May 2016 at 12:25:14 UTC, Lodovico Giaretta wrote: On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote: auto doSomethingDumb(T)(ref T t) if(isSafe!(T)) The problem is that T is a type, and I should

Re: The Case Against Autodecode

2016-05-28 Thread Chris via Digitalmars-d
On Friday, 27 May 2016 at 18:11:22 UTC, Andrei Alexandrescu wrote: On 5/27/16 10:15 AM, Chris wrote: It has happened to me that characters like "é" return length == 2 Would normalization make length 1? -- Andrei No, I've tried it. I think dchar[] returns one or you check by grapheme.

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 12:25:14 UTC, Lodovico Giaretta wrote: On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote: auto doSomethingDumb(T)(ref T t) if(isSafe!(T)) The problem is that T is a type, and I should check for safety of every method of T that I'm using in my

Re: C++ to D converter based on clang

2016-05-28 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 28 May 2016 at 11:02:37 UTC, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D [...] Interesting!

Re: @trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote: Use traits.. https://dlang.org/phobos/std_traits.html#isSafe so your function becomes (i believe) auto doSomethingDumb(T)(ref T t) if(isSafe!(T)) The problem is that T is a type, and I should check for safety of every

Re: Battle-plan for CTFE

2016-05-28 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 27 May 2016 at 23:31:24 UTC, Stefan Koch wrote: On Monday, 9 May 2016 at 16:57:39 UTC, Stefan Koch wrote: Hi Guys, I have been looking into the DMD now to see what I can do about CTFE. I will post more details as soon as I dive deeper into the code. Update : int bug6498(int x)

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 11:57:09 UTC, Era Scarecrow wrote: auto doSomethingDumb(T)(ref T t) if(isSafe!(T)) Should also probably test for a function or delegate. So...? auto doSomethingDumb(T)(ref T t) if(isSafe!T && (isFunctionPointer!T || isDelegate!T)) { T* pt =

Re: The Case Against Autodecode

2016-05-28 Thread Andrei Alexandrescu via Digitalmars-d
On 5/28/16 6:59 AM, Marc Schütz wrote: The fundamental problem is choosing one of those possibilities over the others without knowing what the user actually wants, which is what both BEFORE and AFTER do. OK, that's a fair argument, thanks. So it seems there should be no "default" way to

Re: @trusting generic functions

2016-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 28 May 2016 at 11:50:33 UTC, Lodovico Giaretta wrote: Is there any way around this? Any way to declare a function @trusted as long as the methods of the template argument are at least @trusted? Thank you in advance. Use traits.. https://dlang.org/phobos/std_traits.html#isSafe

@trusting generic functions

2016-05-28 Thread Lodovico Giaretta via Digitalmars-d-learn
Let's say I have a generic function that uses pointers. It will be inferred @system by the compiler, but I know that the pointer usage can be @trusted. The problem is that if I declare the function @trusted, I'm also implicitly trusting any call to @system methods of the template parameter.

Re: C++ to D converter based on clang

2016-05-28 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 28 May 2016 at 11:02:37 UTC, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D [...] Very nice! Looking at your examples, you should know that the default protection in D classes is public.

Re: Our Sister

2016-05-28 Thread Marc Schütz via Digitalmars-d
On Saturday, 28 May 2016 at 04:28:16 UTC, Manu wrote: On 27 May 2016 at 23:32, Andrei Alexandrescu via Digitalmars-d wrote: On 5/27/16 7:07 AM, Marc Schütz wrote: It should _safely_ convert to `const(char)[]`. That is not possible, sorry. -- Andrei It should

Re: Our Sister

2016-05-28 Thread Marc Schütz via Digitalmars-d
On Friday, 27 May 2016 at 13:32:30 UTC, Andrei Alexandrescu wrote: On 5/27/16 7:07 AM, Marc Schütz wrote: On Thursday, 26 May 2016 at 16:11:22 UTC, Andrei Alexandrescu wrote: RFC: what primitives should RCStr have? It should _safely_ convert to `const(char)[]`. That is not possible, sorry.

Re: C++ to D converter based on clang

2016-05-28 Thread Seb via Digitalmars-d-announce
On Saturday, 28 May 2016 at 11:02:37 UTC, Loïc HAMOT wrote: Hello, I am working on a C++ to D converter. The project is opensource, on github : https://github.com/lhamot/CPP2D Clang is used to parse the C++ code and get the abstract syntax tree. Then I can visit the AST to print it to D

Re: is my code to get CTFE instantiated object valid D ?

2016-05-28 Thread chmike via Digitalmars-d-learn
On Saturday, 28 May 2016 at 08:47:48 UTC, Kagamin wrote: For a trick of static mutable allocation see https://github.com/dlang/druntime/pull/1325 Thank you that looks promising. I'll study an experiment with the code. If I would like that the instances are not in TLS, can I use the following

Re: The Case Against Autodecode

2016-05-28 Thread Marc Schütz via Digitalmars-d
On Friday, 27 May 2016 at 13:34:33 UTC, Andrei Alexandrescu wrote: On 5/27/16 6:56 AM, Marc Schütz wrote: It is not, which has been shown by various posts in this thread. Couldn't quite find strong arguments. Could you please be more explicit on which you found most convincing? -- Andrei

  1   2   >