Re: now it's possible! printing floating point numbers at compile-time

2018-12-30 Thread Stefan Koch via Digitalmars-d-announce
Hi Ketmar, thanks for sharing your work! On Friday, 28 December 2018 at 19:03:02 UTC, ketmar wrote: Stefan Koch wrote: [ ... ] [1] https://github.com/UplinkCoder/fpconv/blob/master/src/fpconv_ctfe.d of course, it is not all that fancy, but i ported STB converter quite a long time ago, and

Re: now it's possible! printing floating point numbers at compile-time

2018-12-22 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 22 December 2018 at 21:06:48 UTC, Basile B. wrote: On Saturday, 22 December 2018 at 20:24:46 UTC, Stefan Koch wrote: On Saturday, 22 December 2018 at 20:08:12 UTC, Stefan Koch wrote: Thus enabling you to convert doubles into strings at compiletime. Cool, CTFE formating is

Re: now it's possible! printing floating point numbers at compile-time

2018-12-22 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 22 December 2018 at 20:08:12 UTC, Stefan Koch wrote: Thus enabling you to convert doubles into strings at compiletime. Aww I am dumb ... should have waited 2 days :) Anyhow I hope that this is helpful to some of you. Please note that grisu 2 will give you representation

now it's possible! printing floating point numbers at compile-time

2018-12-22 Thread Stefan Koch via Digitalmars-d-announce
Hi Guys, during my research on floating point numbers I came across a short and efficient implementation[0] of the grisu2 algorithm for converting floating point numbers into strings. Which I then ported into CTFEable D code. Thus enabling you to convert doubles into strings at compiletime.

Re: Checking if CTFE is used?

