[Issue 18432] alias x = x where x is an imported symbol should result in an error

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18432 Mike Franklin changed: What|Removed |Added CC||slavo5...@yahoo.com

C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after years (since DMD 1 days). A lot changes since v1.0.

Re: Beta 2.079.0

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-announce
On Wednesday, February 21, 2018 10:04:01 Kagamin via Digitalmars-d-announce wrote: > On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: > > Yeah, personally I'd avoid writing it that way too. > > There's no other way to use this feature though. Some of us think that it's a bad

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Smaehtin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: Beta 2.079.0

2018-02-21 Thread Kagamin via Digitalmars-d-announce
On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: Yeah, personally I'd avoid writing it that way too. There's no other way to use this feature though.

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 21, 2018 09:21:58 0x via Digitalmars-d-learn wrote: > What is the equivalent of C++17 std::string_view (an object that > can refer to a constant contiguous sequence of char-like objects > with the first element of the sequence at position zero) in D? > > PS: I'm

Re: Why std_data_json is not default in phobos

2018-02-21 Thread Chris via Digitalmars-d
On Tuesday, 20 February 2018 at 21:53:59 UTC, Jonathan M Davis wrote: On Tuesday, February 20, 2018 15:08:04 aberba via Digitalmars-d wrote: And from the standpoint of a library developer, with dub and code.dlang.org, they can just make their libraries available for others to use without

Re: return type based on content of an array

2018-02-21 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 06:45:14 UTC, thorstein wrote: Hi, I'm going circles... ;) I read a string that contains an array of unknown dimension like: a = [1,2,3,4] or a = [[1,2],[3,4]] or a = [[[1,2],[3,4]],[[5,6],[7,8]]] With that I want to perform specified operations e.g. also

Re: NNTP client configuration

2018-02-21 Thread Walter Bright via Digitalmars-d
On 2/20/2018 10:21 PM, Manu wrote: Haha, I was starting to feel like I wasn't welcome :P No chance of that happening! Incidentally... I was kinda hoping it'd be back in the states this year, since I'm actually in the states now... but I'm still holding out to see if I can get to Germany. I

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 9:21 AM, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after years (since DMD 1 days). A

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: Beta 2.079.0

2018-02-21 Thread psychoticRabbit via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 10:15:48 UTC, Jonathan M Davis wrote: On Wednesday, February 21, 2018 10:04:01 Kagamin via Digitalmars-d-announce wrote: On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: > Yeah, personally I'd avoid writing it that way too. There's no other way

Re: Building from source on FreeBSD

2018-02-21 Thread psychoticRabbit via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 11:41:18 UTC, Diederik de Groot wrote: Removing the pragma(lib, "curl") seems to fix the issue on DFly (and FreeBSD). Updated the pull request. I guess pragma(lib, xxx) needs a little bit of attention to see what causes it not to work. something to do with

C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

[Issue 18482] New: wincrypt functions should be `@nogc` `nothrow`

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18482 Issue ID: 18482 Summary: wincrypt functions should be `@nogc` `nothrow` Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: Windows Status:

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, February 21, 2018 10:17:55 0x via Digitalmars-d-learn wrote: > On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: > > What is the equivalent of C++17 std::string_view (an object > > that can refer to a constant contiguous sequence of char-like > > objects with

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:22:56 UTC, rikki cattermole wrote: On 21/02/2018 10:17 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:23:23 UTC, Jonathan M Davis wrote: As I said in my previous response, read this article: https://dlang.org/articles/d-array-article.html Sorry, I didn't see this before I replied. Had I, I wouldn't have done that. string sv = "some string"; then _zero_

Re: Building from source on FreeBSD

2018-02-21 Thread Diederik de Groot via Digitalmars-d-learn
On Tuesday, 20 February 2018 at 03:59:06 UTC, psychoticRabbit wrote: On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote: ok... so I decided to dig into it a little further. seems the problem relates to a single line, in dget.d pragma(lib, "curl"); I just commented out

Re: -libpath?

2018-02-21 Thread Tony via Digitalmars-d
On Wednesday, 21 February 2018 at 02:21:14 UTC, Jonathan Marler wrote: If we added a new "linker-independent" flag to dmd, then you could add paths using the same interface regardless of which linker you are using. I'd expect the argument to be something like: -libpath= The

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:17 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:43 AM, 0x wrote: On Wednesday, 21 February 2018 at 10:24:39 UTC, ketmar wrote: 0x wrote: [...] and that is exactly what slices are for! ;-) you are probably better to use `const(char)[]`, tho. like this: // don't store `s`, as it's contents may change

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 10:43:14 UTC, 0x wrote: Gotta save this too. [BTW how do I post a thumbs up emoji] 

