[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 uplink.co...@googlemail.com changed: What|Removed |Added CC||uplink.co...@googlemail.com

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Tomer Filiba (weka) changed: What|Removed |Added CC||to...@weka.io --

Re: "Programming in D" is up-to-date

2017-05-28 Thread Steve via Digitalmars-d-announce
On Tuesday, 16 May 2017 at 07:52:18 UTC, Ali Çehreli wrote: On 05/16/2017 12:47 AM, Suliman wrote: Big thanks!!! Thank you all! I'm very happy that it's useful. Ali Has Amazon caught up with the new version? If so, is it just the paperback version or has the hardcover version also been

Re: What would break if class was merged with struct

2017-05-28 Thread Iain Buclaw via Digitalmars-d
On 27 May 2017 at 16:12, Ola Fosheim Grøstad via Digitalmars-d wrote: > I wonder, what would break if all the features of class was merged into > struct? > > Imagine that: > > class Something ... { ... } > > is lowered into: > > struct _class_Something ... {

[Issue 17449] [DIP1000] crash due to covariant conversion of scope delegate to delegate

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17449 Rainer Schuetze changed: What|Removed |Added Hardware|x86_64 |All

[Issue 17449] New: [DIP1000] crash due to covariant conversion of scope delegate to delegate

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17449 Issue ID: 17449 Summary: [DIP1000] crash due to covariant conversion of scope delegate to delegate Product: D Version: D2 Hardware: x86_64 OS: Windows

Re: gtkd build fail on windows with dmd 2.074.0

2017-05-28 Thread Mike Wey via Digitalmars-d-learn
On 05/28/2017 03:20 PM, Mike Wey wrote: On 05/27/2017 11:42 PM, greatsam4sure wrote: rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0. it says std.file.FileException@std\file.d(814)gtkd2.obj:The system cannot find the file specifield. I have to use dmd 2.071.0 to build it I will

Re: The dlang-tour translations need you

2017-05-28 Thread juanjux via Digitalmars-d
I will start to work on the Spanish version. On Monday, 22 May 2017 at 14:52:43 UTC, Seb wrote: Hi all, this is just a quick update from the Dlang Tour maintainers (there will be a bigger one next month when we finally get the menu and navigation UX issue addressed). For now, I want to

[Issue 17448] New: Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Issue ID: 17448 Summary: Move semantics cause memory corruption and cryptic bugs Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 --- Comment #1 from Tomer Filiba (weka) --- I understand changing this might break backwards compatibility, but something like a `pragma(dontmove);` in the struct is a must... that way it won't have compiled, and we would pass it by

Re: Bultins .reverse and .sort are likely going to be removed soon.

2017-05-28 Thread Stefan Koch via Digitalmars-d-announce
On Sunday, 28 May 2017 at 09:23:01 UTC, Ivan Kazmenko wrote: On Wednesday, 24 May 2017 at 22:56:15 UTC, Stefan Koch wrote: I just finished the PR to remove the builtin array properties .sort and .reverse. That's nice! Finally, we could get rid of the awkward reverse() or sort!() in UFCS

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Shachar Shemesh changed: What|Removed |Added CC||shac...@weka.io ---

How to call readf

2017-05-28 Thread Petras via Digitalmars-d-learn
Hi, I am learning how to use readf to read integers. I follow the example in https://dlang.org/library/std/stdio/readf.html The sample code use readf in following way readf!" %d"(a); It works when I use dmd 2.074. However, I got compile error when I switch to ldc2

[Issue 17447] ref void return should be an error

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17447 Vladimir Panteleev changed: What|Removed |Added Keywords|

Re: What would break if class was merged with struct

2017-05-28 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 28 May 2017 at 08:24:50 UTC, Iain Buclaw wrote: Strictly speaking, this already is the case. Something sth = new Something (...); all that is really doing is just: struct Something* sth = new Something (...); You just aren't exposed this in the language. Right, but since

Re: What would break if class was merged with struct

2017-05-28 Thread Iain Buclaw via Digitalmars-d
On 27 May 2017 at 20:13, Ola Fosheim Grøstad via Digitalmars-d wrote: > On Saturday, 27 May 2017 at 18:06:11 UTC, Stanislav Blinov wrote: >> >> Perhaps it wouldn't be if we were talking about new language. >> With D, such a change falls out of "some language changes,

92-139-92

2017-05-28 Thread 92-139-92 via Digitalmars-d
no ano 12471 o ano é igual a 0, manuel josé, maio, 2017.

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 --- Comment #2 from Tomer Filiba (weka) --- alternatively a move-operator is required --

Re: What would break if class was merged with struct

2017-05-28 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 28 May 2017 at 09:09:39 UTC, Iain Buclaw wrote: However, for extern(D) classes, there's actually nothing stopping a D compiler implementer from making class types more memory efficient, an optimizing compiler could decide to re-arrange class fields as: class Something {

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Eyal changed: What|Removed |Added CC||e...@weka.io --- Comment #4 from Eyal

Re: What would break if class was merged with struct

2017-05-28 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 28 May 2017 at 12:31:35 UTC, Iain Buclaw wrote: I said it all in one breath, so you could leave it up to interpretation whether they applauded the fact that there is a separation in semantics, or whether there is no multiple inheritance in D (except via interfaces). When asking

Re: What would break if class was merged with struct

2017-05-28 Thread Ola Fosheim Grøstad via Digitalmars-d
On Sunday, 28 May 2017 at 14:30:00 UTC, Ola Fosheim Grøstad wrote: Struct and class is one type in C++. The difference is in the syntax where the grammar does not allow access protection for the struct keyword. So not semantical, but syntactical. I.e. you can just search-and-replace "struct"

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Tomer Filiba (weka) changed: What|Removed |Added Keywords||industry --

[Issue 17277] Member and aggregate alignment semantics

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17277 --- Comment #1 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9180e57bdd4a6330217be5fcefc30f965b0d365b Fix alignment/size of packed aggregates (issue #17277)

Re: What would break if class was merged with struct

2017-05-28 Thread Iain Buclaw via Digitalmars-d
On 28 May 2017 at 13:30, Ola Fosheim Grøstad via Digitalmars-d wrote: > On Sunday, 28 May 2017 at 09:09:39 UTC, Iain Buclaw wrote: >> >> However, for extern(D) classes, there's actually nothing stopping a D >> compiler implementer from making class types more memory

Re: How to Get Screenshot on Windows ?

2017-05-28 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 28 May 2017 at 04:05:47 UTC, Softwarez wrote: Hi can anyone please help me how to get screenshot on Windows using D, because all the other threads are using linux to get screenshot. In the same way you'd do it in C. Here is a more convoluted D example in the form of a program I

Re: What would break if class was merged with struct

2017-05-28 Thread Iain Buclaw via Digitalmars-d
On 27 May 2017 at 20:34, Jonathan M Davis via Digitalmars-d wrote: > On Saturday, May 27, 2017 16:37:04 Ola Fosheim Grøstad via Digitalmars-d > wrote: >> > Monitor (i.e. for "synchronized") and >> >> Wasn't this going to be removed? > > There was definitely talk of

Re: gtkd build fail on windows with dmd 2.074.0

2017-05-28 Thread Mike Wey via Digitalmars-d-learn
On 05/27/2017 11:42 PM, greatsam4sure wrote: rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0. it says std.file.FileException@std\file.d(814)gtkd2.obj:The system cannot find the file specifield. I have to use dmd 2.071.0 to build it I will appreciate your help sorry for the mistake

[Issue 17445] Disagreement between 'static assert' and 'static if'

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17445 --- Comment #4 from Dario Schiavon --- Stanislav, thanks for the tip. I knew about isAssignable but I had somehow missed isCopyable, which is exactly what I needed. However, I still cannot make my code work because of the

[Issue 17445] Disagreement between 'static assert' and 'static if'

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17445 --- Comment #5 from Dario Schiavon --- I guess I can speculate about the reason for this behavior. What I'm doing, is making a copiability test on a type that hasn't been completely defined yet. As long as there's no

Re: How to call readf

2017-05-28 Thread Ali Çehreli via Digitalmars-d-learn
On 05/28/2017 07:55 AM, Petras wrote: > Hi, I am learning how to use readf to read integers. I follow the > example in https://dlang.org/library/std/stdio/readf.html > > The sample code use readf in following way > readf!" %d"(a); Providing the format string as a template argument and being

Re: Relative Aliases?

2017-05-28 Thread tsbockman via Digitalmars-d
On Sunday, 28 May 2017 at 15:04:15 UTC, Jonathan Marler wrote: I'm also looking for the ability to get an alias to the current type, i.e. struct Foo { void foo() { alias TheAliasWeWant = Foo; alias TheAliasWeWant = currentTypeAlias(); // possible? } } For types,

Built-in RAII in D

2017-05-28 Thread Nerve via Digitalmars-d
Thanks to Walter Bright's recent comments at Dconf about memory safety, and my own lamentations about the continued use of C in all contexts where memory safety is crucial by overconfident programmers who believe they can do no wrong, I've decided to propose a baked-in RAII implementation for

Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread WebFreak001 via Digitalmars-d
Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } in your API you didn't document that this will change `a` (or we will assume the user simply didn't read because you would never do something like this).