2018-12-18 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote: Is there a way to check if a function is indeed executed at compile time or not? (Other than going through the whole executable binaries...) I tried static this() { if (__ctfe) pragma(msg,"works"); // some other stuff } but

Re: Fuzzed - a program to find DMDFE parser crash

2018-12-17 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 17 December 2018 at 10:12:44 UTC, Stefan Koch wrote: On Sunday, 16 December 2018 at 14:24:54 UTC, Jacob Carlborg wrote: On 2018-12-15 16:37, Basile B. wrote: This poisoning kills the interest of using a fuzzer. 99% of the crashes will be in hdrgen. Does that matter as long as the

Re: Fuzzed - a program to find DMDFE parser crash

2018-12-17 Thread Stefan Koch via Digitalmars-d-announce
On Sunday, 16 December 2018 at 14:24:54 UTC, Jacob Carlborg wrote: On 2018-12-15 16:37, Basile B. wrote: This poisoning kills the interest of using a fuzzer. 99% of the crashes will be in hdrgen. Does that matter as long as the bug is found? Well it's hard to tell if it's begin. Generally

Re: D is supposed to compile fast.

2018-11-26 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote: Any time I see people mention the benefits of D, I see "compile times" "compile times" "compile times" over and over. I'm using very modest amounts of templates, for a fairly small sized program (very early work toward a game),

Re: D is supposed to compile fast.

2018-11-23 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote: Any time I see people mention the benefits of D, I see "compile times" "compile times" "compile times" over and over. [...] If you can share the code privately I can use my custom profiling build of dmd to analyze the problem.

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 November 2018 at 15:38:18 UTC, Per Nordlöw wrote: The natural way forward for D is to add static analysis in the compiler that tracks use of possibly uninitialized classes (and perhaps also pointers). This has been discussed many times on the forums. The important thing with

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-11-21 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 10:47:35 UTC, NoMoreBugs wrote: On Monday, 19 November 2018 at 21:39:22 UTC, Adam D. Ruppe wrote: On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez Hermoso wrote: What's the reasoning for allowing this? The mistake is immediately obvious when you

Re: D compilation is too slow and I am forking the compiler

2018-11-21 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 21 November 2018 at 13:05:27 UTC, Nicholas Wilson wrote: On Wednesday, 21 November 2018 at 11:58:25 UTC, Vladimir Panteleev wrote: Have we tried disabling -unittest for modules that aren't on the compiler's command line yet (or, in case of -i, not excluded)? Not that I know of,

Re: how do I activate contracts for phobos functions in dmd

2018-11-02 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 2 November 2018 at 14:10:35 UTC, Richard Palme wrote: My guess is that I have to build phobos with: $make -f posix.mak BUILD=debug but then what do I do next? I'm using Linux and I built dmd+phobos manually by following this guide: https://wiki.dlang.org/Building_under_Posix

Re: CT BitArray

2018-10-31 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo wrote: Currently, BitArray is not usable at compile time, so you cannot do ``` enum e = BitArray([1, 1, 1, 0]); ``` This gives /dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(1190): Error: `bts` cannot be interpreted at

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 22:56:26 UTC, H. S. Teoh wrote: On Wed, Oct 17, 2018 at 10:13:37PM +, Stefan Koch via Digitalmars-d wrote: On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: [...] > But nobody will be building a fusion engine out of race > conditions a

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:55:48 UTC, H. S. Teoh wrote: Nah, that's not even anywhere close to nuclear fusion. The atoms which make up your body (and basically everything else) are mostly empty, with just a tiny speck of a nucleus, and a bunch of extremely tiny electrons zipping

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:40:35 UTC, Stanislav Blinov wrote: Now, I perfectly understand what Manu wants: for `shared` to stop being a stupid keyword that nobody uses, and start bringing in value to the language. At the moment, the compiler happily allows you to write and read

Re: Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
On Wednesday, 17 October 2018 at 21:12:49 UTC, Stefan Koch wrote: [another person] cannot actually occupy the same space. It is physically impossible. Actually, that's not quite true, If they were to try hard enough the result would be nuclear fusion, (I am guessing (I am not a phsysist)),

Shared - Another Thread

2018-10-17 Thread Stefan Koch via Digitalmars-d
Hi, reading the other shared thread "shared - i need to be useful"(https://forum.dlang.org/thread/mailman.4299.1539629222.29801.digitalmar...@puremagic.com) let me to an important realisation concerning the reason shareding data across threads is so unintuitve and hard to get right. The

Re: Thread-safe attribution

2018-10-08 Thread Stefan Koch via Digitalmars-d
On Sunday, 7 October 2018 at 02:59:12 UTC, Manu wrote: On Sat, Oct 6, 2018 at 7:40 PM Nicholas Wilson via Digitalmars-d wrote: [...] One thing that occurred to me is that _objects_ are shared, whereas _functions/methods_ (and their parameters) are thread safe . Theadsafe is kind of like

Re: Yet another binding generator (WIP)

2018-10-01 Thread Stefan Koch via Digitalmars-d
On Monday, 1 October 2018 at 13:51:10 UTC, evilrat wrote: Hi, Early access program is now live! Limited offer! Preorder until 12.31.2017 BC and you will receive* unique pet - "Cute Space Hamster"! !! *(Limited quantity in stock) [...] How does it compare to dstep?

Re: Funny way to crash dmd and brick the whole computer

2018-09-28 Thread Stefan Koch via Digitalmars-d
On Friday, 28 September 2018 at 11:58:25 UTC, Zardoz wrote: CTE fib : module fib_cte; import std.stdio; long fib(long n) { if (n <= 1) return 1; return fib(n - 1) + fib(n - 2); } static immutable valueFib = fib(46); void main() { writeln(valueFib); } to be fair, that function is

Re: dmd as a library for scripting/JIT?

2018-09-14 Thread Stefan Koch via Digitalmars-d
On Friday, 14 September 2018 at 16:02:36 UTC, dennis luehring wrote: i've got user defined flow charts in my C++ application that calling C/C++ Code - could be possible to embedd dmd as a library, generate D code out of my flow charts and execute the "compiled" code directly without doing file

Re: x64 Privileged instruction

2018-09-12 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo wrote: x64 gives Privileged instruction but x86 gives First-chance exception: std.file.FileException "C:\": The filename, directory name, or volume label syntax is incorrect. at std\file.d(4573) which is much more

Re: Structures and CTFE

2018-09-03 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 3 September 2018 at 15:08:57 UTC, agorkvmh wrote: On Monday, 3 September 2018 at 15:00:33 UTC, Alex wrote: On Monday, 3 September 2018 at 14:00:23 UTC, agorkvmh wrote: [...] Yes. Put a pragma where you static assert for Foo(1).pos equality with 2: [...] Thanks, by the way,

Re: Looking for a mentor for SAoC

2018-08-28 Thread Stefan Koch via Digitalmars-d
On Monday, 27 August 2018 at 21:32:10 UTC, David Nadlinger wrote: On Monday, 27 August 2018 at 20:47:08 UTC, Stefam Koch wrote: generating it is not the problem but linking it on windows currently requires the MS linker. Is that true, though? DMD ships with LLD these days. — David Really

Re: A site like cppinsights.io, but for D?

2018-08-27 Thread Stefan Koch via Digitalmars-d
On Sunday, 26 August 2018 at 17:39:22 UTC, Alexander Nicholi wrote: I just ran across this website that does some pretty interesting deconstructions of C++ code, and I was wondering if anything like this exists for D. Apparently the main purpose is source-to-source

Re: DIP 1017--Add Bottom Type--Community Review Round 1

2018-08-10 Thread Stefan Koch via Digitalmars-d
On Saturday, 11 August 2018 at 00:01:34 UTC, Timon Gehr wrote: On 11.08.2018 01:40, Stefan Koch wrote: Another advantage is that you could pass null as an argument for a function template which wants to know it's element type (but of course not instantiate it) like any other pointer. No

Re: DIP 1017--Add Bottom Type--Community Review Round 1

2018-08-10 Thread Stefan Koch via Digitalmars-d
On Friday, 10 August 2018 at 13:15:46 UTC, Dukc wrote: On Friday, 10 August 2018 at 12:42:37 UTC, Nicholas Wilson wrote: meant is(typeof(*null) == typeof(assert(0))) How is that a good thing??? Also that is not specified in the dip. I would expect that to fail because both will produce

Re: DIP 1017--Add Bottom Type--Community Review Round 1

2018-08-09 Thread Stefan Koch via Digitalmars-d
On Thursday, 9 August 2018 at 13:42:57 UTC, bachmeier wrote: On Thursday, 9 August 2018 at 03:02:55 UTC, Mike Parker wrote: This is the feedback thread for the first round of Community Review for DIP 1017, "Add Bottom Type": I hope there is a better name than Tbottom. A name like that is not

Re: DIP 1017--Add Bottom Type--Community Review Round 1

2018-08-09 Thread Stefan Koch via Digitalmars-d
On Thursday, 9 August 2018 at 03:02:55 UTC, Mike Parker wrote: This is the feedback thread for the first round of Community Review for DIP 1017, "Add Bottom Type": [ ... ] Regarding the rationale: It should be pointed out that this is a further complication of the type-system (which is

Re: Prime number

2018-08-02 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 2 August 2018 at 08:30:05 UTC, Greatsam4sure wrote: I know D is very powerful from my little experience. What is the idiomatic way to get prime numbers say from 1-30 without using loops(outer and inner loop). Can map, filter, fold etc in algorithm be use. Pls show some code with

Re: skinny delegates

2018-08-02 Thread Stefan Koch via Digitalmars-d
On Thursday, 2 August 2018 at 12:57:02 UTC, Steven Schveighoffer wrote: On 8/2/18 8:42 AM, Stefan Koch wrote: On Monday, 30 July 2018 at 21:02:56 UTC, Steven Schveighoffer wrote: Would it be a valid optimization to have D remove the requirement for allocation when it can determine that the

Re: skinny delegates

2018-08-02 Thread Stefan Koch via Digitalmars-d
On Monday, 30 July 2018 at 21:02:56 UTC, Steven Schveighoffer wrote: Would it be a valid optimization to have D remove the requirement for allocation when it can determine that the entire data structure of the item in question is an rvalue, and would fit into the data pointer part of the

Re: Moving druntime into the DMD repository

2018-07-27 Thread Stefan Koch via Digitalmars-d
On Friday, 27 July 2018 at 11:03:50 UTC, Seb wrote: This a thread to explore whether it would be feasible to do so. What do you think? -- One is a compiler the other is a (optional!) library. merging the two means forcing druntime onto people who want to use dmd. the

Re: Bizarre Memory leak issue ??? help!

2018-07-27 Thread Stefan Koch via Digitalmars-d
On Friday, 27 July 2018 at 04:56:01 UTC, Mark wrote: Hello, I am building a toy compiler in D, and during this I ran into a situation. It involves checking the header of each function, going through the arguments, and seeing if there is any duplicate identifiers. I have a python script that

Re: extern(C++): Unresolved scalar deleting destructor

2018-07-24 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 15:48:28 UTC, Vladimir Marchevsky wrote: After reading 2.081 patchnotes about improvements with binding to cpp classes, I'm trying to test it - with simple examples and Qt as cpp library. My naive approach is to bind just a couple of used methods of specific

Re: newCTFE report July

2018-07-18 Thread Stefan Koch via Digitalmars-d
On Wednesday, 18 July 2018 at 18:36:37 UTC, H. S. Teoh wrote: On Wed, Jul 18, 2018 at 06:28:30PM +, Stefan Koch via Digitalmars-d wrote: [...] Good to hear that progress on newCTFE is still being made. What's your current estimate on when it will be production-ready? T I am going

newCTFE report July

2018-07-18 Thread Stefan Koch via Digitalmars-d
Hi Guys, last month I did the work make this snippet compile and execute correctly: static immutable four = [1, 2, 3, 4]; int fn(int idx = 2) { int fn2(const int* x) { return x[idx]; } return fn2([0]) + *([0]); } static assert(fn() == 4); There where two major problems

Re: Writing a compiler in CTFE

2018-07-01 Thread Stefan Koch via Digitalmars-d
On Sunday, 1 July 2018 at 13:51:36 UTC, MysteryMan wrote: [...] For speed of development, instead of having to compile a compiler that then compiles the program I figured using D's CTFE and import could work. For a monolithic compiler file import is used. This is all easily within D's grasp.

Re: turn range into tuple ?

2018-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 28 June 2018 at 09:26:10 UTC, Flaze07 wrote: On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote: On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote: is there some sort of ways to turn range into tuple ? ( an array preferably ) e.g uint[] arr = [ 10, 20, 30 ];

Re: turn range into tuple ?

2018-06-28 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote: is there some sort of ways to turn range into tuple ? ( an array preferably ) e.g uint[] arr = [ 10, 20, 30 ]; auto tup = rangeToTup( arr ); assert( tup[ 0 ] == 10 ); assert( tup[ 1 ] == 20 ); assert( tup[ 2 ] == 30 ); I think you are

Re: alias symbol name

2018-06-26 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 26 June 2018 at 09:14:11 UTC, Radu wrote: Consider this https://run.dlang.io/is/HyY2qG --- void main() { import std.traits; size_t s; pragma(msg, typeof(s).stringof); pragma(msg, mangledName!(typeof(s))); pragma(msg, mangledName!s); } --- It outputs: --- ulong

Re: Determine if CTFE or RT

2018-06-24 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote: On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote: let is(CTFE == x) mean that x is a compile time constant. CTFE(x) converts a x to this compile time constant. Passing any compile time constant essentially turns the variable in to a

Re: Debugging compile time memory usage

2018-06-24 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 24 June 2018 at 14:16:26 UTC, Kamil Koczurek wrote: I recently wrote a brainfuck compiler in D, which loads the BF source at compile time, performs some (simple) optimizations, translates everything to D and puts it into the source code with a mixin. I did manage to get some

Re: Phobos' std.conv.to-conversion from enum to string doesn't scale beyond hundreds of enumerators

2018-06-22 Thread Stefan Koch via Digitalmars-d
On Friday, 22 June 2018 at 20:23:51 UTC, Steven Schveighoffer wrote: On 6/22/18 2:15 PM, Steven Schveighoffer wrote: On 6/22/18 1:41 PM, Stefan Koch wrote: (I'd suggest a non-recursive mergesort.) How will that perform in CTFE? I'm concerned about swapping values making it allocate new

Re: Phobos' std.conv.to-conversion from enum to string doesn't scale beyond hundreds of enumerators

2018-06-22 Thread Stefan Koch via Digitalmars-d
On Friday, 22 June 2018 at 00:50:05 UTC, Steven Schveighoffer wrote: On 6/21/18 6:46 PM, Per Nordlöw wrote: I've discovered the annoying fact that std.conv.to doesn't scale for enum to string conversion when the enum has hundreds of members. This because of a call to `NoDuplicates` which has

Re: Move and CTFE

2018-06-21 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 30 May 2018 at 23:07:26 UTC, Jonathan M Davis wrote: newCTFE is taking a very different approach to CTFE, and in theory, it will fix many of the problems that CTFE currently has, but it's taking Stefan quite a while to get it to where it needs to be to actually merge it. To

Re: Ideas for students' summer projects

2018-06-21 Thread Stefan Koch via Digitalmars-d
On Wednesday, 23 May 2018 at 02:38:17 UTC, Mike Franklin wrote: On Tuesday, 22 May 2018 at 16:27:05 UTC, Eduard Staniloiu wrote: Let the brainstorming begin! Fork newCTFE and bring it to completion: https://dlang.org/blog/2017/04/10/the-new-ctfe-engine/ Mike I am still working on

Re: D code obfuscator

2018-06-14 Thread Stefan Koch via Digitalmars-d
On Thursday, 14 June 2018 at 05:21:03 UTC, DigitalDesigns wrote: Just one question! Are you kidding me? He most certainly is not. Infact I prefer size-optimized machinecode over source sometimes. Because it is a trustworthy representation of what the program does. Rather then being a

Re: newCTFE: perliminary delegate support is in!

2018-06-13 Thread Stefan Koch via Digitalmars-d
On Wednesday, 13 June 2018 at 06:10:26 UTC, Cym13 wrote: That's very nice! Out of curiosity, what was the reason to avoid a conventional stack? Or was it a consequence more than a design decision? (If you've explained it before, feel free to just throw the old post at me) It was an initial

newCTFE: perliminary delegate support is in!

2018-06-13 Thread Stefan Koch via Digitalmars-d
Good day ladies and gentleman, it is my distinct please to announce that a new feature just landed in newCTFE. !!! DELEGATES !!! this means the following code will now work: int square_of_x_plus_x(int x) pure { int passThrough(int y) pure { assert(x == y); int y2 = x;

Re: How can I enforce an parameter to be constant know at compile time?

2018-06-12 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 12 June 2018 at 18:27:17 UTC, Dr.No wrote: I'd like help of compiler to check this: consider this: int f(int n) { m_n = n; } f(10); // ok f(myTampleteFunction!(compileTimeParameter)); // ok enum n = 10; f(n); // I won't use this, but should also be ok int x = 10; f(x); // error

Re: Identifier hierarchy

2018-06-11 Thread Stefan Koch via Digitalmars-d
On Monday, 11 June 2018 at 13:47:41 UTC, Luís Marques wrote: On Monday, 11 June 2018 at 13:39:22 UTC, Basile B. wrote: the FQN is working here but i find the first message a bit confuse. Not sure if this small runnable represents the issue ? --- module runnable; import std.stdio,

Re: pure functions cannot be removed, actually: pure vs. total

2018-06-07 Thread Stefan Koch via Digitalmars-d
On Thursday, 7 June 2018 at 22:23:09 UTC, Steven Schveighoffer wrote: {...} That a function could return does not mean it will. int fn (int arg) /*strongly*/ pure { if (arg == 42) return 42; else (arg < 43) return fn(--arg); else return fn(++arg); } do you see the problem?

Re: WTF! new in class is static?!?!

2018-06-07 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 7 June 2018 at 21:07:26 UTC, DigitalDesigns wrote: class A; class B { A a = new A(); } auto b1 = new B(); auto b2 = new B(); assert(b1.a == b2.a)!! I'm glad I finally found this out! This is not typical behavior in most languages is it? I'd expect it to be translated to

Re: Confusion/trying to understand CTFE keywords

2018-06-05 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 5 June 2018 at 18:00:05 UTC, Steven Schveighoffer wrote: No, it's definitely a bug. main is not being evaluated at compile time. The real result of this function should be a compile-time error -- __ctfe is a *runtime* value that is always defined based on whether you are __ctfe

Re: pure functions cannot be removed, actually: pure vs. total

2018-06-05 Thread Stefan Koch via Digitalmars-d
On Tuesday, 5 June 2018 at 14:48:23 UTC, FeepingCreature wrote: I'm just posting to clear up the misunderstanding that a call to a pure function can be removed. Actually, even calls to strongly pure functions cannot always be removed. This is because there is one thing that a pure function can

Re: Mixin templates are a pain at best, useless at worst for any non-trivial use case

2018-06-05 Thread Stefan Koch via Digitalmars-d
On Tuesday, 5 June 2018 at 11:35:10 UTC, Ethan wrote: On Tuesday, 5 June 2018 at 10:11:49 UTC, Ethan wrote: And, honestly, with this method, I am already seeing the workaround. Because I've had to do it a ton of times already with other templates. Run a search for 'mixin( "import' in Binderoo

Re: Confusion/trying to understand CTFE keywords

2018-06-05 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 5 June 2018 at 13:27:35 UTC, Steven Schveighoffer wrote: On 6/5/18 6:40 AM, Simen Kjærås wrote: On Tuesday, 5 June 2018 at 09:36:22 UTC, Gopan wrote: void main() {     immutable n = __ctfe ? 1 : 2;     int[n] a;     assert(a.length == n); // fails, wat } That's gotta be a bug -

Re: std.digest can't CTFE?

2018-06-01 Thread Stefan Koch via Digitalmars-d
On Friday, 1 June 2018 at 18:30:34 UTC, Sisor wrote: On Friday, 1 June 2018 at 14:56:32 UTC, Stefan Koch wrote: On Thursday, 31 May 2018 at 21:29:13 UTC, Manu wrote: "CTFE Digests do not work in CTFE" That's an unfortunate limitation... why is, those things? :( Because CTFE cannot do

Re: std.digest can't CTFE?

2018-06-01 Thread Stefan Koch via Digitalmars-d
On Thursday, 31 May 2018 at 21:29:13 UTC, Manu wrote: "CTFE Digests do not work in CTFE" That's an unfortunate limitation... why is, those things? :( Because CTFE cannot do things which are technically ABI dependent. You can work around it with code like this: T fromBytes(T, Endianess

Re: Remember the Vasa! by Bjarne Stroustrup

2018-05-29 Thread Stefan Koch via Digitalmars-d
On Tuesday, 29 May 2018 at 05:47:32 UTC, Let-It-Go wrote: On Tuesday, 29 May 2018 at 05:11:27 UTC, Dmitry Olshansky wrote: D is probably at the edge of what I can tollerate complexity-wise. And we’ll get to simplify a few things soon I believe. There is the core of the problem. Because

Re: extend foreach to work on non-arrays

2018-05-25 Thread Stefan Koch via Digitalmars-d
On Thursday, 24 May 2018 at 22:43:00 UTC, IntegratedDimensions wrote: Doesn't make any sense? foreach(a; x) if x is not an array then a = x and the loop reduces simply and function to the case it is not so their can be no harm. It unifies the concepts so that one does not have to worry if x

Re: Support alias this in module scope?

2018-05-22 Thread Stefan Koch via Digitalmars-d
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote: Okay, I'm still really angry about the stupid stupid decision to make C++ namespaces into scopes rather than just a detail used for mangling, with absolutely no consultation of the community, in particular the target audience, who are

Re: Default Template Instantiation

2018-05-17 Thread Stefan Koch via Digitalmars-d
On Thursday, 17 May 2018 at 08:37:01 UTC, Heromyth wrote: On Monday, 19 September 2016 at 22:59:53 UTC, Jonathan Marler wrote: On Monday, 19 September 2016 at 22:17:34 UTC, Mathias Lang wrote: [...] Good example, thanks for the information. Maybe the compiler can do more works to make the

Re: Why is 64-bit dmd not built as part of the Windows release?

2018-05-15 Thread Stefan Koch via Digitalmars-d
On Tuesday, 15 May 2018 at 16:01:28 UTC, Atila Neves wrote: I don't know why even bother with 32-bit dmd to begin with, but at least there should be an option. [...] You need to do make clean. As the backend build with debug symbols will be ABI incompatible to the release frontend.

Re: Deserialize json on runtime type with vibed

2018-05-13 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 12 May 2018 at 20:23:27 UTC, boolangery wrote: Hi, I want to do something like that: The user first register some type associated to a string and a callback registerHandler!Foo("foo", (res) { info("message received"); }); I want the callback to be called when a json packet

Re: Concatenate strings at compile-time

2018-05-02 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 12:38:25 UTC, Jonathan M. Wilbur wrote: I have a method that cannot be @nogc only because it concatenates strings for a long exception message, as seen below. throw new ASN1ValuePaddingException ( "This exception was thrown

Re: Lightening cable?

2018-05-01 Thread Stefan Koch via Digitalmars-d
On Monday, 30 April 2018 at 19:30:25 UTC, Luís Marques wrote: Hi. Can anyone staying at the conference hotel lend me an iPhone charging cable? Even just for a few minutes would help. I forgot mine :( It's a normal USB-A-mini right?

Re: cast const pointer to non-const and change value yields neither result nor error

2018-04-30 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 30 April 2018 at 12:35:06 UTC, Timoses wrote: Hey, reading through https://dlang.org/articles/const-faq.html and experimenting a bit: ``` immutable int i = 3; const(int)* p = int* q = cast(int*)p; assert(q == p && p == ); writeln(i); // 3 *q = 1; //

Re: Static Analysis / Code Scanning Tool (SAST) for D?

2018-04-28 Thread Stefan Koch via Digitalmars-d
On Saturday, 28 April 2018 at 15:30:01 UTC, Jonathan M. Wilbur wrote: Does anybody know of a SAST tool that can scan D code for security vulnerabilities? In other words, does anybody know of something that will analyze raw D source code for security vulnerabilities that the human eye may have

Re: Using an external Assembler with D

2018-04-26 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 20:31:46 UTC, solidstate1991 wrote: On Wednesday, 25 April 2018 at 15:25:42 UTC, Stefan Koch wrote: Pass stuff on the stack ;) and use extern (C) functions. Thanks! What about extern (D)? Is there a big chaos in the D ABI under x86? I think the D abi is not

Re: Using an external Assembler with D

2018-04-25 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 21:02:07 UTC, solidstate1991 wrote: In order to make one of my own code more readable (and hopefully to avoid a lot of compiling errors under LDC, which don't happen in DMD for some reason), I'm planning to put my assembly functions into separate files for each

Re: Pre-DConf Meetup on May 1

2018-04-25 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 25 April 2018 at 14:13:55 UTC, Seb wrote: Hi all, I hope you are all looking forward to DConf. [...] I request a lighting talk slot :)

Re: Places to hang out in Munich the day before the conference

2018-04-25 Thread Stefan Koch via Digitalmars-d
On Wednesday, 25 April 2018 at 06:59:37 UTC, Shachar Shemesh wrote: Hello everybody, I'll be arriving in Munich on the morning of May 1st. I was wondering whether anyone has any recommendations as to how to spend that day? Thanks, Shachar NH Hotel :)

Re: CTFE in .di files

2018-04-18 Thread Stefan Koch via Digitalmars-d
On Tuesday, 17 April 2018 at 22:19:19 UTC, Manu wrote: I've been having some problems like this: https://issues.dlang.org/show_bug.cgi?id=18774 I have .di files with mixins that generate declarations using CTFE. Trouble is, executing the CTFE seems to leave residual references to symbols

Re: Rotate array in writefln?

2018-04-18 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4] data; file.writeln(format("%(%-(%d

Re: How/where to hack DMD to generate docs for string mixed members.

2018-04-15 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote: Hey, How/where to hack DMD to generate docs for string mixed members? struct S { mixin(" /// auto bar() {} "); } Best regards, Ilya Yaroshenko hmm you should be able to see docs for string mixins, if not. try using

Re: What are AST Macros?

2018-04-12 Thread Stefan Koch via Digitalmars-d
On Friday, 13 April 2018 at 00:37:39 UTC, jmh530 wrote: Could AST macros replace things like @safe/@nogc and enable the user to create their own (like a @supersafe that disallows @trusted)? Short Answer: Yes. If the AST-Macro facilities are built with that use in mind.

Re: newCTFE Status April 2018

2018-04-12 Thread Stefan Koch via Digitalmars-d
On Sunday, 8 April 2018 at 09:44:04 UTC, Stefan Koch wrote: [ ... ] And again I find a case which we did not handle for years. When we directly interpret a function which takes a reference to a static immutable global as parameter. This global will be full of zeros since newCTFE had no

Re: Is sorted using SIMD instructions

2018-04-12 Thread Stefan Koch via Digitalmars-d
On Thursday, 12 April 2018 at 07:25:27 UTC, Per Nordlöw wrote: Neither GCC, LLVM nor ICC can auto-vectorize (and use SIMD) the seemly simple function bool is_sorted(const int32_t* input, size_t n) { if (n < 2) { return true; } for (size_t i=0; i < n - 1; i++) { if

Re: What are AST Macros?

2018-04-09 Thread Stefan Koch via Digitalmars-d
On Friday, 6 April 2018 at 21:45:45 UTC, Zach Tollen wrote: I think Walter's reason was that such macros would hide too many idiosyncrasies in how they were programmed, such that a lot of code which seems simple on the surface will actually obfuscate complicated and arbitrary

Re: =void in struct definition

2018-04-09 Thread Stefan Koch via Digitalmars-d
On Monday, 9 April 2018 at 14:11:35 UTC, jmh530 wrote: On Monday, 9 April 2018 at 11:15:14 UTC, Stefan Koch wrote: Not semantically, but you might consider it a performance bug. This particular one could be fixed, put I cannot say how messy the details are. There is potential for code that

Re: Source expression passed to a lazy parameter

2018-04-09 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote: Is it possible to get the source expression sent to a lazy function? So that I can implement something like show(Arg)(lazy Arg arg) { writeln(arg.sourceof, arg); } used as show(1+2+3); will print 1+2+3:6 Because of

Re: =void in struct definition

2018-04-09 Thread Stefan Koch via Digitalmars-d
On Monday, 9 April 2018 at 11:15:14 UTC, Stefan Koch wrote: On Monday, 9 April 2018 at 11:06:50 UTC, Shachar Shemesh wrote: [ ... ] During the s initialization, the entire "S" area is initialized, including the member arr which we asked to be = void. Is this a bug? Shachar [ ... ] {This

Re: =void in struct definition

2018-04-09 Thread Stefan Koch via Digitalmars-d
On Monday, 9 April 2018 at 11:06:50 UTC, Shachar Shemesh wrote: struct S { int a; int[5000] arr = void; } void func() { S s; } During the s initialization, the entire "S" area is initialized, including the member arr which we asked to be = void. Is this a bug? Shachar Not

newCTFE Status April 2018

2018-04-08 Thread Stefan Koch via Digitalmars-d
Hi Guys, I have just implemented dynamic cast. Or rather I have debugged it. The generated byte-code for dynamic cast itself was correct. However per function only one dynamic cast would be generated. To generate my dynamic casts I loop through my type table and look for classes which are

Re: Deprecating this(this)

2018-04-04 Thread Stefan Koch via Digitalmars-d
On Wednesday, 4 April 2018 at 22:30:39 UTC, Walter Bright wrote: On 4/1/2018 3:49 AM, bachmeier wrote: What I was wondering too. I mean, breaking changes just don't happen to this language. Now there will be, without even an indication of how existing code would have to be rewritten, or how

Re: D compiles fast, right? Right??

2018-04-04 Thread Stefan Koch via Digitalmars-d
On Wednesday, 4 April 2018 at 20:02:56 UTC, Dmitry Olshansky wrote: On Wednesday, 4 April 2018 at 19:25:43 UTC, Stefan Koch wrote: On Wednesday, 4 April 2018 at 01:08:48 UTC, Andrei Alexandrescu wrote: [ ... ] Exactly, which is why I'm insisting this - and not compiler benchmarking, let

Re: D compiles fast, right? Right??

2018-04-04 Thread Stefan Koch via Digitalmars-d
On Wednesday, 4 April 2018 at 20:04:04 UTC, Jack Stouffer wrote: On Wednesday, 4 April 2018 at 01:08:48 UTC, Andrei Alexandrescu wrote: Exactly, which is why I'm insisting this - and not compiler benchmarking, let alone idle chattaroo in the forums - is where we need to hit. What we have here,

Re: D compiles fast, right? Right??

2018-04-04 Thread Stefan Koch via Digitalmars-d
On Wednesday, 4 April 2018 at 01:08:48 UTC, Andrei Alexandrescu wrote: [ ... ] Exactly, which is why I'm insisting this - and not compiler benchmarking, let alone idle chattaroo in the forums - is where we need to hit. What we have here, ladies and gentlemen, is a high-impact preapproved

Re: D compiles fast, right? Right??

2018-04-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 1 April 2018 at 02:40:26 UTC, Walter Bright wrote: On 3/30/2018 1:17 PM, Andrei Alexandrescu wrote: Could be faster. It's been a fair amount of time since somebody has done profiling of dmd. It needs to be done. There's probably plenty of low hanging fruit. Speculating about why

Re: std/typecons.d(2010:36)[warn]: Left side of logical or is identical to right side.

2018-04-02 Thread Stefan Koch via Digitalmars-d
On Monday, 2 April 2018 at 16:46:39 UTC, Andrei Alexandrescu wrote: I'm seeing this in the CI runs, but the line is actually not in error: https://github.com/dlang/phobos/blob/master/std/typecons.d#L2010 Where would be the problem? Andrei I guess it's parsed as a comma expression, which

Re: D compiles fast, right? Right??

2018-04-02 Thread Stefan Koch via Digitalmars-d
On Monday, 2 April 2018 at 12:35:03 UTC, Atila Neves wrote: On Sunday, 1 April 2018 at 02:40:26 UTC, Walter Bright wrote: On 3/30/2018 1:17 PM, Andrei Alexandrescu wrote: Could be faster. It's been a fair amount of time since somebody has done profiling of dmd. It needs to be done. There's

Re: D compiles fast, right? Right??

2018-04-01 Thread Stefan Koch via Digitalmars-d
On Sunday, 1 April 2018 at 02:40:26 UTC, Walter Bright wrote: On 3/30/2018 1:17 PM, Andrei Alexandrescu wrote: Could be faster. It's been a fair amount of time since somebody has done profiling of dmd. It needs to be done. There's probably plenty of low hanging fruit. Speculating about why

Re: newCTFE Status March 2018

2018-04-01 Thread Stefan Koch via Digitalmars-d
On Sunday, 1 April 2018 at 16:48:32 UTC, Per Nordlöw wrote: [...] What is going on here is that it tries to build the gccjit backend which is currently in a dysfunctional state. I am currently getting trying to get libgccjit working such that I can make use of it's debug output, while I am

Re: newCTFE Status March 2018

2018-04-01 Thread Stefan Koch via Digitalmars-d
On Sunday, 1 April 2018 at 16:48:32 UTC, Per Nordlöw wrote: [...] Oh I was not aware people would try this :) I have fixed the build please pull.

Re: newCTFE Status March 2018

2018-03-31 Thread Stefan Koch via Digitalmars-d
On Saturday, 31 March 2018 at 08:19:39 UTC, Patrick Schluter wrote: On Friday, 30 March 2018 at 20:46:32 UTC, Stefan Koch wrote: On Friday, 30 March 2018 at 20:15:20 UTC, 12345swordy wrote: On Friday, 30 March 2018 at 19:48:02 UTC, Stefan Koch wrote: [...] How close are you to finish this?

Re: newCTFE Status March 2018

2018-03-30 Thread Stefan Koch via Digitalmars-d
On Friday, 30 March 2018 at 20:15:20 UTC, 12345swordy wrote: On Friday, 30 March 2018 at 19:48:02 UTC, Stefan Koch wrote: [...] How close are you to finish this? 85 to 90% maybe. I expect that there will many bugs which were hidden by newCTFE not supporting classes, which will now be out

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