Re: persistence, serialization, history (run-to-run) in small self-contained program

2016-07-13 Thread rikki cattermole via Digitalmars-d-learn
On 14/07/2016 5:18 PM, dan wrote: I'm writing a small program (compiled with gdc on xubuntu 16.04). I would like it to remember a little data (a few kilobytes maybe). It looks like d comes with standard support for both sqlite3 and json --- is there any particular reason to prefer one over the

persistence, serialization, history (run-to-run) in small self-contained program

2016-07-13 Thread dan via Digitalmars-d-learn
I'm writing a small program (compiled with gdc on xubuntu 16.04). I would like it to remember a little data (a few kilobytes maybe). It looks like d comes with standard support for both sqlite3 and json --- is there any particular reason to prefer one over the other? Or maybe something else

Re: Rant after trying Rust a bit

2016-07-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Wednesday, 13 July 2016 at 21:33:39 UTC, Ola Fosheim Grøstad wrote: Then if you want to represent a set of alternate sets like a Typo: a set of alternative strings.

Re: dcompute is nearing minimal functionality

2016-07-13 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 14 July 2016 at 03:30:44 UTC, Nicholas Wilson wrote: DCompute is my effort to target CUDA and SPIR to enable hassle free native execution on the gpu. [...] and a HUGE thanks to Johan Engelen for helping me get to grips with ldc. Any and all suggestions and feedback (and PRs)

dcompute is nearing minimal functionality

2016-07-13 Thread Nicholas Wilson via Digitalmars-d
DCompute is my effort to target CUDA and SPIR to enable hassle free native execution on the gpu. It is a D library +modification of LDC and is available at https://github.com/thewilsonator/ldc/tree/dcompute The compiler is nearing minimal functionality and is able to generate code for

Re: Slice expressions - exact evaluation order, dollar

2016-07-13 Thread Michael Coulombe via Digitalmars-d
On Friday, 17 June 2016 at 19:59:09 UTC, kinke wrote: // LDC issue #1433 void main() { auto r = getBase()[getLowerBound($) .. getUpperBound($)]; assert(r == [ 2, 3 ]); } Firstly, it fails with DMD 2.071 because $ in the upper bound expression is 0, i.e., it doesn't reflect the updated

Re: C++ interface vs D and com

2016-07-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 21:27:29 UTC, Adam Sansier wrote: Yes! your right, If you were only around to tell me that in the first place! ;) Now we know. Again, as I said before, the problem is informational. Maybe because come works 99% of the time doesn't help us in the 1% if some

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread ethgeh via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 23:06:44 UTC, flamencofantasy wrote: On Wednesday, 13 July 2016 at 22:30:51 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 22:09:05 UTC, flamencofantasy wrote: On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: [...] You revived this thread

Re: Battle-plan for CTFE

2016-07-13 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 9 July 2016 at 20:09:14 UTC, Stefan Koch wrote: I decided to keep a gist updated to represent the current state the new engine can handle. https://gist.github.com/UplinkCoder/89faa06311e417aa93ea99bc92934d3e This is the currentState after approx. 50 hours of work First

Re: cant run unittests

2016-07-13 Thread ethgeh via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 19:41:53 UTC, dom wrote: how can i run my unittests for a dynamic library? some weird conflict is reported between main functions, my project doesnt contain any main function. [...] try to put this before the main of your application: "version(unittest){}

[Issue 13055] @nogc std.string.sformat

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13055 teddybear12...@gmail.com changed: What|Removed |Added CC||teddybear12...@gmail.com ---

Re: Interface final methods are erased by the overloads of a subclass

2016-07-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 14 July 2016 at 00:02:25 UTC, pineapple wrote: I was surprised when this didn't work. What's the rationale? Is there any better workaround than renaming methods? Looks like this: http://dlang.org/hijack.html Just add `alias foo = A.foo;` to B and it should work.

Interface final methods are erased by the overloads of a subclass