Re: How to call readf

2017-05-28 Thread Petras via Digitalmars-d-learn
On Sunday, 28 May 2017 at 15:00:30 UTC, Ali Çehreli wrote: On 05/28/2017 07:55 AM, Petras wrote: > Hi, I am learning how to use readf to read integers. I follow the > example in https://dlang.org/library/std/stdio/readf.html > > The sample code use readf in following way > readf!" %d"(a);

need to emulate scope(failure) with struct destructor

2017-05-28 Thread piotrklos via Digitalmars-d-learn
I need to perform an action, in multiple separate functions, if scope exits with an exception. The trouble is I don't want to litter my code with scope(failure) everywhere. I already create an instance of a struct at each location, with the sole purpose of doing things at the end of scope. So

Re: Safe code as an I/O requirement

2017-05-28 Thread Ola Fosheim Grostad via Digitalmars-d
On Sunday, 28 May 2017 at 16:58:53 UTC, aberba wrote: https://lwn.net/Articles/708196/ From the look of things and feedbacks from several security analysts and system developers, [exposed] I/O needs to be memory safe. GStreamer multimedia library developed in C has safety issues [see

[Semi-OT] newCTFE debugging woes

2017-05-28 Thread Stefan Koch via Digitalmars-d
Hi Guys, I just found and worked around a bug in newCTFE. The tests only showed iasm64.d failing. And iasm64.d test does not execute ctfe. On top of that I could not reproduce the failure locally. I was pretty befuddled. After two weeks of being confused: It turned out a bug in newCTFE caused

