Operator Overloading for Enum

2021-02-08 Thread Michael Brown via Digitalmars-d-learn
Hi all, Is it possible to operator overload on enums? I'd like to do a opCmp() Kind regards, Mike

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:43:13 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:37:52 UTC, Mathias LANG wrote: On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:05:33 UTC, Michael wrote: On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling

Re: cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
On Sunday, 4 October 2020 at 17:01:44 UTC, Paul Backus wrote: On Sunday, 4 October 2020 at 16:48:24 UTC, Michael wrote: Dear all, Sorry for the potentially stupid question, but I'm a complete newbie to D. Why does compiling the following trivial code fail? import std.stdio; void main

cannot call impure function

2020-10-04 Thread Michael via Digitalmars-d-learn
):instantiated from here: formattedWrite!(LockingTextWriter, char, double) /Library/D/dmd/src/phobos/std/stdio.d(3927):instantiated from here: write!(double, char) test1.d(5):instantiated from here: writeln!double Cheers, Michael

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-04 Thread Michael Reese via Digitalmars-d-learn
On Saturday, 1 August 2020 at 23:08:38 UTC, Chad Joan wrote: Though if the compiler is allowed to split a single uint64_t into two registers, I would expect it to split struct/string into two registers as well. At least, the manual doesn't seem to explicitly mention higher-level constructs

Re: D on lm32-CPU: string argument on stack instead of register

2020-08-01 Thread Michael Reese via Digitalmars-d-learn
On Friday, 31 July 2020 at 15:13:29 UTC, Chad Joan wrote: THAT SAID, I think there are things to try and I hope we can get you what you want. If you're willing to entertain more experimentation, here are my thoughts: Thanks a lot for the suggestions and explanations. I tried them all but

D on lm32-CPU: string argument on stack instead of register

2020-07-31 Thread Michael Reese via Digitalmars-d-learn
because it need to access the ram, and it needs more stack space. My question: Is there a way I can tell the D compiler to use registers instead of stack for string arguments, or any other trick to reduce code size while maintaining an ideomatic D codestyle? Best regards Michael // ideomatic D

Unused imports

2020-01-30 Thread Michael via Digitalmars-d-learn
Is there a way to detect unused imports? It happened to me that I used imports which I did not need in the end. So, I'd like to remove them easily.

Re: readline / Gnu readline

