Re: Deprecation message sources

2019-09-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 17, 2019 5:28:33 PM MDT H. S. Teoh via Digitalmars-d- learn wrote: > On Tue, Sep 17, 2019 at 08:55:27PM +, Johan Engelen via > Digitalmars-d-learn wrote: [...] > > > Wow. How come this is not caught by the CI testing? > > [...] > > Is the CI setup to detect deprecations

Re: Slicing upward

2019-09-14 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 14, 2019 5:34:35 AM MDT Brett via Digitalmars-d-learn wrote: > I have an algorithm that is most efficiently implement by taking > an array and slicing it upward, meaning removing the leading > elements. > > Because the algorithm is complex(deterministic but chaotic) and >

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 8, 2019 12:12:53 PM MDT Exil via Digitalmars-d-learn wrote: > On Saturday, 7 September 2019 at 22:19:48 UTC, Jonathan M Davis > > wrote: > > On Saturday, September 7, 2019 3:40:58 PM MDT Exil via > > > > Digitalmars-d-learn wrote: > >> On Saturday, 7 September 2019 at

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 8, 2019 3:03:31 AM MDT Max Samukha via Digitalmars-d- learn wrote: > On Saturday, 7 September 2019 at 22:19:48 UTC, Jonathan M Davis > > wrote: > > On Saturday, September 7, 2019 3:40:58 PM MDT Exil via > > > > Digitalmars-d-learn wrote: > >> On Saturday, 7 September 2019 at

Re: Mingling string and identifier namespaces in nested extern(C++) decls