2016-07-13 Thread pineapple via Digitalmars-d-learn
I was surprised when this didn't work. What's the rationale? Is there any better workaround than renaming methods? interface A{ void foo(); final void foo(int x){} } class B: A{ void foo(){} } void main(){ auto b = new B(); b.foo();

Re: First dmd nightly shipping with dub

2016-07-13 Thread Seb via Digitalmars-d-announce
On Thursday, 7 July 2016 at 03:26:57 UTC, Suliman wrote: On Wednesday, 6 July 2016 at 14:53:56 UTC, Jack Stouffer wrote: On Wednesday, 6 July 2016 at 09:28:44 UTC, Martin Nowak wrote: This is the first nightly dmd build that includes dub binaries. http://nightlies.dlang.org/dmd-2016-07-06/

Re: Slice expressions - exact evaluation order, dollar

2016-07-13 Thread kinke via Digitalmars-d
On Wednesday, 13 July 2016 at 21:06:28 UTC, kinke wrote: On Monday, 27 June 2016 at 02:38:22 UTC, Timon Gehr wrote: The point is that the slice expression itself does or does not see the updates based on whether I wrap base in a lambda or not. I don't really see a necessity for the lambda to

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread flamencofantasy via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 22:30:51 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 22:09:05 UTC, flamencofantasy wrote: On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use

Re: year to date pull statistics (2016-07-09)

2016-07-13 Thread Brad Roberts via Digitalmars-d
total open: 266 created since 2016-01-01 and still open: 137 created closed delta 2016-07-10 - today 25 24 -1 2016-07-03 - 2016-07-09 75 97 22 2016-06-26 - 2016-07-02 91 89 -2 2016-06-19 - 2016-06-25 44 24-20

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 21:27:16 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 21:12:29 UTC, Adam Sansier wrote: [...] Ok, I like! [...] I like too! But I'll have to assume you are right since I have no proof. [...] Well, one could do this with malloc because one

Experimenting with templates

2016-07-13 Thread Bahman Movaqar via Digitalmars-d-learn
Following up my D practices, I've created a 'groupBy' template[1] for Stockman (my practice project). I'd like to ask you more experienced folks to please take a look at it. As this is my first template, I'd like to know if I am doing anything idiomatically/logically wrong. PS: I've also

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 22:09:05 UTC, flamencofantasy wrote: On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use functions which take parameters will fail with an access

Re: Why modules is so strongly limited?

2016-07-13 Thread imbaFireFenix via Digitalmars-d
but few dozen lines will allowed to get rid of naming hell I mean in compiler source

Re: Why modules is so strongly limited?

2016-07-13 Thread imbaFireFenix via Digitalmars-d
In this cases, the usual way is to make a package, this way: == in file MP/M1.d == module MP.M1; // some pieces of the work == in file MP/M2.d == module MP.M2; // other pieces of the work == in file MP/package.d == module MP; public import MP.M1; public import MP.M2; // public import

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread flamencofantasy via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use functions which take parameters will fail with an access violation, probably because D uses stdcall for COM methods, while these

[Issue 16278] New: [REG2.067] undefined reference when class template is instantiated only in 'is' expression

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16278 Issue ID: 16278 Summary: [REG2.067] undefined reference when class template is instantiated only in 'is' expression Product: D Version: D2 Hardware: x86_64 OS:

Re: Rant after trying Rust a bit

2016-07-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Monday, 11 July 2016 at 17:02:50 UTC, Max Samukha wrote: BTW, it happens that '+' does not always have to be commutative: https://en.wikipedia.org/wiki/Near-ring https://en.wikipedia.org/wiki/Ordinal_arithmetic#Addition Yes, although concatenations ought to be «*»... and the empty string

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:47:21 UTC, John wrote: On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net.

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 21:12:29 UTC, Adam Sansier wrote: The advantages over a simple malloc are: 1) You can change between GC allocation, malloc, mmap and other allocators by changing a single line, instead of changing every throw; Ok, I like! 2) you can use very fast allocators,

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:57:49 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 20:44:52 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 16:28:23 UTC, Lodovico Giaretta wrote: It's actually quite easy. Here's the code (untested):

