Re: CTFE Status

2016-12-12 Thread Jacob Carlborg via Digitalmars-d
On 2016-12-13 08:21, Stefan Koch wrote: Hi Guys, I just fixed the LLVM-Backend a little. It's about 4000 times slower to start up then the interpreter. And has 1000 microseconds overhead per evaluation. If you don't want to run a raytracer at compiletime I doubt that the llvm backend is the righ

Re: Making AssertError a singleton

2016-12-12 Thread Jacob Carlborg via Digitalmars-d
On 2016-12-13 05:07, Jonathan M Davis wrote: It also could be problematic with unit tests - especially unit tests that catch AssertErrors (e.g. if someone wants to test the contracts). I also expect all unit test frameworks that are slightly more advanced then the built-in we have now would l

Re: Compiler concept

2016-12-12 Thread Jacob Carlborg via Digitalmars-d
On 2016-12-13 04:38, rikki cattermole wrote: As CTFE has proven, its do-able but we would be talking at least 6-9 months worth of work. With no way its going into upstream. Not to mention we'd need a whole host of AST nodes in druntime. So really not worth the effort. Doing something like AST

Re: CTFE Status

2016-12-12 Thread Stefan Koch via Digitalmars-d
Hi Guys, I just fixed the LLVM-Backend a little. It's about 4000 times slower to start up then the interpreter. And has 1000 microseconds overhead per evaluation. If you don't want to run a raytracer at compiletime I doubt that the llvm backend is the right one for you. That said, it's a great

Re: Making AssertError a singleton

2016-12-12 Thread Shachar Shemesh via Digitalmars-d
On 13/12/16 02:57, Andrei Alexandrescu wrote: You can catch AssertError. There's no guarantees dtors have been called during unwinding. -- Andrei That makes no sense to me, unless you only want to catch it in order to do something right before exiting anyways. Also, please note that not all

Re: Making AssertError a singleton

2016-12-12 Thread Shachar Shemesh via Digitalmars-d
On 13/12/16 06:45, Andrei Alexandrescu wrote: I agree the perfect system would fix everything - problem is we don't have it yet. The per-thread singleton is a step forward (which at some point we should probably make publicly available). Andrei If it's not going to be needed once exceptions a

Re: Making AssertError a singleton

2016-12-12 Thread Shachar Shemesh via Digitalmars-d
On 12/12/16 23:02, Andrei Alexandrescu wrote: On 12/12/2016 02:54 PM, Shachar Shemesh wrote: On 12/12/16 17:51, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - m

Re: Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/16 11:07 PM, Jonathan M Davis wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in tha

Re: Making AssertError a singleton

2016-12-12 Thread Jonathan M Davis via Digitalmars-d
On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. But of co

Re: Making AssertError a singleton

2016-12-12 Thread Jonathan M Davis via Digitalmars-d
On Monday, 12 December 2016 at 21:02:11 UTC, Andrei Alexandrescu wrote: On 12/12/2016 02:54 PM, Shachar Shemesh wrote: Now, if you'd make regular Exceptions GC free That will come too. Then why bother making Errors singletons in order to avoid the GC? The problem you're trying to fix wi

Re: Compiler concept

2016-12-12 Thread rikki cattermole via Digitalmars-d
On 13/12/2016 2:57 PM, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 01:03:54 UTC, Ignacious wrote: Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? It would be pretty hard to do with dmd because compiled code isn't designed fo

Re: Making AssertError a singleton

2016-12-12 Thread Dsby via Digitalmars-d
On Tuesday, 13 December 2016 at 03:07:56 UTC, Dsby wrote: On Monday, 12 December 2016 at 17:57:13 UTC, Adam D. Ruppe wrote: On Monday, 12 December 2016 at 16:35:22 UTC, safety0ff wrote: Wouldn't it break chained assertion errors? An Error is unrecoverable anyway, if such a case arises it can

Re: Making AssertError a singleton