2020-01-30 Thread Michael via Digitalmars-d-learn
On Thursday, 30 January 2020 at 13:23:17 UTC, Adam D. Ruppe wrote: On Thursday, 30 January 2020 at 06:12:32 UTC, Michael wrote: I did exactly just what you proposed. yeah i often just leave my random filenames in there, in this case rl was one of them. (if you don't put `.d` at the end

auto keyword

2020-01-30 Thread Michael via Digitalmars-d-learn
auto is surely a nice feature. Nonetheless I'd prefer to use explicit types. So when reading a code and I see the auto keyword I also have to find out what kind of type is meant. I have a line of code that looks like this: auto elements = buf.to!string.strip.split(" ").filter!(a => a != "");

Re: readline / Gnu readline

2020-01-30 Thread Michael via Digitalmars-d-learn
On Thursday, 30 January 2020 at 08:13:16 UTC, Mike Parker wrote: That means any arguments you pass on the command line after the source file name will be passed to your program. Compiler options need to go before the source file name. rdmd -L-lreadline mysource.d That works, thanks Mike

Re: readline / Gnu readline

2020-01-29 Thread Michael via Digitalmars-d-learn
On Thursday, 30 January 2020 at 06:15:54 UTC, Mike Parker wrote: Is your source file named rl.d? And are you running dmd in the source file's directory? No, I did not. Changed it now and it works with dmd. Great! Tried the same with rdmd I'm getting a linker error.

Re: readline / Gnu readline

2020-01-29 Thread Michael via Digitalmars-d-learn
On Wednesday, 29 January 2020 at 21:15:08 UTC, Adam D. Ruppe wrote: On Wednesday, 29 January 2020 at 20:01:32 UTC, Michael wrote: I am new to D. I would like to use the Gnu readline function in D. Is there a module that i can use? just define it yourself --- // this line right here is all

readline / Gnu readline

2020-01-29 Thread Michael via Digitalmars-d-learn
I am new to D. I would like to use the Gnu readline function in D. Is there a module that i can use?

Re: Run-time reflection for class inheritance

2019-12-02 Thread Michael Green via Digitalmars-d-learn
On Sunday, 1 December 2019 at 14:42:46 UTC, Adam D. Ruppe wrote: You can get the type at runtime by simply casting it... if(auto c = cast(EventSocket) event) { // is an event socket } Thanks. I guess you need to be careful about which order you do those tests so as not to cast to more

Re: Run-time reflection for class inheritance

2019-12-01 Thread Michael Green via Digitalmars-d-learn
On Sunday, 1 December 2019 at 12:26:03 UTC, Michael Green wrote: interface Event { [note to self - shouldn't make last minute checks and reverse them by hand before posting] That should of course read: class Event {

Run-time reflection for class inheritance

2019-12-01 Thread Michael Green via Digitalmars-d-learn
I don't know if this would be a sensible approach to try and get at the actual class types for objects stored in some container at runtime? I have noticed that this approach doesn't work if Event is an interface rather than a ancestor class. ``` import std.stdio; import std.string; import

What is the simplest way to download and set path variables for D compilers when using AppVeyor

2019-11-27 Thread Michael Brockus via Digitalmars-d-learn
I am wondering if you guys would know what maybe the simplest way to have D working on AppVeyor because I already have a solution for both CircleCi, Travis-Ci and wish to expand to windows. Also as tip for Meson build users Ninja is available on PyPi meaning that you can have a simple command

Re: Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Michael via Digitalmars-d-learn
On Friday, 18 January 2019 at 13:29:29 UTC, Adam D. Ruppe wrote: On Friday, 18 January 2019 at 12:27:17 UTC, Michael wrote: This, to be, looks like quite the explicit conversion, no? Yeah, I agree. But the language is silly. I just leave the type out of foreach and explicitly cast it inside

Deprecation: foreach: loop index implicitly converted from size_t to int

2019-01-18 Thread Michael via Digitalmars-d-learn
the explicit conversion, no? Does it mean I now have to use to!int(i) to convert the type of i in a foreach now? Thanks, Michael.

Re: Passing $ as a function argument

2018-10-14 Thread Michael Coulombe via Digitalmars-d
On Sunday, 14 October 2018 at 14:35:36 UTC, lngns wrote: On Sunday, 14 October 2018 at 13:18:37 UTC, lngns wrote: That would require introducing a new type Or just use int with a negative number... That's how it's done in some dynamic languages. But my point is that it should be compatible

Re: Forums intermittently going down?

2018-09-17 Thread Michael via Digitalmars-d
On Monday, 17 September 2018 at 11:51:04 UTC, Vladimir Panteleev wrote: On Monday, 17 September 2018 at 11:02:39 UTC, Michael wrote: It has been occurring for the past two weeks now, at least. When I try to load the forum (on different networks) it will often hang for a while, and when it does

Forums intermittently going down?

2018-09-17 Thread Michael via Digitalmars-d
the following message: forum.dlang.org is temporarily down for maintenance, and should be back up shortly. Apologies for the inconvenience. Is anyone else experiencing this? I thought it might just be me but it seems to be happening across browsers and on different networks. Thanks, Michael.

Re: John Regehr on "Use of Assertions"

2018-09-05 Thread Michael via Digitalmars-d
On Saturday, 1 September 2018 at 20:15:15 UTC, Walter Bright wrote: Note the "may or may not be evaluated." We've debated this here before. I'm rather pleased that John agrees with me on this. I.e. the optimizer can assume the expression is true and use that information to generate better

Re: Enum and CTFE function call

2018-08-14 Thread Michael via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 11:25:06 UTC, Jonathan M Davis wrote: On Tuesday, August 14, 2018 4:03:11 AM MDT Michael via Digitalmars-d-learn wrote: [...] CTFE is triggered when a value must be known at compile-time. So, if you have something like [...] That is much clearer now, thanks

Re: Enum and CTFE function call

2018-08-14 Thread Michael via Digitalmars-d-learn
On Tuesday, 14 August 2018 at 09:17:41 UTC, ixid wrote: On Tuesday, 14 August 2018 at 09:12:30 UTC, ixid wrote: This will not compile as it says n is not known at compile time... This does work if 'value' is changed to immutable and fun to accept it. So it still seems like a missed

Re: throwing lots of resources at a GC

2018-07-23 Thread Michael via Digitalmars-d
On Friday, 20 July 2018 at 00:46:37 UTC, John Belmonte wrote: Interesting (and way too detailed for me) tale of GC adventures in golang: https://blog.golang.org/ismmkeynote Seeing the pretty incredible reductions in additional latency was great. I would love to see some in-depth analysis of

Re: Funding code-d

2018-07-13 Thread Michael via Digitalmars-d-announce
On Friday, 13 July 2018 at 14:20:19 UTC, Mike Parker wrote: As promised in my tweet of June 30 (and to the handful of people who emailed me), the cloud of mystery surrounding the use of the money raised for code-d and its supporting tools has now been (partially) lifted! In this post, I lay

Re: UFCS confusion

2018-07-13 Thread Michael via Digitalmars-d-learn
On Friday, 13 July 2018 at 11:17:32 UTC, Radu wrote: On Friday, 13 July 2018 at 11:12:47 UTC, Michael wrote: On Friday, 13 July 2018 at 10:52:54 UTC, Radu wrote: On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote: [...] Do you try to call member functions? UFCS only works with free

Re: UFCS confusion

2018-07-13 Thread Michael via Digitalmars-d-learn
On Friday, 13 July 2018 at 10:52:54 UTC, Radu wrote: On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote: Hello, I am nesting some function calls, and I'm pretty used to making use of D's Uniform Function Call Syntax, but I'm getting an error if I try to convert this line: createSet

UFCS confusion

2018-07-13 Thread Michael via Digitalmars-d-learn
Hello, I am nesting some function calls, and I'm pretty used to making use of D's Uniform Function Call Syntax, but I'm getting an error if I try to convert this line: createSet(createVector(langSize, index)).length; which works, into this line: createVector(langSize,

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 16:24:03 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote: [...] While writing I realized that the following is even the case without the 'ref' parameter: The caller of the setter will still be able to change the content of your private data

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:57:27 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote: This is definitely to do with my use of the setter syntax, which maybe I am misunderstanding? Because if I change it to a normal function call like so: a.beliefs(Operator.create

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:37:25 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote: class Agent { private { double[int] mDict; } // Setter: copy void beliefs(ref double[int] dict) { import std.stdio : writeln; writeln

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote: On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote: [...] I'm just trying to do that now. Here is what I have in terms of code: [...] This is definitely to do with my use of the setter syntax, which maybe I am misunderstanding

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote: On 07/06/2018 07:36 AM, Michael wrote: > but not in > my case, if this is a weird edge-case with setter member functions? This is all very interesting but I'm dying to see the code. :) Can you change Timoses's code to demonstrat

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote: This works for me: auto create() { string[int] dict; dict[2] = "hello"; return dict; } void modifyNoRef(string[int] m) { writeln("Address not ref: ", ); m[0] = "modified";

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote: On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote: static auto ref consensus( ... ) `auto ref` infers the return type from the return statement [1]. So it's not necessarily returning a ref type. However, I don't think this matters

Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
Hello, I'm a little confused about what is actually happening when I try to pass a reference, returned by a method that produces the object (associative array), to a setter method which expects a reference. What seems to be happening is that it simply does nothing, as if the setter method is

Re: Is it possible to set up DConf Asia?

2018-06-29 Thread Michael via Digitalmars-d
On Friday, 29 June 2018 at 10:12:28 UTC, Mike Parker wrote: I can tell you that DConf Asia is something the Foundation is interested in. It's also something I plan to work toward making happen eventually. We discussed this at our Seoul meetup recently. What I need to know before anything can

Function in a slice instead of just pointer?

2018-06-21 Thread Michael Brown via Digitalmars-d-learn
Hi D Community, Is it possible to get a slice of a function, rather than just its start pointer? I'm interested in currying a function at runtime - So I would need to copy a function block (Either the original function, a wrapper function, or copys of manually altered functions).

Re: ldc flags for beginner

2018-04-22 Thread Michael via Digitalmars-d-learn
On Sunday, 22 April 2018 at 02:08:40 UTC, fevasu wrote: what flags to use so that the intermediate .o files are discared by ldc and only a.out is written to disk You can also use rdmd with ldc, if that makes things easier.

Should "a is b" compile if a and b have unrelated classes?

2018-04-10 Thread Michael Coulombe via Digitalmars-d-learn
I had a bug in my code that was messing me up for a while, and it boiled down to an identity check between two Object references with unrelated static types, like below: class A {} class B {} void main() { A a = new A; B b = new B; if (a is b) {} // compiles } I was surprised that

Re: How to delete element from array container or dlist?

2018-03-18 Thread Michael via Digitalmars-d-learn
On Sunday, 18 March 2018 at 15:42:18 UTC, Andrey Kabylin wrote: On Sunday, 18 March 2018 at 15:32:47 UTC, Michael wrote: On Sunday, 18 March 2018 at 14:58:52 UTC, Andrey Kabylin wrote: In DList we have method remove, but I can't understand how this method works, I want write somethink like

Re: How to delete element from array container or dlist?

2018-03-18 Thread Michael via Digitalmars-d-learn
On Sunday, 18 March 2018 at 14:58:52 UTC, Andrey Kabylin wrote: In DList we have method remove, but I can't understand how this method works, I want write somethink like this: void unsubscribe(EventsSubscriber subscriber) { subscribers.remove(subscriber); } The remove function seems to

Re: How to delete element from array container or dlist?

2018-03-18 Thread Michael via Digitalmars-d-learn
On Sunday, 18 March 2018 at 14:58:52 UTC, Andrey Kabylin wrote: In DList we have method remove, but I can't understand how this method works, I want write somethink like this: void unsubscribe(EventsSubscriber subscriber) { subscribers.remove(subscriber); } So I guess you would want

Re: A betterC base

2018-02-08 Thread Michael via Digitalmars-d
On Thursday, 8 February 2018 at 14:54:19 UTC, Adam D. Ruppe wrote: On Thursday, 8 February 2018 at 11:06:15 UTC, ixid wrote: It feels like D has not overcome at least two major issues in the public mind, the built-in GC D is a pragmatic language aimed toward writing fast code, fast. Garbage

Re: #dbugfix Issue 16189

2018-02-07 Thread Michael via Digitalmars-d
On Wednesday, 7 February 2018 at 08:51:01 UTC, Kirr wrote: https://issues.dlang.org/show_bug.cgi?id=16189 This is a P1 critical DMD bug, silently generating wrong code. Reported one and a half year ago, but exists in DMD compilers going back to DMD 2.050 (possibly more, but this is as far

Re: My choice to pick Go over D ( and Rust ), mostly non-technical

2018-02-05 Thread Michael via Digitalmars-d
On Saturday, 3 February 2018 at 01:52:04 UTC, psychoticRabbit wrote: On Friday, 2 February 2018 at 15:06:35 UTC, Benny wrote: [...] I think that point hits the cause of your problem with D (along with your need to 'choose' something over 'something' else). [...] I think it is worth

Re: Quora: Why hasn't D started to replace C++?

2018-01-31 Thread Michael via Digitalmars-d
On Wednesday, 31 January 2018 at 07:56:37 UTC, Andrew Benton wrote: On Tuesday, 30 January 2018 at 20:45:44 UTC, Andrei Alexandrescu wrote: https://www.quora.com/Why-hasnt-D-started-to-replace-C++ Andrei I think that the largest issue there is probably the marketing and advocacy. When Rust

Re: Should negating an unsigned integral be an error?

2018-01-30 Thread Michael via Digitalmars-d
On Tuesday, 30 January 2018 at 14:08:41 UTC, bauss wrote: On Tuesday, 30 January 2018 at 11:09:08 UTC, Michael wrote: On Monday, 29 January 2018 at 10:06:41 UTC, Jonathan M Davis wrote: On Monday, January 29, 2018 09:58:00 Dave Jones via Digitalmars-d wrote: Given uint i = 12345; should

Re: Should negating an unsigned integral be an error?

2018-01-30 Thread Michael via Digitalmars-d
On Monday, 29 January 2018 at 10:06:41 UTC, Jonathan M Davis wrote: On Monday, January 29, 2018 09:58:00 Dave Jones via Digitalmars-d wrote: Given uint i = 12345; should writeln(-i) be an error? or maybe i should be automatically cast to a larger signed type? It arguably should be, but

Re: How programmers transition between languages

2018-01-29 Thread Michael via Digitalmars-d
On Monday, 29 January 2018 at 03:22:54 UTC, Ola Fosheim Grøstad wrote: On Sunday, 28 January 2018 at 23:09:00 UTC, Michael wrote: by the whole target audience. Rust, on the other hand, seems to be picking up those who have left Go. I guess some go to Rust after working with Go

Re: How programmers transition between languages

2018-01-28 Thread Michael via Digitalmars-d
On Sunday, 28 January 2018 at 15:36:17 UTC, bachmeier wrote: On Sunday, 28 January 2018 at 13:50:03 UTC, Michael wrote: Most people at my university, outside of the computer science department, that are using languages like Python and R and MATLAB the most, are very aware of Rust and Go

Re: How programmers transition between languages

2018-01-28 Thread Michael via Digitalmars-d
On Sunday, 28 January 2018 at 13:50:03 UTC, Michael wrote: On Friday, 26 January 2018 at 09:02:03 UTC, Ola Fosheim Grøstad wrote: [...] I find it fascinating that C# is in the "languages to avoid" section, because from my perspective it's receiving more and more adoption as

Re: How programmers transition between languages

2018-01-28 Thread Michael via Digitalmars-d
On Friday, 26 January 2018 at 09:02:03 UTC, Ola Fosheim Grøstad wrote: While this analysis of language popularity on Github is enlightening: http://www.benfrederickson.com/ranking-programming-languages-by-github-users/ I found the older analysis of how programmers transition (or adopt new

Re: The name "Phobos" in user-facing docs

2018-01-12 Thread Michael via Digitalmars-d
On Friday, 12 January 2018 at 22:26:38 UTC, Michael wrote: On Friday, 12 January 2018 at 21:24:40 UTC, John Gabriele wrote: [...] I mean, you're correct to say it's an artifact of D being an old language. Tango was the original, and Phobos was introduced for D2 as a competing library. I

Re: The name "Phobos" in user-facing docs

2018-01-12 Thread Michael via Digitalmars-d
On Friday, 12 January 2018 at 21:24:40 UTC, John Gabriele wrote: After having started learning some D lately, two things about the standard library have struck me: 1. It has its own name. Phobos. This is unusual. I don't know of any other language who's std lib has any name other than "the

Re: I want to transmit the class name and the member name in the method

2018-01-05 Thread Michael via Digitalmars-d-learn
On Friday, 5 January 2018 at 12:19:11 UTC, thedeemon wrote: On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: I think code style like: db.select(User).where(email.like("*@hotmail.com")).limit(10); You need to read about templates in D, here's a good guide:

Re: Alias example should supposedly be illegal, but runs fine

2017-12-19 Thread Michael via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 02:12:29 UTC, Mike Franklin wrote: On Tuesday, 19 December 2017 at 02:04:34 UTC, codephantom wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why you would say that is a bug. I meant that the example is

Re: Alias example should supposedly be illegal, but runs fine

2017-12-19 Thread Michael via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 01:29:04 UTC, Meta wrote: On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: [...] I think the reason that this works is because i is static, meaning that you don't need the `this` reference of S to access it and thus it can be aliased. Declaring

Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread Michael via Digitalmars-d-learn
Hello, I have been looking at the following example found right at the end of the section here: https://dlang.org/spec/declaration.html#alias struct S { static int i; } S s; alias a = s.i; // illegal, s.i is an expression alias b = S.i; // ok b = 4; // sets S.i to 4 and it runs

Re: Is there a pragma or command line option to ask DMD to show a warning when it implicitly casts from long to ulong ?

2017-12-15 Thread Michael via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:29:10 UTC, Jonathan M Davis wrote: On Friday, December 15, 2017 20:40:10 Ecstatic Coder via Digitalmars-d-learn wrote: It's taken me some time to find an implicit cast bug ("if (my_sometimes_negative_index >= this_array.length)"), while a simple C++-like

Re: d-apt update

2017-12-08 Thread Michael via Digitalmars-d-announce
On Friday, 8 December 2017 at 15:53:24 UTC, Jordi Sayol wrote: d-apt release dmd v2.077.1 In this release, d-apt splits "dmd-bin" deb package into "dmd-compiler" (the command line compiler) and "dmd-tools" (includes: dumpobj, obj2asm, rdmd, ddemangle and

Re: Thoughts about D

2017-12-03 Thread Michael V. Franklin via Digitalmars-d
On Monday, 4 December 2017 at 01:01:47 UTC, Michael V. Franklin wrote: .$> dmd -defaultlib= -debuglib= -conf= main.d -of=main /usr/bin/ld: main.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link fai

Re: Thoughts about D

2017-12-03 Thread Michael V. Franklin via Digitalmars-d
On Monday, 4 December 2017 at 00:25:53 UTC, Michael V. Franklin wrote: A better solution would be to do what Iain said: Try compiling a simple "hello world" with an empty object.d file. Then inspect what the compiler does. Does it error and exit, or does it ICE? What c

Re: Thoughts about D

2017-12-03 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 3 December 2017 at 23:34:13 UTC, Walter Bright wrote: If -betterC motivates people to come up with better solutions, I'm all for it. A better solution would be to do what Iain said: Try compiling a simple "hello world" with an empty object.d file. Then inspect what the compiler

Re: Thoughts about D

2017-12-03 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 3 December 2017 at 12:20:14 UTC, Walter Bright wrote: It may indeed work to use a special druntime. My expectation, however, is that it's a lot more work trying to develop and support another runtime library, and a lot more work for the user trying to get that library worked into

Re: Release D v2.077.1

2017-11-30 Thread Michael via Digitalmars-d-announce
On Thursday, 30 November 2017 at 13:52:00 UTC, Martin Nowak wrote: Glad to announce D v2.077.1. http://dlang.org/download.html This point release fixes a few issues over v2.077.1, see the changelog for more details. http://dlang.org/changelog/v2.077.1.html - -Martin Thanks for all your

Re: Thoughts about D

2017-11-29 Thread Michael V. Franklin via Digitalmars-d
On Wednesday, 29 November 2017 at 16:57:36 UTC, H. S. Teoh wrote: Doesn't this mean that we should rather focus our efforts on improving druntime instead of throwing out the baby with the bathwater with BetterC? Exactly! We should be making a better D, not a better C. Mike

Re: Shared and race conditions

2017-11-29 Thread Michael via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 17:03:42 UTC, Steven Schveighoffer wrote: On 11/29/17 11:13 AM, Wanderer wrote: I'm trying to simulate a race condition in D with the following code: (https://run.dlang.io/is/RfOX0I) One word of caution, I think the running of your code on run.dlang.io is

Re: Shared and race conditions

2017-11-29 Thread Michael via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 16:33:50 UTC, Steven Schveighoffer wrote: On 11/29/17 11:13 AM, Wanderer wrote: [...] [snip] [...] Using the compiler switch -vcg-ast, I see no synchronization of these methods. [...] Any idea what has changed in DMD-nightly to retain the correct

Re: Shared and race conditions

2017-11-29 Thread Michael via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 16:19:05 UTC, Michael wrote: On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote: [...] I unfortunately cannot answer your question but I am noticing that running the code with DMD gives you an unordered sequence of IDs, but running with DMD

Re: Shared and race conditions

2017-11-29 Thread Michael via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote: I'm trying to simulate a race condition in D with the following code: (https://run.dlang.io/is/RfOX0I) ``` import std.stdio; import core.thread; import std.concurrency; shared struct IdGen(T) { T id; this(T start) {

Re: Attributes on Enum Members: Call for use cases.

2017-11-29 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 19:38:44 UTC, Meta wrote: I'd be interested in working on a DIP like this Michael, but I also want to expand the scope to allowing UDAs on function arguments as well. We should have some solid use cases in mind; let's take this to private email. I'm on IRC

Re: Floating point types default to NaN?

2017-11-28 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 29 November 2017 at 01:24:21 UTC, A Guy With a Question wrote: I was just more curious of the design decisions that were made. So am I. I'm trying to get to the heart of in the the PR comments. Mike

Re: UDAs on Enum Members: Does it require a DIP?

2017-11-28 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 01:49:19 UTC, Jonathan M Davis wrote: There is a definite difference between posting stuff in the newsgroup to get attention brought to something and posting in the newsgroup to get an official answer on something from Walter or Andrei. My question was on

Re: Floating point types default to NaN?

2017-11-28 Thread Michael V. Franklin via Digitalmars-d-learn
On Monday, 27 November 2017 at 23:05:55 UTC, Michael V. Franklin wrote: I think I'm going to implement a feature gate to require explicit initialization. It would be better to be strict up front and relax it as flow control analysis becomes more mature. Well, I implemented it (https

Re: First Impressions!

2017-11-28 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 19:34:27 UTC, A Guy With an Opinion wrote: I take it adding those inverse attributes is no trivial thing? It would require a DIP: https://github.com/dlang/DIPs This DIP is related (https://github.com/dlang/DIPs/blob/master/DIPs/DIP1012.md) but I don't know

Re: First Impressions!

2017-11-27 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 04:48:57 UTC, A Guy With an Opinion wrote: I'd be happy to submit an issue, but I'm not quite sure I'd be the best to determine an error message (at least not this early). Mainly because I have no clue what it was yelling at me about. I only new to add static

Re: First Impressions!

2017-11-27 Thread Michael V. Franklin via Digitalmars-d
On Tuesday, 28 November 2017 at 03:01:33 UTC, A Guy With an Opinion wrote: + D code so far is pushing me towards more "flat" code (for a lack of a better way to phrase it) and so far that has helped tremendously when it comes to readability. C# kind is the opposite. With it's namespace ->

Attributes on Enum Members: Call for use cases.

2017-11-27 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 19 November 2017 at 13:35:13 UTC, Michael V. Franklin wrote: What's the official word? Does it require a DIP? For those who might want to know, Walter has informed me that this change will require a DIP. I already have two DIPs in the queue right now, so I wouldn't mind

Re: Floating point types default to NaN?

2017-11-27 Thread Michael V. Franklin via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:13:43 UTC, Adam D. Ruppe wrote: It technically did: https://dlang.org/spec/function.html#local-variables "It is an error to use a local variable without first assigning it a value. The implementation may not always be able to detect these cases. Other

Re: UDAs on Enum Members: Does it require a DIP?

2017-11-27 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 19 November 2017 at 13:35:13 UTC, Michael V. Franklin wrote: Apparently user-defined attributes are not permitted on enum members. Issue is documented here: https://issues.dlang.org/show_bug.cgi?id=9701 Pull request implementing the feature is here: https://github.com/dlang/dmd

Re: Thoughts about D

2017-11-26 Thread Michael V. Franklin via Digitalmars-d
On Monday, 27 November 2017 at 00:14:40 UTC, IM wrote: - D is unnecessarily a huge language. I remember in DConf 2014, Scott Meyers gave a talk about the last thing D needs, which is a guy like him writing a lot of books covering the many subtleties of the language. However, it seems that the

Re: DMD test suite assertion failure in test_cdvecfill.d

2017-11-25 Thread Michael V. Franklin via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:04:50 UTC, Petar Kirov [ZombineDev] wrote: File a bug report and try contacting Martin Nowak, as he's the author of this test, IIRC. https://issues.dlang.org/show_bug.cgi?id=18013

A few DMD PRs needing attention. They are easy reviews.

2017-11-25 Thread Michael V. Franklin via Digitalmars-d
Fix compiler preferring `body` to `do` https://github.com/dlang/dmd/pull/7347 Fix issue 6400 - Better interaction between with() and opDispatch (Part 2) https://github.com/dlang/dmd/pull/7356 Fix Issue 15094 - __traits(getMember) fails when the source is a struct/class field

Re: betterC and noboundscheck

2017-11-24 Thread Michael V. Franklin via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 15:10:40 UTC, Oleg B wrote: import core.stdc.stdio; import std.algorithm : min; extern (C) void main() { char[256] buf; buf[] = '\0'; auto str = "hello world"; auto ln = min(buf.length, str.length); buf[0..ln] = str[0..ln];

Re: reduce condition nesting

2017-11-23 Thread Michael via Digitalmars-d-learn
On Thursday, 23 November 2017 at 14:16:25 UTC, Andrea Fontana wrote: On Thursday, 23 November 2017 at 13:47:37 UTC, Adam D. Ruppe wrote: On Thursday, 23 November 2017 at 05:19:27 UTC, Andrey wrote: for instance in kotlin it can be replace with this: when { c1 -> foo(), c2 -> bar(),

Re: Can I count the of enum's fields at compile time?

2017-11-22 Thread Michael V. Franklin via Digitalmars-d-learn
On Thursday, 23 November 2017 at 00:58:21 UTC, Marc wrote: for example: enum A { a = -10, b = -11, c = -12, d = -13, e = -34} enum int countOfA = coutOfFields(A); // 5 fields https://dlang.org/spec/traits.html#allMembers enum A { a = -10, b = -11, c = -12, d = -13, e = -34} enum int

DMD test suite assertion failure in test_cdvecfill.d

2017-11-20 Thread Michael V. Franklin via Digitalmars-d-learn
I'm getting this error when I try to run the DMD test suite. cd dmd make -C test -f Makefile ... runnable/test_cdvecfill.d -O (-mcpu=avx -mcpu=avx2) Test failed. The logged output: ../src/dmd -conf= -m64 -Irunnable -O -odtest_results/runnable -oftest_results/runnable/test_cdvecfill_0

Re: [OT] D merch

2017-11-19 Thread Michael V. Franklin via Digitalmars-d
On Monday, 20 November 2017 at 05:16:22 UTC, Walter Bright wrote: Anyone know how to get the .svg file from this? My attempts have failed :-( I took this out of the page source. https://web.archive.org/web/20050213192555if_/http://w148.de:80/~mmartin/d/dlogo.svg Mike

Re: UDAs on Enum Members: Does it require a DIP?

2017-11-19 Thread Michael V. Franklin via Digitalmars-d
On Sunday, 19 November 2017 at 15:57:58 UTC, Jonathan M Davis wrote: It isn't specific to UDAs. You can't put _any_ attributes on enums - including something like deprecated (though to be fair, not many attributes would make sense on an enum member).

UDAs on Enum Members: Does it require a DIP?

2017-11-19 Thread Michael V. Franklin via Digitalmars-d
Apparently user-defined attributes are not permitted on enum members. Issue is documented here: https://issues.dlang.org/show_bug.cgi?id=9701 Pull request implementing the feature is here: https://github.com/dlang/dmd/pull/6161 The pull request seems to have stalled over how to get the

Question about deprecation process

2017-11-18 Thread Michael V. Franklin via Digitalmars-d
I've resurrected a PR that fixes an implementation bug. https://github.com/dlang/dmd/pull/7332 The existing implementation does not comply with the spec. The PR fixes that, but it may cause breakage, so in the original PR, there was a preference to have it go through the deprecation

DMD PR management hits a new low

2017-11-17 Thread Michael V. Franklin via Digitalmars-d
I'll just refer you to this comment: https://github.com/dlang/dmd/pull/6947#issuecomment-345423103 Manually merging this pull as it sat around long enough waiting to be marked approved that it accumulated github's max 1000 status updates per commit id and won't ever see more until a new

Re: Enumerating unittests

2017-11-17 Thread Michael V. Franklin via Digitalmars-d
On Friday, 17 November 2017 at 08:12:13 UTC, Shachar Shemesh wrote: Is there a way to enumerate all the unittests in a specific module? Try this: https://dlang.org/spec/traits.html#getUnitTests Mike

Re: writeln, alias this and dynamic arrays.

2017-11-16 Thread Michael V. Franklin via Digitalmars-d-learn
On Friday, 17 November 2017 at 02:13:54 UTC, matthewh wrote: [...] as is it produces: [1, 2, 3, 4, 5, 6, 7, 8] [] I expected it to produce: [1, 2, 3, 4, 5, 6, 7, 8] [1, 2, 3, 4, 5, 6, 7, 8] And with the toString override included it does. Why does the version without the toString override

  1   2   3   4   5   6   7   >