Re: Why modules is so strongly limited?

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d
On Wednesday, 13 July 2016 at 20:58:02 UTC, imbaFireFenix wrote: Hello my friends! I'm new user of D language and leaarning how it works. I'm know C++ and trying Rust, GO and some else and now - D is the best language for me But I'm confused... Many coders was great work and interesting

Re: Slice expressions - exact evaluation order, dollar

2016-07-13 Thread kinke via Digitalmars-d
On Monday, 27 June 2016 at 02:38:22 UTC, Timon Gehr wrote: As far as I understand, for the first expression, code gen will generate a reference to a temporary copy of base, and for the second expression, it will generate a reference to base directly. If lwr() or upr() then update the ptr

[Issue 16277] New: Can't use atomicStore with classes or interface

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16277 Issue ID: 16277 Summary: Can't use atomicStore with classes or interface Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: blocker

Why modules is so strongly limited?

2016-07-13 Thread imbaFireFenix via Digitalmars-d
Hello my friends! I'm new user of D language and leaarning how it works. I'm know C++ and trying Rust, GO and some else and now - D is the best language for me But I'm confused... Many coders was great work and interesting features, but modules is so strongly limited!!!

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:44:52 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 16:28:23 UTC, Lodovico Giaretta wrote: It's actually quite easy. Here's the code (untested): import

Re: C++ interface vs D and com

2016-07-13 Thread John via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:28:40 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 16:28:23 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 16:13:21 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 11:39:11 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 00:57:38 UTC, Adam Sansier wrote: [...] You shall use a

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use functions which take parameters will fail with an access violation, probably because D uses stdcall for COM methods, while these ASIO COM methods need to be called with 'thiscall' convention.

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:02:50 UTC, Jesse Phillips wrote: On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote: If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is

[Issue 16188] [REG2.069] ICE on invalid code

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16188 ag0ae...@gmail.com changed: What|Removed |Added CC||m...@skoppe.eu --- Comment #4 from

[Issue 16276] terminated by signal SIGSEGV (Address boundary error)

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16276 ag0ae...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC|

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 19:22:44 UTC, Kagamin wrote: On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works fine for everyone else. For anyone else having similar problems

[Issue 16276] New: terminated by signal SIGSEGV (Address boundary error)

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16276 Issue ID: 16276 Summary: terminated by signal SIGSEGV (Address boundary error) Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major

Re: C++ interface vs D and com

2016-07-13 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote: If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is probably relatively simple though). Last thing I want to do is

cant run unittests

2016-07-13 Thread dom via Digitalmars-d-learn
how can i run my unittests for a dynamic library? some weird conflict is reported between main functions, my project doesnt contain any main function. i really love D, but problems like this make me wanna switch :/ using: dub test --arch=x86 lucy ~master: building configuration

Re: how to mark an extern function @nogc?

2016-07-13 Thread Seb via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:20:58 UTC, anonymous wrote: On Tuesday, 12 July 2016 at 14:04:55 UTC, Seb wrote: D is entirely driven by highly motivated volunteers. (this will change soon with the new D foundation) With the fundation, volunteers wont be highly motivated anymore. Fundations

Re: Where does one post a proposal for a language change?

2016-07-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:47:26 UTC, Mathias Lang wrote: On Tuesday, 12 July 2016 at 16:45:18 UTC, DLearner wrote: General/Issues/or... P.R. to this repository: https://github.com/dlang/DIPs If you aren't sure about your change, a discussion at General might help to see the current

Re: C++ interface vs D and com

2016-07-13 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 16:48:53 UTC, Adam Sansier wrote: There's a lot of misinformation on the net. Nope, it's just you. COM support in D and in general works fine for everyone else.

Re: Card on fire

2016-07-13 Thread H. S. Teoh via Digitalmars-d
On Wed, Jul 13, 2016 at 09:49:49AM +0200, Jacob Carlborg via Digitalmars-d wrote: > On 2016-07-12 21:09, H. S. Teoh via Digitalmars-d wrote: > > > I leave my PC running all the time, and there's never been a > > problem. I never reboot unless there's a power outage or the kernel > > is being

Re: exceptions vs error codes