Re: Relative Aliases?

2017-05-28 Thread Jonathan Marler via Digitalmars-d
On Sunday, 28 May 2017 at 15:07:55 UTC, Timon Gehr wrote: On 28.05.2017 17:04, Jonathan Marler wrote: Is there a way to get an alias to a symbol relative to the current location? I'm looking for a general solution but I'll show an example to demonstrate one use case. Say we want to access

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 --- Comment #6 from b2.t...@gmx.com --- It looks like a bad codegen and not a @safe issue. `ulong[20] tmp;` is not corrupted if i compile and run your example with LDC2. --

Safe code as an I/O requirement

2017-05-28 Thread aberba via Digitalmars-d
https://lwn.net/Articles/708196/ From the look of things and feedbacks from several security analysts and system developers, [exposed] I/O needs to be memory safe. GStreamer multimedia library developed in C has safety issues [see article]. What would its safety be if it was written in D

Re: Built-in RAII in D

2017-05-28 Thread Stanislav Blinov via Digitalmars-d
On Sunday, 28 May 2017 at 17:34:30 UTC, Nerve wrote: --- refcounted --- The allocation method used by refcounted can be overloaded... 1. Then the deallocation has to also be overloaded. 2. This introduces tight coupling between a type and its allocator, preventing the programmer from

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Meta via Digitalmars-d
On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } in your API you didn't document that this will change `a` (or we will assume the user simply didn't

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } in your API you didn't document that this will change `a` (or we will assume the user simply didn't