2016-12-12 Thread Dsby via Digitalmars-d
On Monday, 12 December 2016 at 17:57:13 UTC, Adam D. Ruppe wrote: On Monday, 12 December 2016 at 16:35:22 UTC, safety0ff wrote: Wouldn't it break chained assertion errors? An Error is unrecoverable anyway, if such a case arises it can always just abort the program immediately. I think all e

Re: Compiler concept

2016-12-12 Thread Adam D. Ruppe via Digitalmars-d
On Tuesday, 13 December 2016 at 01:03:54 UTC, Ignacious wrote: Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? It would be pretty hard to do with dmd because compiled code isn't designed for modification, but it wouldn't be too hard

Re: Compiler performance with my ridiculous Binderoo code

2016-12-12 Thread Stefan Koch via Digitalmars-d
On Sunday, 11 December 2016 at 22:48:56 UTC, Chris Wright wrote: On Sun, 11 Dec 2016 18:08:04 +, safety0ff wrote: [...] That's one option. Here's another: Template instantiations are interned as they are constructed (or at least should be). You must construct their arguments before you

Compiler concept

2016-12-12 Thread Ignacious via Digitalmars-d
Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? Create a compiler that lets one use actual code as templates. e.g., a text block of a function can be referenced by in the code using a "dom" to modify that code similar to how we can m

Re: Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/16 4:35 PM, Brad Roberts via Digitalmars-d wrote: Of course, then you'll find the fun of all the tests (and probably code) that catch AssertError. You can catch AssertError. There's no guarantees dtors have been called during unwinding. -- Andrei

Re: CTFE Status

2016-12-12 Thread Stefan Koch via Digitalmars-d
On Sunday, 11 December 2016 at 09:13:41 UTC, Stefan Koch wrote: On Sunday, 11 December 2016 at 09:05:26 UTC, Anonymouse wrote: Would you say it has ended up being more or less (or roughly equal) work than you initially expected? And keep up the good work! I did expect a lot of work. But wi

Re: Making AssertError a singleton

2016-12-12 Thread Timon Gehr via Digitalmars-d
On 12.12.2016 22:35, Brad Roberts via Digitalmars-d wrote: On 12/12/16 12:59 PM, Andrei Alexandrescu via Digitalmars-d wrote: On 12/12/2016 11:35 AM, safety0ff wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: But of course there are many situations out there. W

Re: Making AssertError a singleton

2016-12-12 Thread Brad Roberts via Digitalmars-d
On 12/12/16 12:59 PM, Andrei Alexandrescu via Digitalmars-d wrote: On 12/12/2016 11:35 AM, safety0ff wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: But of course there are many situations out there. Wouldn't it break chained assertion errors? Once a type in

Re: Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/2016 02:54 PM, Shachar Shemesh wrote: On 12/12/16 17:51, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in that hierarchy arguably make

Re: Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/2016 12:43 PM, Guillaume Boucher wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. With that logic, why does Throwable have the field "next"? Probably on

Re: Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
On 12/12/2016 11:35 AM, safety0ff wrote: On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: But of course there are many situations out there. Wouldn't it break chained assertion errors? Once a type in Error's cone gets thrown there is no guarantee of unwinding, hence

Re: array literals and the read only segment

2016-12-12 Thread Johan Engelen via Digitalmars-d
On Monday, 12 December 2016 at 06:28:09 UTC, Shachar Shemesh wrote: DMD 2.072.1 and ldc 2.070.2 It's easy to verify. Just create a large array (1M) and check the segment sizes of the result. For LDC, it depends whether the variables are defined inside a function or not. ``` immutable ubyt

Re: Making AssertError a singleton

2016-12-12 Thread Shachar Shemesh via Digitalmars-d
On 12/12/16 17:51, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. But of course there are many situatio

Re: Making AssertError a singleton