2016-07-13 Thread Chris Wright via Digitalmars-d
On Wed, 13 Jul 2016 13:50:00 +, ketmar wrote: > https://dlang.org/library/object/throwable.html > > "In principle, one should not catch Throwable objects that are not > derived from Exception, as they represent unrecoverable runtime errors. > Certain runtime guarantees may fail to hold when

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 --- Comment #9 from Ketmar Dark --- so here is the fixed patch, and new tests: === diff --git a/src/object.d b/src/object.d index 40e2391..5ac132c 100644 --- a/src/object.d +++

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 Steven Schveighoffer changed: What|Removed |Added Assignee|nob...@puremagic.com

Re: UDAs on enum members

2016-07-13 Thread Tomer Filiba via Digitalmars-d
On Wednesday, 13 July 2016 at 12:54:19 UTC, ketmar wrote: 2OP: to create enum from string, you can use `std.conv.to`: enum E { A, B, C } E v = to!E("A"); I obviously failed to convey the purpose. I don't need a string representation of the enum member, I want to be able to attach UDAs to

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Kagamin via Digitalmars-d
On Tuesday, 12 July 2016 at 18:37:20 UTC, deadalnix wrote: The thread was about complexity in the language. My point is that the current way things are done introduce a lot of accidental complexity, which is overall undesirable. This impact negatively various aspects of the languages,

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 --- Comment #7 from Steven Schveighoffer --- Just adding a note for myself when I make the PR, the AA is and always will be an implementation pointer as the only member. I will check for null pointer in wrapper rather than the

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 --- Comment #6 from Steven Schveighoffer --- Thanks, this looks really good. I like the returning of itself, so you just put ensureAllocated on the call and it just works in all cases where you normally have an AA. When I get a

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Kagamin via Digitalmars-d
On Tuesday, 12 July 2016 at 13:13:42 UTC, John Colvin wrote: This is so, so wrong. There's a world of difference between "you have to get this right or you're in trouble" and "the compiler (and especially the optimiser) is free to assume that what you're doing never happens". I'd say the

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/13/16 8:41 AM, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 12:37:26 UTC, Miguel L wrote: I tried Appender, but for some reason garbage collector still seems to be running every few iterations. I will try to expand a little on my code because maybe there is something i am

Re: C++ interface vs D and com

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 08:34:55 UTC, John wrote: On Wednesday, 13 July 2016 at 07:31:57 UTC, Adam Sansier wrote: void** ptr = null; auto res = CoCreateInstance(_ID, cast(IUnknown)null, CLSCTX_INPROC_SERVER, _ID, cast(void**)); How are you casting your "ptr" variable

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 16:13:21 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 11:39:11 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 00:57:38 UTC, Adam Sansier wrote: [...] You shall use a static per-thread Region allocator[1] backed by Mallocator[2]. Then you

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Eugene Wissner via Digitalmars-d-learn
I'm writing currently a library, that is 100% @nogc but not nothrow, and I slowly begin to believe that I should publish it already, though it isn't ready yet. At least as example. std.experimental.allocator doesn't work nicely with @nogc. for example dispose calls destroy, that isn't @nogc. I

Re: I can has @nogc and throw Exceptions?

2016-07-13 Thread Adam Sansier via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 11:39:11 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 00:57:38 UTC, Adam Sansier wrote: [...] You shall use a static per-thread Region allocator[1] backed by Mallocator[2]. Then you just make[3] exceptions inside it and throw them. So you can

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Ola Fosheim Grøstad via Digitalmars-d
On Wednesday, 13 July 2016 at 13:52:06 UTC, Chris Wright wrote: Undefined stuff *can* make sense. I want to mutate a data structure marked immutable. It's obvious what I want to have happen, it's just not obvious what will actually happen. But the compiler is part of the abstract machine so

Re: built-in types inside of a union

2016-07-13 Thread zodd via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 14:01:25 UTC, Adam D. Ruppe wrote: Yes, your code is legal. What isn't legal is using some type that isn't there at runtime, like union A { int[] a; char[] b; } A u; u.a = [1,2]; u.b.length The compiler will let you do it, but being a union, it will