Re: Beta 2.079.0

2018-02-21 Thread Eugene Wissner via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 10:24:41 UTC, Paolo Invernizzi wrote: On Wednesday, 21 February 2018 at 10:15:48 UTC, Jonathan M Davis wrote: On Wednesday, February 21, 2018 10:04:01 Kagamin via Digitalmars-d-announce wrote: On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: >

Re: Dub, Cargo, Go, Gradle, Maven

2018-02-21 Thread Russel Winder via Digitalmars-d
On Fri, 2018-02-16 at 19:31 +, Dmitry Olshansky via Digitalmars-d wrote: > […] > Me personally in love with plugins and general purpose language > available to define tasks. Scala’s SBT may have many faults but > plugins and extensibility make it awesome. Maven has plugins but is seriously

Re: Beta 2.079.0

2018-02-21 Thread Suliman via Digitalmars-d-announce
On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: On Tue, Feb 20, 2018 at 10:19:03PM +, John Gabriele via Digitalmars-d-announce wrote: [...] Thanks. Is the point to be able to string a bunch of selective imports together, as in: import pkg.mod1 : sym1, sym2, pkg.mod2 :

[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #7 from ArturG --- (In reply to ArturG from comment #6) > (In reply to ArturG from comment #5) > > (In reply to ArturG from comment #4) > > > std.container and std.variant are also affected by this, none of

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ixid via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:42:56 UTC, Simen Kjærås wrote: On Wednesday, 21 February 2018 at 14:29:38 UTC, ixid wrote: I do not understand what is happening here, I tried to wrote what I thought would be the answer. If someone could explain that would be great. I wrote this code:

How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ParticlePeter via Digitalmars-d-learn
struct Foo(T) { T bar; this(S)(S s) { bar = convert(s); } } auto foo = Foo!int(some_float); this works because S is deduced as typeof(some_float), but how would I instantiate the struct without relying on auto deduction? Suppose we would have this kind of constructor where auto

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:11:10 UTC, ParticlePeter wrote: struct Foo(T) { T bar; this(S)(S s) { bar = convert(s); } } auto foo = Foo!int(some_float); this works because S is deduced as typeof(some_float), but how would I instantiate the struct without relying on auto

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ixid via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:11:10 UTC, ParticlePeter wrote: struct Foo(T) { T bar; this(S)(S s) { bar = convert(s); } } auto foo = Foo!int(some_float); this works because S is deduced as typeof(some_float), but how would I instantiate the struct without relying on auto

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:29:38 UTC, ixid wrote: I do not understand what is happening here, I tried to wrote what I thought would be the answer. If someone could explain that would be great. I wrote this code: struct Foo2(T, S) { T bar; this(S s) { bar = s.to!T; } }

Re: Negative index range violation

2018-02-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 February 2018 at 00:13:43 UTC, SrMordred wrote: string x = "123"; auto c = x.ptr; c++; writeln(c[-1]); // 1 That's only happening because pointers bypass range checks. writeln(c[-1..0]); //BOOM Range violation But with a slice negative indexes are never allowed, even on a

Re: SPF record for forum.dlang.org

2018-02-21 Thread Vladimir Panteleev via Digitalmars-d
On Thursday, 22 February 2018 at 00:16:47 UTC, kdevel wrote: Return-Path: Received: from k3.1azy.net (k3.1azy.net [178.33.224.37]) Is this host ligitimately sending out these notifications? Yes. 178.33.224.37 is the IPv4 address of forum.dlang.org, and

Re: Beta 2.079.0

2018-02-21 Thread psychoticRabbit via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 16:58:22 UTC, H. S. Teoh wrote: On Wed, Feb 21, 2018 at 02:46:56PM +, psychoticRabbit via Digitalmars-d-announce wrote: [...] Syntax is EVERYTHING. It can make or break a language. And semantics doesn't matter. :-D T assert("easy on the eyes" ==

Re: -libpath?

2018-02-21 Thread Jonathan Marler via Digitalmars-d
On Wednesday, 21 February 2018 at 04:07:38 UTC, Mike Franklin wrote: On Tuesday, 6 February 2018 at 17:49:33 UTC, Jonathan Marler wrote: What do people think of adding an argument to DMD to add library search paths? Currently the only way I know how to do this would be via linker-specific

Re: SPF record for forum.dlang.org

2018-02-21 Thread Vladimir Panteleev via Digitalmars-d
On Wednesday, 21 February 2018 at 21:57:59 UTC, kdevel wrote: I would greatly appreciate if the zone admin of dlang.org adds an SPF record also to forum.dlang.org. Hi, SPF/DKIM/DMARC are good ideas in general (currently *.forum.dlang.org is CNAME'd to a single domain, so that would need to

Negative index range violation

2018-02-21 Thread SrMordred via Digitalmars-d-learn
string x = "123"; auto c = x.ptr; c++; writeln(c[-1]); // 1 writeln(c[-1..0]); //BOOM Range violation Can I do this / Bug / some mistake ?

Re: SPF record for forum.dlang.org

2018-02-21 Thread kdevel via Digitalmars-d
Vladimir! On Wednesday, 21 February 2018 at 23:21:05 UTC, Vladimir Panteleev wrote: On Wednesday, 21 February 2018 at 21:57:59 UTC, kdevel wrote: I would greatly appreciate if the zone admin of dlang.org adds an SPF record also to forum.dlang.org. Hi, SPF/DKIM/DMARC are good ideas in

Going from string to identifier

2018-02-21 Thread Jean-Louis Leroy via Digitalmars-d-learn
Here's what I am trying to do: mixin template MakeFun(string ID, int X) { int mixin(ID)() { return X; } } mixin MakeFun!("one", 1); // int one() { return 1; } Alas I get: makefunc.d(3): Error: no identifier for declarator `int` makefunc.d(3): Error: found `{` when expecting `;`

array/Array: "hard" bounds checking

2018-02-21 Thread kdevel via Digitalmars-d-learn
Is there a D equivalent of the C++ at method? I would like to reformulate repro2.d --- void main () { import std.stdio; import std.container; import std.range; auto z = Array!char(); z.reserve(0xC000_); z.capacity.writeln; z.length.writeln; for (uint u = 0; u <

Re: Negative index range violation

2018-02-21 Thread SrMordred via Digitalmars-d-learn
But with a slice negative indexes are never allowed, even on a pointer. youd have to do (c-1)[0 .. 1]; Nice! Thank you both! In D Slice article it says "You can even use negative indexes!" so I thought that the [-1..x] should work too :)

Re: Going from string to identifier

2018-02-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 22:22:55 UTC, Meta wrote: Mixins have to be full declarations. They need to be full declarations, full statements, or full expressions, depending on the context where they appear. string s = mixin("teste"); so that is a full expression and thus

Re: Going from string to identifier

2018-02-21 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 22:22:55 UTC, Meta wrote: (I'm not sure if the available compiler implementations actually enforce this) Yes it does, example ``` enum s = q{€}; ``` gives: `Error: character 0x20ac is not a valid token`

Re: Negative index range violation

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/21/18 7:30 PM, SrMordred wrote: But with a slice negative indexes are never allowed, even on a pointer. youd have to do (c-1)[0 .. 1]; Nice! Thank you both! In D Slice article it says "You can even use negative indexes!" so I thought that the [-1..x] should work too :) Hah! I

Re: array/Array: "hard" bounds checking

2018-02-21 Thread TheFlyingFiddle via Digitalmars-d-learn
On Thursday, 22 February 2018 at 00:34:59 UTC, kdevel wrote: Is there a D equivalent of the C++ at method? I would like to reformulate repro2.d --- void main () { import std.stdio; import std.container; import std.range; auto z = Array!char(); z.reserve(0xC000_);

[Issue 18474] Postblit not working in shared structs

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18474 Jonathan M Davis changed: What|Removed |Added CC|

what are guidelines for when to split a module into a package?

2018-02-21 Thread Timothee Cour via Digitalmars-d
from my perspective it makes sense to split a module M into submodules A, B when: * M is large * there's little interaction between A and B (eg only few symbols from A are needed in B and vice versa) * A and B are logically grouped (that is domain specific) * it doesn't turn into an extreme (1

Re: what are guidelines for when to split a module into a package?

2018-02-21 Thread Timothee Cour via Digitalmars-d
``` import std.algorithm.searching : find; not import std.algorithm : find; ``` that's just a missed opportunity to benefit from the split; we're in no way worse after the split than before the split in that regard. We can just leave it as `import std.algorithm : find;` with no adverse effect.

Re: D source code formatter

2018-02-21 Thread aberba via Digitalmars-d
On Thursday, 22 February 2018 at 05:38:38 UTC, psychoticRabbit wrote: On Thursday, 22 February 2018 at 04:48:58 UTC, Nicholas Wilson wrote: On Thursday, 22 February 2018 at 04:35:24 UTC, psychoticRabbit wrote: I rely (heavily) on clang-format in my C code. It save me so much effort and has

Re: what are guidelines for when to split a module into a package?

2018-02-21 Thread rikki cattermole via Digitalmars-d
On 22/02/2018 8:13 PM, Timothee Cour wrote: from my perspective it makes sense to split a module M into submodules A, B when: * M is large Soft 1k, 2-3k hard limit. At this point either your scope is good, or you need to subdivide it again.

Re: Why std_data_json is not default in phobos

2018-02-21 Thread aberba via Digitalmars-d
On Tuesday, 20 February 2018 at 21:53:59 UTC, Jonathan M Davis wrote: On Tuesday, February 20, 2018 15:08:04 aberba via Digitalmars-d wrote: [...] Well, ideally, std.json would be replaced with something better, but it does work, and there's always going to be stuff outside of the standard

Re: what are guidelines for when to split a module into a package?

2018-02-21 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, February 21, 2018 23:13:33 Timothee Cour via Digitalmars-d wrote: > from my perspective it makes sense to split a module M into submodules > A, B when: > * M is large > * there's little interaction between A and B (eg only few symbols from > A are needed in B and vice versa) > * A

Re: D source code formatter

2018-02-21 Thread Timothee Cour via Digitalmars-d
note that we'd need to implement https://github.com/dlang-community/dfmt/issues/159 ( option to format only diff-ed lines (like git clang-format)) in order to run dfmt on only the part of source code that was modified in a PR. this is to avoid concern that it affects git history / git blame

Re: what are guidelines for when to split a module into a package?

2018-02-21 Thread Timothee Cour via Digitalmars-d
> it's harder to find symbols i don't understand this argument. ``` dscanner --declaration startsWith ./std/algorithm/searching.d(4105:6) ./std/algorithm/searching.d(4195:6) ./std/algorithm/searching.d(4265:6) ./std/algorithm/searching.d(4301:6) ``` On Wed, Feb 21, 2018 at 11:31 PM, Jonathan

Re: Annotation of functions

2018-02-21 Thread Tony via Digitalmars-d
On Tuesday, 20 February 2018 at 12:15:57 UTC, psychoticRabbit wrote: I've noticed that Go and Rust annotate functions. func (in go) fn (in rust) I was kind of wondering why they made that choice, given compilers in many languages do not. On Tuesday, 20 February 2018 at 12:15:57 UTC,

Re: D source code formatter

2018-02-21 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 22 February 2018 at 04:35:24 UTC, psychoticRabbit wrote: I rely (heavily) on clang-format in my C code. It save me so much effort and has become a vital day to day tool for me. I was wondering whether D also has a 'reliable' source code formatter. (reliable being a key word

Re: Tuts/Aritcles: Incrementasl C++-to-D conversion?

2018-02-21 Thread Mike Franklin via Digitalmars-d-learn
On Thursday, 22 February 2018 at 04:16:44 UTC, Nick Sabalausky (Abscissa) wrote: Are there any tutorials or articles out there for "getting started with converting a C++ codebase to D one module at a time?" Or at the very least: tips, tricks, lessions learned, from those who have come before.

Re: D source code formatter

2018-02-21 Thread rikki cattermole via Digitalmars-d
On 22/02/2018 6:38 PM, psychoticRabbit wrote: On Thursday, 22 February 2018 at 04:48:58 UTC, Nicholas Wilson wrote: On Thursday, 22 February 2018 at 04:35:24 UTC, psychoticRabbit wrote: I rely (heavily) on clang-format in my C code. It save me so much effort and has become a vital day to day

SPF record for forum.dlang.org

2018-02-21 Thread kdevel via Digitalmars-d
Today I received a notification *e-mail* after somebody has replied to a post: https://forum.dlang.org/thread/jiefcxwqbjzqnmtaz...@forum.dlang.org#post-sksbiiwnfsxocklwcfsd:40forum.dlang.org I would greatly appreciate if the zone admin of dlang.org adds an SPF record also to forum.dlang.org.

Re: Going from string to identifier

2018-02-21 Thread Meta via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 22:11:04 UTC, Jean-Louis Leroy wrote: Here's what I am trying to do: mixin template MakeFun(string ID, int X) { int mixin(ID)() { return X; } } mixin MakeFun!("one", 1); // int one() { return 1; } Alas I get: makefunc.d(3): Error: no identifier for

Re: Negative index range violation

2018-02-21 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 22 February 2018 at 00:13:43 UTC, SrMordred wrote: string x = "123"; auto c = x.ptr; c++; writeln(c[-1]); // 1 writeln(c[-1..0]); //BOOM Range violation Can I do this / Bug / some mistake ? youd have to do (c-1)[0 .. 1];

Re: D source code formatter

2018-02-21 Thread psychoticRabbit via Digitalmars-d
On Thursday, 22 February 2018 at 04:48:58 UTC, Nicholas Wilson wrote: On Thursday, 22 February 2018 at 04:35:24 UTC, psychoticRabbit wrote: I rely (heavily) on clang-format in my C code. It save me so much effort and has become a vital day to day tool for me. I was wondering whether D also

Tuts/Aritcles: Incrementasl C++-to-D conversion?

2018-02-21 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
Are there any tutorials or articles out there for "getting started with converting a C++ codebase to D one module at a time?" Or at the very least: tips, tricks, lessions learned, from those who have come before.

[Issue 18487] wrong warning: `A unittest should be annotated with at least @safe or @system`

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18487 greenify changed: What|Removed |Added Status|NEW |RESOLVED

Re: D source code formatter

2018-02-21 Thread Seb via Digitalmars-d
On Thursday, 22 February 2018 at 04:35:24 UTC, psychoticRabbit wrote: I rely (heavily) on clang-format in my C code. It save me so much effort and has become a vital day to day tool for me. I was wondering whether D also has a 'reliable' source code formatter. (reliable being a key word

D source code formatter

2018-02-21 Thread psychoticRabbit via Digitalmars-d
I rely (heavily) on clang-format in my C code. It save me so much effort and has become a vital day to day tool for me. I was wondering whether D also has a 'reliable' source code formatter. (reliable being a key word there). Also, if it does, then why is it not included in the distribution

[Issue 18487] New: wrong warning: `A unittest should be annotated with at least @safe or @system`

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18487 Issue ID: 18487 Summary: wrong warning: `A unittest should be annotated with at least @safe or @system` Product: D Version: D2 Hardware: x86 OS: Mac OS X

[Issue 13727] std.stdio.File not thread-safe

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13727 Steven Schveighoffer changed: What|Removed |Added See Also|

Re: Beta 2.079.0

2018-02-21 Thread psychoticRabbit via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 15:33:02 UTC, Joakim wrote: I thought about chiming in on that PR when it was open, but didn't because the vote was split at 5-5 and I thought it wouldn't get merged. Also, I'm not against the idea in principle, but I do wish you'd chosen better syntax,

Please submit to DConf 2018!

2018-02-21 Thread Andrei Alexandrescu via Digitalmars-d
With the Feb 25 deadline looming, allow me to holler to everyone who has worked on great things in the D language through the past year: please make a DConf 2018 submission! By all measures there's been significant pick up in contributions to the D language during the recent months, and it

Re: Manually allocating a File

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/20/18 9:59 PM, Nicholas Wilson wrote: FYI, File is a reference counted FILE* so theres not really any point of heap allocating it. More FYI, the reference counted payload is actually allocated on the C heap :) So you are wasting a lot of effort to do something that is already done.

[Issue 18451] [REG 2.076.1] In certain circumstances, calling remove on an array of delegates fails

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18451 --- Comment #8 from ArturG --- (In reply to ArturG from comment #7) > (In reply to ArturG from comment #6) > > (In reply to ArturG from comment #5) > > > (In reply to ArturG from comment #4) > > > > std.container and

[Issue 18483] New: [DMC Libc] std.stdio.File is completely thread unsafe on Win32

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18483 Issue ID: 18483 Summary: [DMC Libc] std.stdio.File is completely thread unsafe on Win32 Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW

Re: New abstraction: Layout

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d
On 2/20/18 10:56 PM, Andrei Alexandrescu wrote: On 02/20/2018 07:34 AM, Steven Schveighoffer wrote: I haven't looked at it in depth, so I didn't know the result of the abstraction (I thought it was a tuple, or a pair of tuples). Note, you could do this without the need for a new abstraction,

Re: Beta 2.079.0

2018-02-21 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Feb 21, 2018 at 02:46:56PM +, psychoticRabbit via Digitalmars-d-announce wrote: [...] > Syntax is EVERYTHING. It can make or break a language. And semantics doesn't matter. :-D T -- Let's not fight disease by killing the patient. -- Sean 'Shaleh' Perry

Re: Beta 2.079.0

2018-02-21 Thread Joakim via Digitalmars-d-announce
On Tuesday, 20 February 2018 at 08:43:50 UTC, Martin Nowak wrote: On Monday, 19 February 2018 at 15:58:57 UTC, Joakim wrote: 17. Allow multiple selective imports from different modules in a single import statement I have a bad feeling that that one is going to be a source of a raft of bugs

[Issue 18484] New: [dip1000] Subtype allows reference to escape with implicit casting

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18484 Issue ID: 18484 Summary: [dip1000] Subtype allows reference to escape with implicit casting Product: D Version: D2 Hardware: x86_64 OS: Windows

[Issue 18484] [dip1000] Subtype allows reference to escape with implicit casting

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18484 Radu changed: What|Removed |Added Keywords||safe --

Re: Destructing Struct

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/21/18 6:24 AM, Jiyan wrote: I think i found my solution: is it __xdtor? :P Yes, that is the function that will run *recursively* all the destructors (just __dtor runs the destructor method if you provided one). But I'd recommend as the others did, using destroy. -Steve

Re: Can someone help a Reddit user

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/20/18 2:52 PM, Steven Schveighoffer wrote: On 2/20/18 2:00 PM, bachmeier wrote: Someone has posted a question on our subreddit. Would be nice if he could get an answer: https://www.reddit.com/r/d_language/comments/7yxwvm/why_do_my_threads_write_to_the_wrong_file/ I responded. Looks to

Please submit to DConf 2018!

2018-02-21 Thread Andrei Alexandrescu via Digitalmars-d
With the Feb 25 deadline looming, allow me to holler to everyone who has worked on great things in the D language through the past year: please make a DConf 2018 submission! By all measures there's been significant pick up in contributions to the D language during the recent months, and it

Re: How to instantiate a template struct with a template constructor without relying on auto deduction?

2018-02-21 Thread ParticlePeter via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 14:29:31 UTC, Simen Kjærås wrote: On Wednesday, 21 February 2018 at 14:11:10 UTC, ParticlePeter wrote: struct Foo(T) { T bar; this(S)(S s) { bar = convert(s); } } auto foo = Foo!int(some_float); this works because S is deduced as

Please submit to DConf 2018!

2018-02-21 Thread Andrei Alexandrescu via Digitalmars-d-announce
With the Feb 25 deadline looming, allow me to holler to everyone who has worked on great things in the D language through the past year: please make a DConf 2018 submission! By all measures there's been significant pick up in contributions to the D language during the recent months, and it

Re: return type based on content of an array

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/21/18 1:45 AM, thorstein wrote: Hi, I'm going circles... ;) I read a string that contains an array of unknown dimension like: a = [1,2,3,4] or a = [[1,2],[3,4]] or a = [[[1,2],[3,4]],[[5,6],[7,8]]] With that I want to perform specified operations e.g. also provided on command line.

Re: Annotation of functions

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d
On 2/20/18 8:53 PM, psychoticRabbit wrote: On Tuesday, 20 February 2018 at 13:40:16 UTC, bauss wrote: I should probably have put an example usage to show how it's used: This makes we want to go back and program in C again ;-) (but thanks for taking the time to demo/explain) Mixins

[Issue 18482] wincrypt functions should be `@nogc` `nothrow`

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18482 --- Comment #1 from Nathan S. --- Pull request https://github.com/dlang/druntime/pull/2103 --

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread ketmar via Digitalmars-d-learn
0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm

Re: Beta 2.079.0

2018-02-21 Thread Paolo Invernizzi via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 10:15:48 UTC, Jonathan M Davis wrote: On Wednesday, February 21, 2018 10:04:01 Kagamin via Digitalmars-d-announce wrote: On Tuesday, 20 February 2018 at 22:54:43 UTC, H. S. Teoh wrote: > Yeah, personally I'd avoid writing it that way too. There's no other way

Re: Dub, Cargo, Go, Gradle, Maven

2018-02-21 Thread Russel Winder via Digitalmars-d
On Fri, 2018-02-16 at 14:48 -0800, H. S. Teoh via Digitalmars-d wrote: > […] > > This assumes that the upstream server (1) consistently serves the > same > data for the same version -- which in principle will be the case, but > unforeseen problems could break this assumption; (2) stores all >

[Issue 18460] Improve error message for missing 'new' for class instantiation

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18460 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 18460] Improve error message for missing 'new' for class instantiation

2018-02-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18460 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9722ef760768ea0be881268e158ed726bdcb99e0 Fix Issue 18460 - Improve error message for missing 'new' for

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread 0xFFFFFFFF via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero) in D? PS: I'm getting back to D after

Re: C++ std::string_view equivalent in D?

2018-02-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/02/2018 10:41 AM, 0x wrote: On Wednesday, 21 February 2018 at 09:21:58 UTC, 0x wrote: What is the equivalent of C++17 std::string_view (an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero)

Destructing Struct

2018-02-21 Thread Jiyan via Digitalmars-d-learn
Hi :), What i thought was that when i create a struct dynamically i can just deconstruct it with __dtor lets say: struct U {...} struct S {... private U _member;} S* p; p = cast(S*)malloc(S.sizeof); // just run that if it compiles, for simplicity // we dont use __traits(compiles, ...)

Re: Destructing Struct

2018-02-21 Thread Jiyan via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 11:12:01 UTC, Jiyan wrote: Hi :), What i thought was that when i create a struct dynamically i can just deconstruct it with __dtor lets say: struct U {...} struct S {... private U _member;} S* p; p = cast(S*)malloc(S.sizeof); // just run that if it

Re: Destructing Struct

2018-02-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 February 2018 at 12:07:47 UTC, ketmar wrote: `p.destroy` will call the dtors for you. So it is the same function but I prefer to always write it: .destroy(p); yes, a leading dot. This ensures you call the top-level destroy function instead of any members which may not do

Re: Beta 2.079.0

2018-02-21 Thread Paolo Invernizzi via Digitalmars-d-announce
On Wednesday, 21 February 2018 at 10:47:45 UTC, Eugene Wissner wrote: On Wednesday, 21 February 2018 at 10:24:41 UTC, Paolo Invernizzi wrote: On Wednesday, 21 February 2018 at 10:15:48 UTC, Jonathan M Davis wrote: On Wednesday, February 21, 2018 10:04:01 Kagamin via Digitalmars-d-announce

Re: -libpath?

2018-02-21 Thread Tony via Digitalmars-d
On Wednesday, 21 February 2018 at 10:23:08 UTC, Tony wrote: There is a tool that lets you call GDC and use DMD command-line options (gdmd). If it doesn't already exist, what about a tool that allows you to call DMD using GDC options (which I think are the same as gcc/g++/clang/clang++)? I

Re: Beta 2.079.0

2018-02-21 Thread Jonathan M Davis via Digitalmars-d-announce
On Wednesday, February 21, 2018 10:24:41 Paolo Invernizzi via Digitalmars-d- announce wrote: > On Wednesday, 21 February 2018 at 10:15:48 UTC, Jonathan M Davis > > wrote: > > On Wednesday, February 21, 2018 10:04:01 Kagamin via > > > > Digitalmars-d-announce wrote: > >> On Tuesday, 20 February

  1   2   >