2019-09-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 7, 2019 2:18:40 PM MDT Jonathan M Davis via Digitalmars-d-learn wrote: > On Saturday, September 7, 2019 8:53:54 AM MDT Max Samukha via > Digitalmars-d- > learn wrote: > > extern(C++, "ns1") { > > > > extern(C++,

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 7, 2019 3:40:58 PM MDT Exil via Digitalmars-d-learn wrote: > On Saturday, 7 September 2019 at 17:22:07 UTC, Jonathan M Davis > > wrote: > > @safe: > > @system: > > > > then @system overrides @safe. > > Just to add onto this, you can't do: > > @safe @system void foo();

Re: Mingling string and identifier namespaces in nested extern(C++) decls

2019-09-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 7, 2019 8:53:54 AM MDT Max Samukha via Digitalmars-d- learn wrote: > extern(C++, "ns1") { > extern(C++, ns2) { > extern(C++, "ns3") { > extern(C++, ns4) { > void foo(); > } > } > } > } > > pragma(msg, foo.mangleof); //

Re: Should an 'extern(C++, "ns"):' override previous ones in the same scope?

2019-09-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 7, 2019 9:15:44 AM MDT Max Samukha via Digitalmars-d- learn wrote: > extern(C++, "ns1"): > extern(C++, "ns2"): // Not in nested scope. Should it supersede? > void foo(); > > pragma(msg, foo.mangleof); // _ZN3ns13ns23fooEv instead of > expected _ZN3ns23fooEv > > Is that by

Re: Old code no longer working on any DMD compilers

2019-09-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 5, 2019 11:59:30 PM MDT Jamie via Digitalmars-d-learn wrote: > On Friday, 6 September 2019 at 00:41:12 UTC, Jonathan M Davis > > wrote: > > On Thursday, September 5, 2019 6:24:07 PM MDT Jamie via > > > > Digitalmars-d-learn wrote: > >>

Re: Old code no longer working on any DMD compilers

2019-09-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, September 5, 2019 6:24:07 PM MDT Jamie via Digitalmars-d-learn wrote: > I just picked up some of my old code that was working when I last > used it (approximately 6 months ago) but now is no longer > working. I thought it was due to using an updated compiler, so I > have installed

Re: Quick question regarding dynamic array deletions

2019-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 1, 2019 12:42:54 PM MDT Dennis via Digitalmars-d-learn wrote: > On Sunday, 1 September 2019 at 18:26:20 UTC, WhatMeWorry wrote: > > Maybe my question is when would be want to use 3) without also > > adjusting the .ptr ? > > It matters when casting to a boolean, since an empty

Re: Is removing elements of AA in foreach loop safe?

2019-08-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, August 29, 2019 4:11:58 AM MDT berni via Digitalmars-d-learn wrote: > Iterating of some structure and removing elements thereby is > always errorprone and should be avoided. But: In case of AA, I've > > got the feeling, that it might be safe: > > foreach (k,v;ways) > > > > if

Re: Question about generation of template functions

2019-08-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 28, 2019 2:56:25 PM MDT Machine Code via Digitalmars-d- learn wrote: > I was writing a recursive function that uses template, I thought > it would generate the proper template function on the fly to > match the type in the parameter but it seems to not so so and try > > to use

Re: .fflush() in stdio.d

2019-08-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 25, 2019 11:59:08 PM MDT berni via Digitalmars-d-learn wrote: > Out of curiosity: Browsing the source of stdio.d I found that > flush() is implemented by calling fflush from some C++ library. > What I don't understand: Why is the call to fflush preceded by a > dot? The dot

Re: how to definition a non-const pointer that point a const var.

2019-08-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 24, 2019 12:48:33 AM MDT Max Haughton via Digitalmars-d- learn wrote: > On Saturday, 24 August 2019 at 05:03:43 UTC, Jonathan M Davis > > wrote: > > On Friday, August 23, 2019 10:14:56 PM MDT lili via > > > > Digitalmars-d-learn wrote: > >> Hi: > >>In C we can definition

Re: how to definition a non-const pointer that point a const var.

2019-08-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 23, 2019 10:14:56 PM MDT lili via Digitalmars-d-learn wrote: > Hi: >In C we can definition const int *ncp_to_cv; > or int * const cp_to_ncv; >How to do this in D. D uses parens to restrict how much of the type is const. const int* - const pointer to const int

Re: Template specialized functions creating runtime instructions?

2019-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 20, 2019 5:48:04 PM MDT ads via Digitalmars-d-learn wrote: > This piece of code creates a fizzbuzz string with template > parameters. > > auto fizzbuzz(uint N)() { > string accumulate; > return fizzbuzz!N(accumulate); > } > > auto fizzbuzz(uint N)(ref string result) if (N %

Re: Can't add a const ubyte to a dynamic array of ubyte?

2019-08-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 20, 2019 3:27:36 AM MDT ads via Digitalmars-d-learn wrote: > import std.stdio; > > ubyte[] extend(in uint[] arr) > { > ubyte[] result; > foreach (n; arr) > { > if (n < 10) > { > result ~= n; > // source/app.d(10,11): Error:

Re: Is there any implementation of a 128bit integer?

2019-08-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 19, 2019 11:38:01 AM MDT Saurabh Das via Digitalmars-d- learn wrote: > The cent and ucent types are reserved for the future. Is there > any knowledge/timeline on when they might be implemented? > > Currently, is there a useable 128bit integer type in DMD/LDC/GDC? > > Or perhaps a

Re: can DDOC generate files names including the full path ?

2019-08-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, August 14, 2019 3:43:10 AM MDT wjoe via Digitalmars-d-learn wrote: > For example if the source tree looks like this: > >source/ > > > > foo/ > > > > baz.d > > > > bar/ > > > > baz.d > > and generating the docs with something like this: > > dmd -D -Dd=docs foo/baz.d

Re: ref auto getRange() return scope move struct ?

2019-08-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 16, 2019 8:14:52 AM MDT Newbie2019 via Digitalmars-d-learn wrote: > On Friday, 16 August 2019 at 13:51:49 UTC, Jonathan M Davis wrote: > > It is not possible to prevent moving in D as things currently > > stand. DIP 1014 will need to be implemented to either hook into > > moves

Re: ref auto getRange() return scope move struct ?

2019-08-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 16, 2019 6:29:19 AM MDT Newbie2019 via Digitalmars-d-learn wrote: > On Friday, 16 August 2019 at 12:23:01 UTC, Newbie2019 wrote: > > I has this simple function has some memory bugs: > > > > --- > > struct TreeRange { > > > > @disable this() ; > > @disable this(this)

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 16, 2019 2:16:31 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: > On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis > > wrote: > > Not being able to implicitly convert to const is a bit odd, but > > arguably, nothing should ever be called on a shared AA anyway. >

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread Jonathan M Davis via Digitalmars-d-learn
n Thursday, August 15, 2019 11:33:06 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: > Code: > > import std; > > shared(string[string]) dict; > > void main() > { > dict.keys; > } > > Error: > > /dlang/dmd/linux/bin64/../../src/druntime/import/object.d(3417): > Error: cannot implicitly

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 13, 2019 11:33:10 AM MDT Mirjam Akkersdijk via Digitalmars-d-learn wrote: > On Tuesday, 13 August 2019 at 14:04:45 UTC, Sebastiaan Koppe > > wrote: > > On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk > > > > wrote: > >> and I would like to sort based on Node.t,

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 13, 2019 3:48:52 AM MDT Mirjam Akkersdijk via Digitalmars-d-learn wrote: > Hello there, > If I had a DLL, how would I sort it judging by the node contents, > the D way? > > In C if I were to sort a piece of malloc'd memory pointing to > node pointers, I would write my compare

Re: What the abstrac final class mean?

2019-08-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, August 13, 2019 3:03:49 AM MDT Jacob Carlborg via Digitalmars-d- learn wrote: > On 2019-08-12 11:25, a11e99z wrote: > > its weird that next compiles in some weird form > > > > import std; > > static class A { > > > > static a() { "a".writeln; } // forgot return type > > > > } > >

Re: What the abstrac final class mean?

2019-08-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, August 12, 2019 2:54:56 AM MDT lili via Digitalmars-d-learn wrote: > Hi: > Why need defined an abstract final class? > see > https://github.com/Rikarin/Trinix/blob/master/Kernel/arch/amd64/gdt.d It's one way to effectively create a namespace using a class. Another way would

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 11, 2019 2:32:14 PM MDT John Colvin via Digitalmars-d- learn wrote: > On Sunday, 11 August 2019 at 20:15:34 UTC, Alex wrote: > > As I see this, everything you wrote is correct. :) > > > > But you compared abstractness with interface usage, initially. > > So... I would say,

Re: How to get name of my application (project)

2019-08-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, August 3, 2019 5:47:33 AM MDT Rémy Mouëza via Digitalmars-d- learn wrote: > On Saturday, 3 August 2019 at 09:26:03 UTC, Andrey wrote: > > Hello, how to get name of my application (project) that we > > write in dub.json? Is there any compile-time constant like > > __MODULE__? > > If I

Re: Can I remove an element from a global associative array from within a class destructor?

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 5:13:10 PM MDT realhet via Digitalmars-d-learn wrote: > Hi, > > I tried to make some resource statistict for my OpenGL Buffer > objects: > > > //here are the things that hold the statistics. > private __gshared{ size_t[int] textureSizeMap, bufferSizeMap; } > > struct

Re: [OT] Re: Using Haskell for teaching [was: Help me decide D or C]

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 11:05:13 AM MDT Russel Winder via Digitalmars-d- learn wrote: > On Fri, 2019-08-02 at 10:25 -0600, Jonathan M Davis via > Digitalmars-d-learn wrote: > > […] > > > My feeling is that functional languages are likely to be a very poor > > pl

Re: Help me decide D or C

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 10:13:04 AM MDT bachmeier via Digitalmars-d-learn wrote: > On Thursday, 1 August 2019 at 22:36:06 UTC, Russel Winder wrote: > > On Thu, 2019-08-01 at 14:49 +, bachmeier via > > Digitalmars-d-learn wrote: […] > > > >> There's nothing wrong with Haskell if you want to

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 3:11:45 PM MDT Matt via Digitalmars-d-learn wrote: > On Monday, 29 July 2019 at 19:38:34 UTC, Jonathan M Davis wrote: > > On Monday, July 29, 2019 11:32:58 AM MDT Matt via > > Digitalmars-d-learn wrote: > > > > > > > > Because const ranges are basically useless, there

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 1:35:18 PM MDT H. S. Teoh via Digitalmars-d-learn wrote: > Generally, the idiom is to let the compiler do attribute inference by > templatizing your code and not writing any explicit attributes, then use > unittests to ensure that instantiations of the range that ought to

Re: Why in Phobos is empty() sometimes const and sometimes not

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 11:32:58 AM MDT Matt via Digitalmars-d-learn wrote: > I've noticed that for some ranges in Phobos empty is marked const > (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not > const. Is there a reason why? Isn't empty guaranteed not to alter > the data of the

Re: There is anything like nodiscard attribute in D?

2019-07-29 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 29, 2019 8:23:43 AM MDT victoroak via Digitalmars-d-learn wrote: > I have an Expected/Result struct, but without an attribute > similar to nodiscard > (https://en.cppreference.com/w/cpp/language/attributes/nodiscard) > is not very useful. > > There is anything like that in D? If

Re: Is it possible to disallow import for certain functions?

2019-07-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 27, 2019 7:12:32 AM MDT evilrat via Digitalmars-d-learn wrote: > On Saturday, 27 July 2019 at 12:48:12 UTC, BoQsc wrote: > > I seem to be doing something wrong, the result is the same. > > > >> otherFile.d(8): Error: only one main, WinMain, or DllMain > >> allowed. Previously

Re: Is betterC affect to compile time?

2019-07-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2019 6:13:38 PM MDT Mike Franklin via Digitalmars-d- learn wrote: > On Thursday, 25 July 2019 at 18:37:49 UTC, Jonathan M Davis wrote: > > There's probably at least one bug report on it, but as I > > understand it, it's not a bug in the sense that the > > implementation is

Re: Is betterC affect to compile time?

2019-07-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 25, 2019 8:20:03 AM MDT Ali Çehreli via Digitalmars-d- learn wrote: > On 07/25/2019 05:46 AM, Oleg B wrote: > > On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: > >> Those restrictions don't stop at runtime. > > > > It's vary sad. > > > > What reason for such

Re: Why is Throwable.TraceInfo.toString not @safe?

2019-07-22 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 22, 2019 1:29:21 AM MDT Johannes Loher via Digitalmars-d- learn wrote: > Am 22.07.19 um 05:16 schrieb Paul Backus: > > On Sunday, 21 July 2019 at 18:03:33 UTC, Johannes Loher wrote: > >> I'd like to log stacktraces of caught exceptions in an @safe manner. > >> However,

Re: Milliseconds

2019-07-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 12, 2019 12:51:28 AM MDT Giovanni Di Maria via Digitalmars- d-learn wrote: > Hi > I have read much, before to write here. > How can i store, to an int variable, the milliseconds of the > current time? > It's simple, but i don't find the solution. > Thank you very much. > > Giovanni

Re: Is there a way to slice non-array type in @safe?

2019-07-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 11, 2019 1:44:51 PM MDT Stefanos Baziotis via Digitalmars- d-learn wrote: > On Thursday, 11 July 2019 at 19:37:38 UTC, Nathan S. wrote: > > If you know that what you're doing cannot result in memory > > corruption but the compiler cannot automatically infer @safe, > > it is

Re: Is there something like a consuming take?

2019-07-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, July 7, 2019 12:36:42 PM MDT berni via Digitalmars-d-learn wrote: > On Sunday, 7 July 2019 at 09:01:53 UTC, Jonathan M Davis wrote: > > Without slicing, that's impossible without iterating over the > > elements multiple times. > > That's what I thought too, but meanwhile I think it is

Re: Is there something like a consuming take?

2019-07-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 6, 2019 12:58:52 PM MDT Adam D. Ruppe via Digitalmars-d- learn wrote: > On Saturday, 6 July 2019 at 18:17:26 UTC, Jonathan M Davis wrote: > > take _always_ consumes the range that it's given > > not if it hasSlicing. see >

Re: Is there something like a consuming take?

2019-07-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 6, 2019 11:02:15 PM MDT berni via Digitalmars-d-learn wrote: > Or better: I'd like to hand in my voucher and get back two > vouchers, one for the first 5 bytes and one for the rest. That's > actually, what I thought, take() is doing... Without slicing, that's impossible without

Re: Is there something like a consuming take?

2019-07-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 6, 2019 12:17:26 PM MDT Jonathan M Davis via Digitalmars- d-learn wrote: > On Saturday, July 6, 2019 8:12:36 AM MDT berni via Digitalmars-d-learn > > wrote: > > Now it's getting weird. Meanwhile I encountered, that take() > > sometimes consumes and somet

Re: Is there something like a consuming take?

2019-07-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, July 6, 2019 8:12:36 AM MDT berni via Digitalmars-d-learn wrote: > Now it's getting weird. Meanwhile I encountered, that take() > sometimes consumes and sometimes not. Where can I learn, what is > the reason behind this behavior? And how can I handle this? take _always_ consumes the

Re: Why are immutable array literals heap allocated?

2019-07-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 5, 2019 10:25:10 AM MDT Nick Treleaven via Digitalmars-d- learn wrote: > On Thursday, 4 July 2019 at 11:06:36 UTC, Eugene Wissner wrote: > > static immutable arr = [1, 2]; > > > > You have to spell it out that the data is static. > > Yes, I was wondering why the compiler

Re: D on ARM laptops?

2019-07-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 4, 2019 2:49:18 AM MDT zoujiaqing via Digitalmars-d-learn wrote: > On Thursday, 4 July 2019 at 07:46:53 UTC, Paolo Invernizzi wrote: > > On Thursday, 4 July 2019 at 01:01:03 UTC, Nicholas Wilson wrote: > >> On Wednesday, 3 July 2019 at 20:49:20 UTC, JN wrote: > >>> Does anyone

Re: assert in unittest has access to private member?

2019-06-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 30, 2019 11:24:03 AM MDT Robert M. Münch via Digitalmars-d- learn wrote: > I have a case, with templates, where an assert in a unittest can access > a private memember and I don't know how this can happen. > > Before trying to creat an equivalent case, I want to cross-check, if >

Re: Illegal Filename after basic install and trying Hello World

2019-06-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 26, 2019 8:39:09 AM MDT Nicholas Wilson via Digitalmars- d-learn wrote: > On Wednesday, 26 June 2019 at 13:57:22 UTC, Gilbert Fernandes > > None do help. The option "override linker settings from sc.ini" > > it may be called dmd.conf (it is on my Mac, but the windows may > be

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 6:32:35 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > On Tuesday, 25 June 2019 at 12:04:27 UTC, Jonathan M Davis wrote: > > On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via > > > > Digitalmars-d- learn wrote: > >> struct Container > >> { > >> } > >> >

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > struct Container > { > } > > static struct Inserter > { > private Container* container; > > private this(return scope ref Container container) @trusted > { > this.container = > }

Re: return scope ref outlives the scope of the argument

2019-06-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 25, 2019 1:32:58 AM MDT Eugene Wissner via Digitalmars-d- learn wrote: > struct Container > { > } > > static struct Inserter > { > private Container* container; > > private this(return scope ref Container container) @trusted > { > this.container = > }

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 3:31:46 PM MDT KnightMare via Digitalmars-d-learn wrote: > On Friday, 21 June 2019 at 19:18:02 UTC, KnightMare wrote: > > On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: > > > > auto goodName( ... ) { > > > > pragma( inline, true ) > > return

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 5:10:03 AM MDT JN via Digitalmars-d-learn wrote: > On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote: > So, iota is > > > the name of the function, and it doesn't stand for anything. > > It's just the name of the Greek letter that was used for a > > similar

Re: What is iota function full name

2019-06-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 21, 2019 3:01:17 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys: > What is range.iota function full name iota _is_ its full name. It's named after an STL function which does basically the same with iterators in C++: https://en.cppreference.com/w/cpp/algorithm/iota

Re: DIP 1016 and const ref parameters

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 4:45:04 PM MDT XavierAP via Digitalmars-d-learn wrote: > On Wednesday, 19 June 2019 at 21:06:48 UTC, XavierAP wrote: > > Now with an rvalue returned from get, interesting, no copy. > > Still, I wonder what really happened. Again, moving between > > stacks would still

Re: DIP 1016 and const ref parameters

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 12:28:12 PM MDT XavierAP via Digitalmars-d-learn wrote: > On Wednesday, 19 June 2019 at 12:55:09 UTC, Jonathan M Davis > > wrote: > > Even in C++, using const ref is not as good a practice as it > > once was, because they added move constructors, finally making > >

Re: Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn wrote: > I would like to make sure that my modules do not interfere with d > lang. Is there any way to escape reserved words? > https://dlang.org/spec/lex.html#keywords > > > import alias; > >

Re: What is the difference between extern(C++) extern(D)

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 11:12:14 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys; > In the dmd source code, has lot of extern (C++), Why need this > and what is difference between extern(C++) extern(D), Thanks your > answer. extern(C++) is for making the name mangling match C++,

Re: DIP 1016 and const ref parameters

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 6:33:44 AM MDT XavierAP via Digitalmars-d-learn wrote: > I often use a pattern of having const ref struct parameters (as > in C++) but this doesn't work in the case of rvalues. The > workaround of defining an overload that calls its own name is > terrible. I understand

Re: Why after writeln the binaryHeap become empty?

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 18, 2019 10:27:46 PM MDT lili via Digitalmars-d-learn wrote: > On Tuesday, 18 June 2019 at 17:25:51 UTC, Johannes Loher wrote: > > The result of heapify is a BinaryHeap, which is a range. writeln > > basically prints ranges by iterating over them and printing > > each element > >

Re: What's the difference between DIP25 and DIP1000?

2019-06-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 18, 2019 8:53:31 AM MDT Emmanuelle via Digitalmars-d-learn wrote: > Hi, I've been reading about DIP25 and DIP1000 and I'm not quite > sure if I understand the difference between the two—is DIP1000 > supposed to be a rework of DIP25? And what's the difference > between `return

Re: Why after writeln the binaryHeap become empty?

2019-06-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, June 18, 2019 9:45:33 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys: > see this code > ~~~ > int[] ar = [1,2,3,4,52,34,22]; > auto h = heapify(ar); > assert(h.length() == ar.length); > writeln("h:",h); > assert(h.empty()); > ~~~ > dmd v2.086.0 run

Re: Specifying executable names in DUB

2019-06-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 17, 2019 8:13:46 PM MDT Dave via Digitalmars-d-learn wrote: > Greetings, > > This might be totally obvious, but I can't seem to figure out how > to specify an executable's name to be different for each > build types in my DUB package. For example, if my project is > named

Re: Suggest aesthetic way to Naming a module or a package with illegal lexical D lang keywords

2019-06-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 16, 2019 5:53:30 AM MDT BoQsc via Digitalmars-d-learn wrote: > On Sunday, 16 June 2019 at 11:38:27 UTC, rikki cattermole wrote: > > The style guide has an opinion about this (you don't have to > > follow it). > > > > https://dlang.org/dstyle.html#naming_keywords > > So if I follow

Re: How to "Inherit" the attributes from a given callable argument?

2019-06-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 13, 2019 3:49:04 AM MDT Jacob Carlborg via Digitalmars-d- learn wrote: > On 2019-06-12 22:42, Mek101 wrote: > > I didn't know it applied to templates other than lambdas. > > > > Thank you for your explanation. > > It applies to templates, lambdas (which basically are templates)

Re: Why any! with map! is not working here

2019-06-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 6, 2019 10:21:39 PM MDT rnd via Digitalmars-d-learn wrote: > On Thursday, 6 June 2019 at 21:32:11 UTC, Jonathan M Davis wrote: > > If any is not given a predicate, it defaults to just checking > > whether the element itself is true (requiring that the element > > be bool), which

Re: FieldNameTuple!T and std.traits.Fields!T not empty for interfaces

2019-06-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 6, 2019 2:52:42 PM MDT Steven Schveighoffer via Digitalmars-d-learn wrote: > On 6/6/19 4:49 PM, Steven Schveighoffer wrote: > > Oh wait! It's not empty, it has an empty string as a single member! > > That's definitely a bug. > > OK, not a bug, but not what I would have expected.

Re: Why any! with map! is not working here

2019-06-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 6, 2019 5:50:36 AM MDT rnd via Digitalmars-d-learn wrote: > On Thursday, 6 June 2019 at 09:49:28 UTC, Jonathan M Davis wrote: > > So, to start, the any portion should be something more like > > > > any!pred(ss); > > > > or > > > > ss.any!pred(); > > > > or > > > > ss.any!pred; >

Re: Why any! with map! is not working here

2019-06-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 6, 2019 3:01:11 AM MDT rnd via Digitalmars-d-learn wrote: > I am trying to check if any character in the string is > 127 by > following function: > > import std.algorithm.searching; > import std.algorithm.iteration; > bool isBinary(char[] ss){ >return (any!(map!(a => a >

Re: What is difference between struct and class?

2019-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 3, 2019 1:13:44 AM MDT Rnd via Digitalmars-d-learn wrote: > On Monday, 3 June 2019 at 06:01:15 UTC, Jonathan M Davis wrote: > > On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via > > > > Digitalmars-d-learn wrote: > >> On Monday, > > > > http://ddili.org/ders/d.en/index.html > > > > If

Re: What is difference between struct and class?

2019-06-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 2, 2019 9:40:43 PM MDT Rnd via Digitalmars-d-learn wrote: > On Monday, 3 June 2019 at 00:47:27 UTC, Adam D. Ruppe wrote: > > On Monday, 3 June 2019 at 00:17:08 UTC, Rnd wrote: > >> What additional features do classes offer in D? > > > > Classes support built-in runtime polymorphism

Re: 'version'-based code selection

2019-06-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 2, 2019 11:43:09 AM MDT Anonymouse via Digitalmars-d-learn wrote: > On Saturday, 1 June 2019 at 07:46:40 UTC, Jonathan M Davis wrote: > > For the most part though, you don't declare your own version > > identifiers. It sometimes makes sense, but usually, version > > identifiers

Re: hasElaborateCopyConstructor bug?

2019-06-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 2, 2019 1:29:22 PM MDT Jonathan M Davis via Digitalmars-d- learn wrote: > On Sunday, June 2, 2019 8:32:16 AM MDT Paul Backus via Digitalmars-d-learn > wrote: > > On Sunday, 2 June 2019 at 06:59:02 UTC, Jonathan M Davis wrote: > > > Almost certainly, hasEla

Re: hasElaborateCopyConstructor bug?

2019-06-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 2, 2019 8:32:16 AM MDT Paul Backus via Digitalmars-d-learn wrote: > On Sunday, 2 June 2019 at 06:59:02 UTC, Jonathan M Davis wrote: > > Almost certainly, hasElaborateCopyConstructor should be updated > > to test for both postblit constructors and copy constructors, > > since its

Re: hasElaborateCopyConstructor bug?

2019-06-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 1, 2019 5:29:08 PM MDT SrMordred via Digitalmars-d-learn wrote: > On Saturday, 1 June 2019 at 21:39:33 UTC, SImen Kjærås wrote: > > On Saturday, 1 June 2019 at 21:05:32 UTC, SrMordred wrote: > > > > hasElaborateCopyConstructor checks if the type defines a > > postblit[0]. > >

Re: How to create an overwriteable struct that is always const?

2019-06-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 1, 2019 8:23:58 PM MDT David Zhang via Digitalmars-d-learn wrote: > On Saturday, 1 June 2019 at 16:30:12 UTC, Jonathan M Davis wrote: > > If any member variable of a struct is const, then you can't > > modify that member ever, and assignment isn't possible unless > > you

Re: How to create an overwriteable struct that is always const?

2019-06-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, June 1, 2019 6:51:08 AM MDT David Zhang via Digitalmars-d-learn wrote: > Say I have a struct `S`: > > struct S { > /*const*/ char* pointer; > ... other members ... > > this(/*const*/ char* p, ... others ...) { > pointer = p; >

Re: 'version'-based code selection

2019-06-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 31, 2019 9:59:13 PM MDT Yatheendra via Digitalmars-d-learn wrote: > Hi people. > > The 'version' keyword sounds like a fantastic capability, but how > far does DMD take it (and does GDC take it equally far)? This is > not a "D Improvement Proposal", I am just asking how it is now.

Re: Is there any performance penalty for static if?

2019-05-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, May 15, 2019 4:03:39 PM MDT Ferhat Kurtulmuş via Digitalmars- d-learn wrote: > Hi, > > Maybe I already know the answer, but have to be sure about this. > I am emulating this cpp code "int val = mat.at(row, col)" > like: > > T at(T)(int row, int col){ > static if (T.stringof

Re: In what situation can new Struct() return null?

2019-05-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 10, 2019 11:54:44 AM MDT H. S. Teoh via Digitalmars-d-learn wrote: > On Fri, May 10, 2019 at 05:32:25PM +, faissaloo via Digitalmars-d- learn wrote: > > On Friday, 10 May 2019 at 12:19:29 UTC, Cym13 wrote: > > > On Friday, 10 May 2019 at 10:11:51 UTC, faissaloo wrote: > > > >

Re: Shared with synchronized

2019-03-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 3, 2019 5:07:39 PM MST r-const-dev via Digitalmars-d-learn wrote: > On Sunday, 3 March 2019 at 22:35:54 UTC, r-const-dev wrote: > > I'm trying to implement a thread safe class, guarding data > > access with synchronized and atomicOp. > > > > Inside the class I'm using non-shared

Re: Struct destructor

2019-03-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 2, 2019 4:32:53 AM MST JN via Digitalmars-d-learn wrote: > Compare this D code: > > import std.stdio; > > struct Foo > { > ~this() > { > writeln("Destroying foo"); > } > } > > void main() > { > Foo[string] foos; > > foos["bar"] = Foo(); >

Re: sort!("...") with template function?

2019-02-26 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 26, 2019 3:06:04 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Monday, 25 February 2019 at 15:26:33 UTC, Jonathan M Davis > > wrote: > > On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via > > > >> String functions can't access the local scope, and thus

Re: How to setup dub to use x86 and x64 dll's when appropriate?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 9:17:04 PM MST Michelle Long via Digitalmars-d- learn wrote: > e.g., using sdl for different versions and have it automatically > switch. > > What would be nice is if one could stick all the files for x86 in > one dir and x64 in the others and they will be used

Re: How to pass variables to string mixins?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 5:07:54 PM MST Victor Porton via Digitalmars-d- learn wrote: > I want to create a string mixin based on a supplementary variable > (name2 below): > > Let we have something like: > > mixin template X(string name) { >immutable string name2 = '_' ~ name; >

Re: sort!("...") with template function?

2019-02-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 25, 2019 5:47:47 AM MST Simen Kjærås via Digitalmars-d- learn wrote: > On Monday, 25 February 2019 at 12:37:31 UTC, Vladimirs Nordholm > > wrote: > > Hello. > > > > I wish to sort an array by calling a template function on a > > struct. In essence I want to do > > > >

Re: DMD2 vs LDC2 inliner

2019-02-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 24, 2019 7:49:36 PM MST James Blachly via Digitalmars-d- learn wrote: > Any ideas why DMD2 cannot inline this, but LDC2 has no problem doing so > -- or suggestions for what I can do to make DMD2 inline it? The unfortunate reality of the matter is that dmd's inliner is very

Re: Why is SwitchError an error and how is it unsafe to continue after catching it?

2019-02-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 24, 2019 5:42:32 AM MST Dennis via Digitalmars-d-learn wrote: > On Sunday, 24 February 2019 at 10:53:09 UTC, aliak wrote: > > But the following code is very recoverable and I don't see how > > > it's unsafe to continue executing: > There is no guarantee that a final switch

Re: How does Rebindable suppress the compiler's optimizations for immutable?

2019-02-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 15, 2019 3:06:34 AM MST Kagamin via Digitalmars-d-learn wrote: > Union is just a pretty cast, type system guarantees don't hold > for it. Well, technically, what's supposed to be the case is that when you cast, the type system guarantees still hold but it's up to the

Re: How does Rebindable suppress the compiler's optimizations for immutable?

2019-02-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, February 14, 2019 11:59:31 PM MST Stefan Koch via Digitalmars- d-learn wrote: > On Thursday, 14 February 2019 at 23:55:18 UTC, SimonN wrote: > > std.typecons.Rebindable!(immutable A) is implemented as: > > private union { > > > > immutable(A) original; > > A

Re: Should D file end with newline?

2019-02-12 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, February 12, 2019 4:45:43 AM MST Jacob Carlborg via Digitalmars- d-learn wrote: > On 2019-02-10 18:20, Jonathan M Davis wrote: > > I use (g)vim, which I would expect to show anything like trailing > > newlines. It usually shows everything, including rendering control > > characters and

Re: Query for -dip1000

2019-02-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 11, 2019 3:23:25 AM MST Seb via Digitalmars-d-learn wrote: > On Monday, 11 February 2019 at 09:29:13 UTC, Jonathan M Davis > > wrote: > > On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via > > > > Digitalmars-d- learn wrote: > >> [...] > > > > A quick grep of Phobos

Re: Query for -dip1000

2019-02-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 10, 2019 1:04:29 PM MST Per Nordlöw via Digitalmars-d- learn wrote: > Is there a way to query if the -dip1000 flag has been passed to > the compiler? I need it for enabling certain DIP-1000 escape > analysis tests only when -dip1000 has been passed. > > For instance > >

Re: dirEntries within static foreach: memory.d(827): Error: fakePureErrno cannot be interpreted at compile time, because it has no available source code

2019-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 10, 2019 5:19:02 PM MST kdevel via Digitalmars-d-learn wrote: > I am trying to get this code compiled: > > ```TemplateStore.d > module TemplateStore; > import std.path; > import std.conv; > import std.file; > > immutable string[string] template_map; > > static this () > { >

Re: Should D file end with newline?

2019-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, February 10, 2019 2:06:50 AM MST Cym13 via Digitalmars-d-learn wrote: > On Sunday, 10 February 2019 at 02:12:43 UTC, Jonathan M Davis > > wrote: > > On Saturday, February 9, 2019 2:19:27 PM MST Victor Porton via > > > > Digitalmars- d-learn wrote: > >> ISO C++ specifies that the C++

Re: Should D file end with newline?

2019-02-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, February 9, 2019 2:19:27 PM MST Victor Porton via Digitalmars- d-learn wrote: > ISO C++ specifies that the C++ file must end with a newline. > > Should D file end with newline, too? No, there is no need to end D files with a newline. I would guess that the vast majority of D files

<    1   2   3   4   5   6   7   8   9   10   >