Re: DIP: Tail call optimization

2016-07-13 Thread Dietrich Daroch via Digitalmars-d-announce
On Tuesday, 12 July 2016 at 10:46:01 UTC, Dmitry Olshansky wrote: On Sunday, 10 July 2016 at 05:03:46 UTC, Dietrich Daroch wrote: Hi everyone (= I've just added a new proposal to add a new attribute to ensure TCO is applied. [...] In contrast to what many folks expect, TCO is affecting

Re: From the Blog: The DLang Vision and Improvement Process

2016-07-13 Thread Jacob Carlborg via Digitalmars-d-announce
On 2016-07-13 12:23, Mike Parker wrote: Unlike previous posts on the D Blog, I prepared this one in advance and thought I had it set to auto publish at 9:00 pm my time. So I was surprised to discover at 7:00 pm local time that the post had gone live an hour before (at 9:00 am GMT). I had

Re: DConf Videos

2016-07-13 Thread Jacob Carlborg via Digitalmars-d
On 2016-07-13 14:59, Jonathan M Davis via Digitalmars-d wrote: Well, it would certainly be nice if they were faster, but some conferences take the better part of a year to finally get their videos up. That's obviously on the slow side, but having to wait several months is quite normal for many

Re: DConf Videos

2016-07-13 Thread Jack Stouffer via Digitalmars-d
On Wednesday, 13 July 2016 at 12:59:41 UTC, Jonathan M Davis wrote: Well, it would certainly be nice if they were faster, but some conferences take the better part of a year to finally get their videos up. That's obviously on the slow side, but having to wait several months is quite normal for

Re: built-in types inside of a union

2016-07-13 Thread Ali Çehreli via Digitalmars-d-learn
On 07/13/2016 07:01 AM, Adam D. Ruppe wrote: > On Wednesday, 13 July 2016 at 12:28:57 UTC, zodd wrote: >> This code works as I expected but I'm unsure that it's correct. > > Yes, your code is legal. > > What isn't legal is using some type that isn't there at runtime, like > > union A { >

Re: built-in types inside of a union

2016-07-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:28:57 UTC, zodd wrote: This code works as I expected but I'm unsure that it's correct. Yes, your code is legal. What isn't legal is using some type that isn't there at runtime, like union A { int[] a; char[] b; } A u; u.a = [1,2]; u.b.length The

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Shachar Shemesh via Digitalmars-d
On 13/07/16 14:28, Andrei Alexandrescu wrote: Interesting distinction. We must render the latter undefined but not the former. Consider: Here's the definition I'm proposing: It is undefined behavior to cast away immutable, const or shared modifiers and reference the memory if any other part

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Chris Wright via Digitalmars-d
On Wed, 13 Jul 2016 10:25:55 +, sarn wrote: > Implementation-defined stuff is something that's not specified, but can > be presumed to do *something*. Undefined stuff is something that's > officially considered to not even make sense This comes from the C++ spec. We're following the same

Re: exceptions vs error codes

2016-07-13 Thread ketmar via Digitalmars-d
On Wednesday, 13 July 2016 at 13:46:44 UTC, Chris Wright wrote: On Wed, 13 Jul 2016 13:31:03 +, ketmar wrote: On Wednesday, 13 July 2016 at 13:13:45 UTC, Chris Wright wrote: as Error can be thrown anywhere along the way (think, for example, about RangeError in expression with

Re: exceptions vs error codes

2016-07-13 Thread Chris Wright via Digitalmars-d
On Wed, 13 Jul 2016 13:31:03 +, ketmar wrote: > On Wednesday, 13 July 2016 at 13:13:45 UTC, Chris Wright wrote: > as Error can be thrown anywhere along the way (think, for example, about > RangeError in expression with side-effects), and stack unwinding is not > guaranteed (but *may* happen,

Re: exceptions vs error codes

2016-07-13 Thread ketmar via Digitalmars-d
On Wednesday, 13 July 2016 at 13:13:45 UTC, Chris Wright wrote: as Error can be thrown anywhere along the way (think, for example, about RangeError in expression with side-effects), and stack unwinding is not guaranteed (but *may* happen, and may happen partially), the program *is* in

Re: From the Blog: The DLang Vision and Improvement Process

2016-07-13 Thread Jerry via Digitalmars-d-announce
On Wednesday, 13 July 2016 at 10:23:44 UTC, Mike Parker wrote: Unlike previous posts on the D Blog, I prepared this one in advance and thought I had it set to auto publish at 9:00 pm my time. So I was surprised to discover at 7:00 pm local time that the post had gone live an hour before (at

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 --- Comment #5 from Ketmar Dark --- oops. forgot to fix the comment. sorry. ;-) --

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 --- Comment #4 from Ketmar Dark --- another try. this time it adds `ensureAllocated()` method, which can be used like this: == void test (string[int] aa) { aa[42] = "42"; } void main ()

[Issue 16269] add `aa.ensureAllocated` method to associative array to clear and initialize it

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16269 Ketmar Dark changed: What|Removed |Added Summary|add `aa.clear!true` method |add

Re: exceptions vs error codes

2016-07-13 Thread Chris Wright via Digitalmars-d
On Sun, 10 Jul 2016 16:57:49 +, ketmar wrote: > On Sunday, 10 July 2016 at 16:47:31 UTC, Chris Wright wrote: >> You do need a try/catch in every annotated function to catch runtime >> exceptions like OutOfMemoryError. > > as a side note: it is even not guaranteed that one *can* catch Error.

[Issue 16275] New: final functions allowed

2016-07-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16275 Issue ID: 16275 Summary: final functions allowed Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread John Colvin via Digitalmars-d
On Wednesday, 13 July 2016 at 11:48:15 UTC, John Colvin wrote: On Wednesday, 13 July 2016 at 11:28:11 UTC, Andrei Alexandrescu wrote: On 7/13/16 5:19 AM, John Colvin wrote: "Casting away immutable is undefined behaviour": the following code has undefined results (note, not implementation

Re: aspects on methods?

2016-07-13 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 11:26:20 UTC, jj75607 wrote: I want to use aspect-like annotations to transform [...] Two methods spring to mind but both create new types. You can either write a function that iterates through the members of your class, generating a string mixin that selectively

Re: DConf Videos

2016-07-13 Thread Jonathan M Davis via Digitalmars-d
On Friday, July 08, 2016 21:27:16 Karabuta via Digitalmars-d wrote: > Yet still no videos. This is so not good. Well, it would certainly be nice if they were faster, but some conferences take the better part of a year to finally get their videos up. That's obviously on the slow side, but having

Re: UDAs on enum members

2016-07-13 Thread ketmar via Digitalmars-d
On Wednesday, 13 July 2016 at 12:40:50 UTC, Chris Wright wrote: Why not use a free function? 'cause OP wants enum ctor to be called like this: MyEnum.create(somedata); 2OP: to create enum from string, you can use `std.conv.to`: enum E { A, B, C } E v = to!E("A"); still not a ctor, but

Re: UDAs on enum members

2016-07-13 Thread user1234 via Digitalmars-d
On Wednesday, 13 July 2016 at 11:57:21 UTC, Tomer Filiba wrote: It would be really nice if I could put UDAs on enum members as well, e.g., enum MyEnum { @("SOM") SomeMember, @("ANO") AnotherMemberWithAVeryLongName, } I can think of many reasons why that would be desired, but the

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Andrei Alexandrescu via Digitalmars-d
On 07/13/2016 08:15 AM, ag0aep6g wrote: struct S { immutable int a; int b; } immutable(int*) f() pure { S* s = new S; return } void main() { immutable int* p1 = f(); S* ps1 = cast(S*) p1; ps1.b = 42; immutable int* p2 = f(); S* ps2 = cast(S*) p2;

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 13, 2016 11:59:18 Miguel L via Digitalmars-d-learn wrote: > I am using a temporary dynamic array inside a loop this way: > A[] a; > for() > { > a=[]; //discard array contents > ... appends thousand of elements to a > ... use a for some calculations > } > > I would like to

Re: UDAs on enum members

2016-07-13 Thread Chris Wright via Digitalmars-d
On Wed, 13 Jul 2016 11:57:21 +, Tomer Filiba wrote: > And while we're on the subject, why can't enums have methods? Why not use a free function? import std.stdio; enum Foo { bar, baz } void print(Foo f) { final switch(f) { case Foo.bar: writeln("bar"); break; case

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:37:26 UTC, Miguel L wrote: I tried Appender, but for some reason garbage collector still seems to be running every few iterations. I will try to expand a little on my code because maybe there is something i am missing: Appender!(A[]) a; void foo( out

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Miguel L via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:05:18 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote: I am using a temporary dynamic array inside a loop this way: A[] a; for() { a=[]; //discard array contents ... appends thousand of elements to a ... use a for

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Mathias Lang via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:05:12 UTC, rikki cattermole wrote: On 13/07/2016 11:59 PM, Miguel L wrote: The options would be: a=[]; a.length=0; a=null; ... any other? Can you help me please? All of those "options" do the same thing, remove all references to that data. No they don't.

built-in types inside of a union

2016-07-13 Thread zodd via Digitalmars-d-learn
Can I place a dynamic array, an associative array and a string to a union and work with all elements? They are built-in types, but actually not primitive ones (this is not allowed in C++ for example). That's why I'm in doubt. I'm trying to implement something close to variant type (with a few

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread cym13 via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:22:55 UTC, Lodovico Giaretta wrote: On Wednesday, 13 July 2016 at 12:20:07 UTC, cym13 wrote: The best option would be a.clear(). From the language specs: “Removes all remaining keys and values from an associative array. The array is not rehashed after removal,

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 12:20:07 UTC, cym13 wrote: The best option would be a.clear(). From the language specs: “Removes all remaining keys and values from an associative array. The array is not rehashed after removal, to allow for the existing storage to be reused. This will affect all

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread cym13 via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote: I am using a temporary dynamic array inside a loop this way: A[] a; for() { a=[]; //discard array contents ... appends thousand of elements to a ... use a for some calculations } I would like to know which would be the best way to

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread ag0aep6g via Digitalmars-d
On 07/13/2016 01:28 PM, Andrei Alexandrescu wrote: struct S { immutable int a; int b; } S s; immutable int* p = It may be the case that you need to get to s.b (and change it) when all you have is p, which is a pointer to s.a. This is essentially what makes AffixAllocator work. The obvious

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread ketmar via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote: The options would be: a=[]; a.length=0; a=null; ... any other? it really depends of your other code. if you don't have any slices of the array, for example, you can use `a.length = 0; a.assumeSafeAppend;` -- this will reuse the

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 11:59:18 UTC, Miguel L wrote: I am using a temporary dynamic array inside a loop this way: A[] a; for() { a=[]; //discard array contents ... appends thousand of elements to a ... use a for some calculations } I would like to know which would be the best way to

Re: Best way to clear dynamic array for reuse

2016-07-13 Thread rikki cattermole via Digitalmars-d-learn
On 13/07/2016 11:59 PM, Miguel L wrote: I am using a temporary dynamic array inside a loop this way: A[] a; for() { a=[]; //discard array contents ... appends thousand of elements to a ... use a for some calculations } I would like to know which would be the best way to clear a contents

Re: Vision for the D language - stabilizing complexity?

2016-07-13 Thread Lodovico Giaretta via Digitalmars-d
On Wednesday, 13 July 2016 at 11:48:15 UTC, John Colvin wrote: Hmm. You have to create a mutable reference to immutable data to do that (although you are casting away immutable). Let's consider this: *(p + 1) = 3; it either has to be written like this: *((cast(int*)p) + 1) = 3; or like

UDAs on enum members

2016-07-13 Thread Tomer Filiba via Digitalmars-d
It would be really nice if I could put UDAs on enum members as well, e.g., enum MyEnum { @("SOM") SomeMember, @("ANO") AnotherMemberWithAVeryLongName, } I can think of many reasons why that would be desired, but the concrete one is the following: I have an interchangeable data

  1   2   >