2016-12-12 Thread Shachar Shemesh via Digitalmars-d
On 12/12/16 17:51, Andrei Alexandrescu wrote: Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. But of course there are many situatio

Re: Making AssertError a singleton

2016-12-12 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 12 December 2016 at 16:35:22 UTC, safety0ff wrote: Wouldn't it break chained assertion errors? An Error is unrecoverable anyway, if such a case arises it can always just abort the program immediately.

Re: Making AssertError a singleton

2016-12-12 Thread Guillaume Boucher via Digitalmars-d
On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. With that logic, why does Throwable have the field "next"?

Re: Making AssertError a singleton

2016-12-12 Thread safety0ff via Digitalmars-d
On Monday, 12 December 2016 at 15:51:07 UTC, Andrei Alexandrescu wrote: But of course there are many situations out there. Wouldn't it break chained assertion errors?

Making AssertError a singleton

2016-12-12 Thread Andrei Alexandrescu via Digitalmars-d
Here it is: https://github.com/dlang/druntime/pull/1710 It relieves code that uses assert from needing the GC. I think all Errors should be singletons - multiple objects in that hierarchy arguably make no sense. But of course there are many situations out there. If this breaks your code, plea

Re: Shared object with Sqlite?

2016-12-12 Thread Mike Parker via Digitalmars-d
On Monday, 12 December 2016 at 15:19:55 UTC, Benjiro wrot From my understanding, because the libdll has a shared tag, the libsqlite3.a needs to be linked as static and the rest needs to be dynamic. I found some examples using Gcc ( static & dynamic flags ) but those do not work for DMD. If

Re: Shared object with Sqlite?

2016-12-12 Thread Benjiro via Digitalmars-d
On Monday, 12 December 2016 at 14:11:49 UTC, Mike Parker wrote: So replace libsqlite3.so with the static library here. See the 3th example in the original post... /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libsqlite3.a(sqlite3.o): relocation R_X86_64_PC32 against symbol `sqlite3_strnicmp' can n

Re: Shared object with Sqlite?

2016-12-12 Thread Mike Parker via Digitalmars-d
On Monday, 12 December 2016 at 13:12:35 UTC, Benjiro wrote: A silly question that has me pounding my head for a while. I am trying to compile a shared object WITH sqlite3 included into the shared object. dmd -c dll.d -fPIC -L-ldl -L/usr/lib/x86_64-linux-gnu/libsqlite3.a dmd -oflibdll.so dll.o

Shared object with Sqlite?

2016-12-12 Thread Benjiro via Digitalmars-d
A silly question that has me pounding my head for a while. I am trying to compile a shared object WITH sqlite3 included into the shared object. dmd -c dll.d -fPIC -L-ldl -L/usr/lib/x86_64-linux-gnu/libsqlite3.a dmd -oflibdll.so dll.o -shared -defaultlib=libphobos2.so -L-rpath=/root/dlangProje

Re: Is this a bug? Initializing immutable fixed size arrays

2016-12-12 Thread Bauss via Digitalmars-d
On Monday, 12 December 2016 at 06:43:52 UTC, Shachar Shemesh wrote: The following compiles fine: immutable char[5] array = x"01 02 03 04 05"; [...] This doesn't seem like a bug: immutable ubyte[5] array = x"01 02 03 04 05"; This however does: immutable ubyte[5] array = cast(immutable ubyte

Re: array literals and the read only segment

2016-12-12 Thread Kagamin via Digitalmars-d
On Sunday, 11 December 2016 at 12:48:17 UTC, Shachar Shemesh wrote: Is this a know issue? What's the issue? That array1 is in data section? That array2 is in rodata section? Or that they are in different sections? I suppose string literal goes to rodata because all string literals go there, a

Re: From r/linux: Which language should i use/learn ?

2016-12-12 Thread eugene via Digitalmars-d
On Saturday, 10 December 2016 at 16:09:53 UTC, Basile B. wrote: And I've hit a Rust user. why did you do that?