Re: Built-in RAII in D

2017-05-28 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 28 May 2017 at 18:50:02 UTC, Nerve wrote: On Sunday, 28 May 2017 at 18:38:21 UTC, Moritz Maxeiner wrote: All in all, I see little to no benefit to what you propose, while requiring significant work on the language spec. Point taken. My only remaining reservation then is the

Relative Aliases?

2017-05-28 Thread Jonathan Marler via Digitalmars-d
Is there a way to get an alias to a symbol relative to the current location? I'm looking for a general solution but I'll show an example to demonstrate one use case. Say we want to access the alias to the current function symbol. Obviously we can use the name of the current function, i.e.

Re: Safe code as an I/O requirement

2017-05-28 Thread piotrklos via Digitalmars-d
On Sunday, 28 May 2017 at 16:58:53 UTC, aberba wrote: https://lwn.net/Articles/708196/ (...) Intuitively it would be much better because overwhelming majority of the code can be written with @safe, but bounds checking would have to be switched off for some plugin code for performance

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Walter Bright changed: What|Removed |Added Keywords||safe

Re: Relative Aliases?

2017-05-28 Thread Timon Gehr via Digitalmars-d
On 28.05.2017 17:04, Jonathan Marler wrote: Is there a way to get an alias to a symbol relative to the current location? I'm looking for a general solution but I'll show an example to demonstrate one use case. Say we want to access the alias to the current function symbol. ...

Re: "Programming in D" is up-to-date

2017-05-28 Thread Ali Çehreli via Digitalmars-d-announce
On 05/28/2017 06:25 AM, Steve wrote: On Tuesday, 16 May 2017 at 07:52:18 UTC, Ali Çehreli wrote: On 05/16/2017 12:47 AM, Suliman wrote: Big thanks!!! Thank you all! I'm very happy that it's useful. Ali Has Amazon caught up with the new version? If so, is it just the paperback version or

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 --- Comment #7 from Tomer Filiba (weka) --- it is obviously not a codegen issue, since i have a dangling pointer at hand. it's just a matter of how the much stack the compiler requires. in LDC i reproduce this by enlarging the tmp to

Re: Built-in RAII in D

2017-05-28 Thread Nerve via Digitalmars-d
On Sunday, 28 May 2017 at 18:38:21 UTC, Moritz Maxeiner wrote: All in all, I see little to no benefit to what you propose, while requiring significant work on the language spec. Point taken. My only remaining reservation then is the communication problem D has with the wider prospective

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread ketmar via Digitalmars-d
Meta wrote: If a parameter is marked as ref then you have to assume it will be modified by the function (unless it's const/inout/immutable). If it's marked as out then you know it will be. If you didn't know that the function takes its parameters by ref or out... You're should've RTFM. now

Re: gtkd build fail on windows with dmd 2.074.0

2017-05-28 Thread Mike Wey via Digitalmars-d-learn
On 05/28/2017 03:30 PM, Mike Wey wrote: On 05/28/2017 03:20 PM, Mike Wey wrote: On 05/27/2017 11:42 PM, greatsam4sure wrote: rdmd Build.d fail on windows with dmd 2.074.0,dmd 2.073.0. it says std.file.FileException@std\file.d(814)gtkd2.obj:The system cannot find the file specifield. I have

Re: Built-in RAII in D

2017-05-28 Thread Moritz Maxeiner via Digitalmars-d
On Sunday, 28 May 2017 at 17:34:30 UTC, Nerve wrote: Thanks to Walter Bright's recent comments at Dconf about memory safety, and my own lamentations about the continued use of C in all contexts where memory safety is crucial by overconfident programmers who believe they can do no wrong, I've

Re: need to emulate scope(failure) with struct destructor

2017-05-28 Thread Dukc via Digitalmars-d-learn
On Sunday, 28 May 2017 at 20:06:42 UTC, piotrklos wrote: I need to perform an action, in multiple separate functions, if scope exits with an exception. The trouble is I don't want to litter my code with scope(failure) everywhere. I already create an instance of a struct at each location, with

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Stanislav Blinov via Digitalmars-d
On Sunday, 28 May 2017 at 22:03:48 UTC, Stefan Koch wrote: On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } [...] Syntax wise we could force you

[Issue 17450] escaping delegate context pointer not detected for member functions

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17450 Walter Bright changed: What|Removed |Added See Also|

[Issue 17450] New: escaping delegate context pointer not detected for member functions

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17450 Issue ID: 17450 Summary: escaping delegate context pointer not detected for member functions Product: D Version: D2 Hardware: All OS: All Status: NEW

[Issue 17450] escaping delegate context pointer not detected for member functions

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17450 Walter Bright changed: What|Removed |Added Keywords||safe --

Re: purity question

2017-05-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote: > Is there a mechanism for declaring something pure when it's built from > parts which individually aren't? > > string foo(string s) > { > // do something arbitrarily complex with s that doesn't touch > globals or

Re: purity question

2017-05-28 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 29 May 2017 at 01:01:46 UTC, Stefan Koch wrote: There is void[] myPureMalloc(uint size) pure @trusted nothrow @nogc { import core.stdc.stdlib : malloc; alias pure_malloc_t = @nogc pure nothrow void* function(size_t size); return (cast(pure_malloc_t))(size)[0 .. size]; }

Input interrupt

2017-05-28 Thread helxi via Digitalmars-d-learn
Hello, I just wrote a mock-up of Unix's $cat. However unlike the actual $cat, when input interrupt (Cntrl+D) is pressed the following program does not stop. So I tried using C's EOF but the types aren't compatible since EOF is probably aliased to -1 //... if (args.length < 2) {

Re: purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote: Is there a mechanism for declaring something pure when it's built from parts which individually aren't? string foo(string s) { // do

Re: Ali's slides from his C++Now talk

2017-05-28 Thread Corey Lubin via Digitalmars-d
On Wednesday, 24 May 2017 at 00:05:54 UTC, Ali Çehreli wrote: On 05/23/2017 04:31 PM, Joakim wrote: http://ddili.org/AliCehreli_CppNow_2017_Competitive_Advantage_with_D.no_pause.pdf "Functions defined as @safe and modules compiled with -safe cannot corrupt memory." (slide 90) Is there

Re: purity question

2017-05-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 29, 2017 01:01:46 Stefan Koch via Digitalmars-d-learn wrote: > On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote: > > On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn > > > > wrote: > >> On Sunday, May 28, 2017 16:49:16 Brad Roberts via > >> > >>

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
That's what C# does. I always liked that a lot, and even argued in favor of doing the same in D (ages ago). It got shot down way back when, so unfortunately, I don't think any reversal is going to happen. Getting in the way of UFCS and generic code are fair points, although they don't stike

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/28/2017 03:06 PM, Meta wrote: If you didn't know that the function takes its parameters by ref or out... You're should've RTFM. That's the same reasoning that's been used to excuse just about every API blunder in C's infamously unsafe bug-riddled history.

Re: Ali's slides from his C++Now talk

2017-05-28 Thread Jonathan M Davis via Digitalmars-d
On Monday, May 29, 2017 01:17:46 Corey Lubin via Digitalmars-d wrote: > On Wednesday, 24 May 2017 at 00:05:54 UTC, Ali Çehreli wrote: > > On 05/23/2017 04:31 PM, Joakim wrote: > >> http://ddili.org/AliCehreli_CppNow_2017_Competitive_Advantage_with_D.no > >> _pause.pdf > "Functions defined as @safe

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Ola Fosheim Grostad via Digitalmars-d
On Monday, 29 May 2017 at 01:56:19 UTC, Nick Sabalausky (Abscissa) wrote: On 05/28/2017 03:06 PM, Meta wrote: If you didn't know that the function takes its parameters by ref or out... You're should've RTFM. That's the same reasoning that's been used to excuse just about every API blunder

Re: D Language Front-End Proposed For GCC 8, 800k Lines of Code

2017-05-28 Thread rikki cattermole via Digitalmars-d
On 28/05/2017 8:23 PM, Nordlöw wrote: Does this, perchance, deserve a post in "Announce"? :) http://www.phoronix.com/scan.php?page=news_item=D-Frontend-For-GCC Let's wait until a decision is made, then it will be all nice and official should it go in :)

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/29/2017 12:57 AM, Ola Fosheim Grostad wrote: On Monday, 29 May 2017 at 01:56:19 UTC, Nick Sabalausky (Abscissa) wrote: On 05/28/2017 03:06 PM, Meta wrote: If you didn't know that the function takes its parameters by ref or out... You're should've RTFM. That's the same reasoning

Re: Input interrupt

2017-05-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 May 2017 at 22:07:12 UTC, helxi wrote: So I tried using C's EOF but the types aren't compatible since EOF is probably aliased to -1 The readln docs for D say it returns null on end of file. The example given is: import std.stdio; void main() { string line; while

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread ketmar via Digitalmars-d
Stefan Koch wrote: Personally I stay away from ref precisely because of it's silent caller syntax. same here. i prefer to use pointers instead, 'cause they are visible at the calling site.

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Jonathan M Davis via Digitalmars-d
On Sunday, May 28, 2017 17:54:30 WebFreak001 via Digitalmars-d wrote: > I think the user should be enforced to use foo(ref input) instead > of foo(input) as it greatly increases understanding of the code > on the caller side and another advantage is that programs > analyzing the AST can better

[Issue 17450] escaping delegate context pointer not detected for member functions

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17450 --- Comment #1 from Walter Bright --- https://github.com/dlang/dmd/pull/6839 --

Re: Ali's slides from his C++Now talk

2017-05-28 Thread Corey Lubin via Digitalmars-d
On Tuesday, 23 May 2017 at 23:31:48 UTC, Joakim wrote: Enjoying going through these: http://ddili.org/AliCehreli_CppNow_2017_Competitive_Advantage_with_D.no_pause.pdf I was particularly amused by the very last slide... Clever. :)) If anyone happens to notice when the video goes up, a quick

Re: purity question

2017-05-28 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote: On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote: Is there a mechanism for declaring something pure when it's built from parts which

Re: purity question

2017-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 28 May 2017 at 23:49:16 UTC, Brad Roberts wrote: // do something arbitrarily complex with s that doesn't touch globals or change global state except possibly state of the heap or gc Sounds like the basic definition of pure to me; At least in regards to D. Memory allocation

Re: purity question

2017-05-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 28, 2017 17:53:25 Brad Roberts via Digitalmars-d-learn wrote: > On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote: > >> Is there a mechanism for declaring something pure when it's

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Stefan Koch via Digitalmars-d
On Sunday, 28 May 2017 at 22:18:01 UTC, Stanislav Blinov wrote: On Sunday, 28 May 2017 at 22:03:48 UTC, Stefan Koch wrote: On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual

Re: Input interrupt

2017-05-28 Thread helxi via Digitalmars-d-learn
On Sunday, 28 May 2017 at 22:14:46 UTC, Adam D. Ruppe wrote: On Sunday, 28 May 2017 at 22:07:12 UTC, helxi wrote: So I tried using C's EOF but the types aren't compatible since EOF is probably aliased to -1 The readln docs for D say it returns null on end of file. The example given is:

Re: CTFE Status 2

2017-05-28 Thread Stefan Koch via Digitalmars-d
On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote: [ ... ] Hi Guys, I just fixed the sliceAssignment! now overlapping assignments are correctly detected. I also re-enabled a bailout on struct-member operation which are not simple integers. Which means I chose to ignore some

purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
Is there a mechanism for declaring something pure when it's built from parts which individually aren't? string foo(string s) { // do something arbitrarily complex with s that doesn't touch globals or change global state except possibly state of the heap or gc return s; }

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Walter Bright changed: What|Removed |Added See Also|

Re: purity question

2017-05-28 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 29 May 2017 at 01:12:53 UTC, Era Scarecrow wrote: ... Hmm didn't notice the post had split. Otherwise i wouldn't have replied... That and thinking about the GC state (outside of allocating memory)...

Re: purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
On 5/28/2017 6:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, May 29, 2017 01:01:46 Stefan Koch via Digitalmars-d-learn wrote: On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote: On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May

[Issue 17442] regex purity issues

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17442 uplink.co...@googlemail.com changed: What|Removed |Added CC||uplink.co...@googlemail.com

[Issue 17442] regex purity issues

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17442 --- Comment #2 from Brad Roberts --- That's a tiny tip of a much larger iceberg. --

[Issue 17409] [ICE] Segmentation fault with invalid code and -dip1000

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17409 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 17423] @safe code seg faults

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

[Issue 17423] @safe code seg faults

2017-05-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17423 --- Comment #4 from Eyal --- dmd --version && dmd -unittest -main -run test17423.d DMD64 D Compiler v2.074.0 Copyright (c) 1999-2017 by Digital Mars written by Walter Bright

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Stefan Koch via Digitalmars-d
On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } [...] Syntax wise we could force you to say foo(). Which fits perfectly in the existing pointer

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Nicholas Wilson via Digitalmars-d
On Sunday, 28 May 2017 at 17:54:30 UTC, WebFreak001 wrote: Imagine you wrote a function void foo(ref int a) { if (std.random.uniform(0, 10) == 0) a = 0; // Actual code doing something } [...] It seems nice in theory but how will it interact with generic code? Perhaps it should be

Re: Should out/ref parameters require the caller to specify out/ref like in C#?

2017-05-28 Thread Meta via Digitalmars-d
On Sunday, 28 May 2017 at 19:10:49 UTC, ketmar wrote: Meta wrote: If a parameter is marked as ref then you have to assume it will be modified by the function (unless it's const/inout/immutable). If it's marked as out then you know it will be. If you didn't know that the function takes its

Re: purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
On 5/28/2017 6:01 PM, Stefan Koch via Digitalmars-d-learn wrote: On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote: On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote: Is there a mechanism

Re: purity question

2017-05-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 28, 2017 18:39:02 Brad Roberts via Digitalmars-d-learn wrote: > On 5/28/2017 6:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote: > > There was a whole discussion or 3 is PRs about making malloc pure, and > > IIRC, it was done and then decided that it wasn't safe to do some for

Re: purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
On 5/28/2017 6:36 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May 28, 2017 17:53:25 Brad Roberts via Digitalmars-d-learn wrote: On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, May 28, 2017 16:49:16 Brad Roberts via Digitalmars-d-learn wrote:

Re: purity question

2017-05-28 Thread Brad Roberts via Digitalmars-d-learn
On 5/28/2017 6:46 PM, Brad Roberts via Digitalmars-d-learn wrote: Here's the bug that I'm digging into today, a clear example of an api that _should_ be pure, but based on the implementation is rather difficult for the compiler to infer. https://issues.dlang.org/show_bug.cgi?id=17442

Re: purity question

2017-05-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 28, 2017 18:46:22 Brad Roberts via Digitalmars-d-learn wrote: > Again, of course it's possible to do it wrong. Escape hatches are like > that. And of course things are being worked on and improved, I'm one of > the ones that's done a good bit of that at various points in time.

  1   2   >