Re: D compiles fast, right? Right??

2018-03-30 Thread Stefan Koch via Digitalmars-d
On Friday, 30 March 2018 at 20:17:39 UTC, Andrei Alexandrescu wrote: On 3/30/18 12:12 PM, Atila Neves wrote: Fast code fast, they said. It'll be fun, they said. Here's a D file:     import std.path; Yep, that's all there is to it. Let's compile it on my laptop:     /tmp % time dmd -c 

Re: __has_side_effects

2018-03-30 Thread Stefan Koch via Digitalmars-d
On Friday, 30 March 2018 at 20:28:27 UTC, Andrei Alexandrescu wrote: https://www.reddit.com/r/programming/comments/88aqsf/the_joy_of_max/ Discussion aside, I notice with pleasant surprise gcc has an introspection primitive we didn't think of: __is_constant that (I assume) yields true if the

newCTFE Status March 2018

2018-03-30 Thread Stefan Koch via Digitalmars-d
Hello Guys, I took a few days off over easter and I have very good news for you. The following code will now compile and execute correctly using newCTFE. --- class C { int i() {return 1;} } class D : C { override int i() {return 2;} float f() { return 1.0f; } } class E : D {

Re: #dbugfix Issue 16486 200$

2018-03-30 Thread Stefan Koch via Digitalmars-d
On Friday, 30 March 2018 at 06:11:22 UTC, 9il wrote: [1] https://issues.dlang.org/show_bug.cgi?id=16486 Ah that is an interesting bug which further demonstrates that templates are a tricky thing :) Basically you cannot _generally_ proof that one template just forwards to another. Therefore

Re: D vs nim

2018-03-27 Thread Stefan Koch via Digitalmars-d
On Tuesday, 27 March 2018 at 12:02:37 UTC, jmh530 wrote: On Wednesday, 22 April 2015 at 06:03:07 UTC, Timothee Cour wrote: [snip] I would like to refocus this thread on feature set and how it compares to D, not on flame wars about brackets or language marketing issues. In the comparison

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-18 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 18 March 2018 at 12:59:06 UTC, tipdbmp wrote: I can't read assembly but it seems to me that it doesn't: https://godbolt.org/g/PCsnPT I think C++'s sort can take a "function object" that can get inlined. Correct it does not get in-lined. Even with -O3 it does not. The reason is

Re: signbit question

2018-03-15 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote: Why does std.math.signbit only work for floating point types? Is there an analogue function for integer types? what is the best way to compare the sign of a float with the sign of an integer? Thanks in advance integers don't have a

Re: Tuple DIP

2018-03-15 Thread Stefan Koch via Digitalmars-d
On Thursday, 15 March 2018 at 14:07:12 UTC, JN wrote: On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote: As promised [1], I have started setting up a DIP to improve tuple ergonomics in D: https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md I may be out of the loop

Re: Seeking lecturer - D language (Moscow)

2018-03-14 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 14 March 2018 at 11:44:10 UTC, Simen Kjærås wrote: On Wednesday, 14 March 2018 at 11:38:20 UTC, Dmitry Olshansky wrote: - I owe you a bottle of your favorite beverage and your favorite bug in Bugzilla if you agree ;) https://issues.dlang.org/show_bug.cgi?id=5710 might be worth

Re: Special Code String for mixins

2018-03-14 Thread Stefan Koch via Digitalmars-d
On Wednesday, 14 March 2018 at 15:50:13 UTC, Jonathan Marler wrote: On Wednesday, 15 March 2017 at 13:50:28 UTC, Inquie wrote: [...] I've got a PR for dmd (https://github.com/dlang/dmd/pull/7988) that implements "interpolated strings" which makes generating code with strings MUCH nicer,

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 11 March 2018 at 23:12:30 UTC, Joe wrote: I'm getting a compiler error in a qsort() call as follows: qsort(recs, num_recs, (Record *).sizeof, compar); Record is a struct, recs is a fixed array of pointers to Record's and num_recs is a size_t that holds the number of valid

Re: Forwarding arguments through a std.algorithm.map

2018-03-11 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote: If I have a function bool f(Rs...)(Rs rs) is it somehow possible to map and forward all its arguments `rs` to another function bool g(Rs...)(Rs rs); through a call to some map-and-forward-like-function `forwardMap` in

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 5 March 2018 at 18:04:20 UTC, Nordlöw wrote: On Monday, 5 March 2018 at 16:07:49 UTC, Steven Schveighoffer wrote: No, I mean you call holeKey at *runtime*. Inlined, it's just returning a constant, so it should reduce to a constant. A compile-time constant visible to the optimizer?

Re: Opt-in non-null class references?

2018-03-02 Thread Stefan Koch via Digitalmars-d
On Friday, 2 March 2018 at 09:59:53 UTC, deadalnix wrote: Honestly, this is not that hard. It's very hard in DMD because it doesn't go through an SSA like form at any point. It's rather disappointing to see the language spec being decided upon based on design decision made in a compiler many

Re: C++ launched its community survey, too

2018-02-28 Thread Stefan Koch via Digitalmars-d
On Wednesday, 28 February 2018 at 11:32:32 UTC, Atila Neves wrote: On Tuesday, 27 February 2018 at 20:46:20 UTC, bachmeier wrote: On Tuesday, 27 February 2018 at 20:33:18 UTC, Jonathan M Davis wrote: The other problem is that many of C++'s problems come from being a superset of C, which is

Re: Equivalent to Python with Statement

2018-02-27 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()` called automatically ``` I know D's `with` statement does

Re: How do I trace that memory error?

2018-02-27 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is: core.exception.OutOfMemoryError@src\core\exception.d(696): Memory allocation failed How do

Re: can we un-deprecate .ptr on arrays in @safe code? cf issue 18529

2018-02-27 Thread Stefan Koch via Digitalmars-d
On Tuesday, 27 February 2018 at 09:23:19 UTC, bauss wrote: On Tuesday, 27 February 2018 at 08:43:32 UTC, Timothee Cour wrote: see rationale in https://issues.dlang.org/show_bug.cgi?id=18529 All I see is a rationale for how it can't be replaced, but not a rationale for actually doing it. I

Re: Slow code, slow

2018-02-27 Thread Stefan Koch via Digitalmars-d
On Tuesday, 27 February 2018 at 09:25:57 UTC, Martin Tschierschke wrote: On Tuesday, 27 February 2018 at 08:49:15 UTC, Stefan Koch wrote: On Monday, 26 February 2018 at 21:38:09 UTC, ketmar wrote: H. S. Teoh wrote: On Mon, Feb 26, 2018 at 10:12:25PM +0200, ketmar via Digitalmars-d wrote:

Re: Slow code, slow

2018-02-27 Thread Stefan Koch via Digitalmars-d
On Monday, 26 February 2018 at 21:38:09 UTC, ketmar wrote: H. S. Teoh wrote: On Mon, Feb 26, 2018 at 10:12:25PM +0200, ketmar via Digitalmars-d wrote: [...] but until that brave new world materializes, we have a smart/fast dilemma. alas. I'd like to contribute to the materialization of

Re: Slow code, slow

2018-02-24 Thread Stefan Koch via Digitalmars-d
On Friday, 23 February 2018 at 20:15:12 UTC, H. S. Teoh wrote: Now that I got your attention: https://issues.dlang.org/show_bug.cgi?id=18511 tl;dr: A trivial piece of code, written as ostensibly "idiomatic D" with std.algorithm and std.range templates, compiles *an order of

Re: how to propagate computed type during CTFE?

2018-02-23 Thread Stefan Koch via Digitalmars-d
On Friday, 23 February 2018 at 00:54:34 UTC, Timothee Cour wrote: in example below, how do I propagate RET (or even `typeof(a)`) to the result value of `inferType`? does this need a language change to allow this? ``` template inference(alias emitter) { auto inference(){ auto

Re: Understanding the AST...

2018-02-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 February 2018 at 13:21:04 UTC, joe wrote: On Monday, 12 February 2018 at 08:47:58 UTC, RazvanN wrote: [...] Follow up question... Why is *.parent always null? e.g.: extern(C++) class MyVisitor(AST): ParseTimeTransitiveVisitor!AST { override void visit(AST.Import i) {

Re: how to get typeid of extern(C++) classes?

2018-02-16 Thread Stefan Koch via Digitalmars-d
On Friday, 16 February 2018 at 00:42:02 UTC, Timothee Cour wrote: is there a way to get typeid of extern(C++) classes (eg for ones in dmd/astbase.d but not limited to that) ? C++ exposes it via typeid so in theory all the info is there ; I would need it at least for debugging (eg if RTTI is not

Re: std.zip size limit of 2 GB?

2018-02-15 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 15 February 2018 at 11:56:04 UTC, Andre Pany wrote: Hi, I just noticed that std.zip will throw an exception if the source files exceeds 2 GB. I am not sure whether this is a limitation of zip version 20 or a bug. On wikipedia a size limit of 4 GB is mentioned. Should I open an

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 14:10:44 UTC, number wrote: Ok, thanks for the info. I guess I'll just use printf then for larger enums. To get the same convince you can use. the enumToString from: https://forum.dlang.org/post/pnggoabnnkojdonyz...@forum.dlang.org and writeln the result oft

Re: unable to fork: Cannot allocate memory / core.checkedint / gtkd

2018-02-13 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 12:17:31 UTC, number wrote: On Sunday, 11 February 2018 at 15:05:26 UTC, number wrote: On Sunday, 11 February 2018 at 13:17:13 UTC, number wrote: unable to fork: Cannot allocate memory if i comment-out the line.. writeln(GdkKeysyms.GDK_Escape); then it

Re: Bye bye, fast compilation times

2018-02-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 13 February 2018 at 05:47:10 UTC, Dmitry Olshansky wrote: Was once on my together with other OS memory manager functions, but postponed the work indefinetly. https://github.com/dlang/druntime/pull/1549 If someone is willing to revive that I’d gladly assist with review. Lastly

Re: Bye bye, fast compilation times

2018-02-08 Thread Stefan Koch via Digitalmars-d
On Wednesday, 7 February 2018 at 22:00:48 UTC, Bastiaan Veelo wrote: On Wednesday, 7 February 2018 at 09:27:47 UTC, Stefan Koch wrote: Another Thing that can be done is reviewing the code and alerting me to potential problems. i.e. Missing or indecipherable comments as well as spelling

Re: Bye bye, fast compilation times

2018-02-08 Thread Stefan Koch via Digitalmars-d
On Wednesday, 7 February 2018 at 22:00:48 UTC, Bastiaan Veelo wrote: On Wednesday, 7 February 2018 at 09:27:47 UTC, Stefan Koch wrote: Another Thing that can be done is reviewing the code and alerting me to potential problems. i.e. Missing or indecipherable comments as well as spelling

Re: How hard would it be to get DMD to generate SIMD code for all x86 targets?

2018-02-07 Thread Stefan Koch via Digitalmars-d
On Wednesday, 7 February 2018 at 16:22:13 UTC, solidstate1991 wrote: It would be also great if 32 bit and 64 bit long vector loading could be supported, so I don't have to write separate functions for that. Had to delete a lot of code I wrote in Assembly after I made a big mistake thanks to

Re: Annoyance with new integer promotion deprecations

2018-02-07 Thread Stefan Koch via Digitalmars-d
On Tuesday, 6 February 2018 at 20:23:02 UTC, Walter Bright wrote: [...] DFA is a complex thing. This is why DFA is done on the vastly simplified and canonicalized intermediate code, not the ASTs. Doing DFA for VRP means doing it on the ASTs. I know what you're asking for sounds simple

Re: Bye bye, fast compilation times

2018-02-07 Thread Stefan Koch via Digitalmars-d
On Tuesday, 6 February 2018 at 18:56:44 UTC, H. S. Teoh wrote: We seriously need to get newCTFE finished and merged. Stefan is very busy with other stuff ATM; I wonder if a few of us can continue his work and get newCTFE into a mergeable state. Given how much D's "compile-time" features

Re: Bye bye, fast compilation times

2018-02-07 Thread Stefan Koch via Digitalmars-d
On Tuesday, 6 February 2018 at 18:56:44 UTC, H. S. Teoh wrote: We seriously need to get newCTFE finished and merged. Stefan is very busy with other stuff ATM; I wonder if a few of us can continue his work and get newCTFE into a mergeable state. Given how much D's "compile-time" features

Re: Interactive Interpreter

2018-02-05 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 5 February 2018 at 19:54:09 UTC, Jiyan wrote: Is there any work for an interactive interpreter for D -maybe just for ctfe-able expressions? It shouldnt be too hard to implement it regarding the fact, that ctfe is kinda doing what an interpreter should do i guess. There is

Re: Getting compiler Segfault

2018-02-04 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 4 February 2018 at 12:52:22 UTC, Ur@nuz wrote: Getting compiler stack overflow when building my project, but still do not know how to localize piece of code that triggers this bug. Maybe this bug is already registered in bugzilla or someone could give some advice where to dig into?

Re: rdmd main.d leads to Segmentation fault

2018-01-29 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote: Hey, simple hello world crashes with segfault: [...] I can not reproduce this.

Re: D generates large assembly for simple function

2018-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 27 January 2018 at 19:43:50 UTC, Stefan Koch wrote: On Saturday, 27 January 2018 at 19:42:01 UTC, Matt wrote: Godbolt link: https://godbolt.org/g/t5S976 The actual code is : imul edi, edi mov eax, edi ret The rest is runtime initialization. which you can remove using an

Re: D generates large assembly for simple function

2018-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 27 January 2018 at 19:42:01 UTC, Matt wrote: Godbolt link: https://godbolt.org/g/t5S976 The actual code is : imul edi, edi mov eax, edi ret The rest is runtime initialization. which you can remove using an undocumented -betterC switch.

Re: Channeling memory model experts...

2018-01-24 Thread Stefan Koch via Digitalmars-d
On Wednesday, 24 January 2018 at 18:37:54 UTC, Andrei Alexandrescu wrote: ... to review https://github.com/dlang/druntime/pull/2057/. Thanks! -- Andrei This isn't really about the memory model is it ? I'd like to see a description of what that change is supposed a achieve. On the first glance

Re: Any sample how to use Sqlite-d?

2018-01-17 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 17 January 2018 at 13:36:26 UTC, Marc wrote: I was looking for a library to use SQLite with D, found this (https://code.dlang.org/packages/sqlite-d) but it has no documentation or code example. I looked into files in the source code and wrote this: Database db =

Re: Possible dmd 2.078 regression ?

2018-01-12 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worked fine before. Please test this --- if [ ! -d "iz" ]; then git clone https://www.github.com/BBasile/iz.git fi cd

Re: Bump the minimal version required to compile DMD to 2.076.1

2018-01-12 Thread Stefan Koch via Digitalmars-d
On Friday, 12 January 2018 at 16:13:39 UTC, Seb wrote: Motivation -- 1) It's required for Walter's work on using -betterC for the backend conversion: https://github.com/dlang/dmd/pull/6907 2) We start to run into random failures lately, e.g.

Re: Alias Vs. Enum?

2018-01-06 Thread Stefan Koch via Digitalmars-d
On Saturday, 6 January 2018 at 21:33:46 UTC, Rubn wrote: Is there a reason for the differences between Enum and Alias? For the most part enums are only used for things that have a value, but alias is used more for types. But with templates you can get around this and you basically get the

Re: Is old style compile-time foreach redundant?

2018-01-06 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 7 January 2018 at 01:08:44 UTC, H. S. Teoh wrote: On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via Digitalmars-d-learn wrote: On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote: > Is 'static foreach' sufficient for all needs or is there any > value for r

Re: Is old style compile-time foreach redundant?

2018-01-06 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote: Is 'static foreach' sufficient for all needs or is there any value for regular foreach over compile-time sequences? Code unrelated to the question: import std.stdio; void main() { // Old style compile-time foreach. This

Re: Help optimizing UnCompress for gzipped files

2018-01-02 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 2 January 2018 at 10:27:11 UTC, Christian Köstlin wrote: Hi all, over the holidays, I played around with processing some gzipped json data. First version was implemented in ruby, but took too long, so I tried, dlang. This was already faster, but not really satisfactory fast. Then

Re: Behavior of joining mapresults

2017-12-20 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 15:28:00 UTC, Christian Köstlin wrote: When working with json data files, that we're a little bigger than convenient I stumbled upon a strange behavior with joining of mapresults (I understand that this is more or less flatmap). I mapped inputfiles, to

Re: __traits(parent) borken on templates

2017-12-12 Thread Stefan Koch via Digitalmars-d
On Tuesday, 12 December 2017 at 14:49:04 UTC, Shachar Shemesh wrote: module foo; import std.traits; [...] A template is not a symbol as is. And eponymous templates alias them-selfs to the symbol they define on instancing

Re: Question for compiler gurus about compile-time strings

2017-12-09 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 9 December 2017 at 18:45:18 UTC, Steven Schveighoffer wrote: I was thinking that all strings generated at compile-time have a null-terminator added. But then I thought, wait, maybe that's only specifically for string literals. What is the true answer? If you generate a string,

Re: @ctfeonly

2017-12-08 Thread Stefan Koch via Digitalmars-d
On Friday, 8 December 2017 at 11:48:26 UTC, Nicholas Wilson wrote: On Friday, 8 December 2017 at 10:46:20 UTC, John Colvin wrote: On Thursday, 7 December 2017 at 01:21:11 UTC, Nicholas Wilson wrote: [...] How would such a thing interact with __traits(compiles, ...) and is-expressions?

Re: @ctfeonly

2017-12-06 Thread Stefan Koch via Digitalmars-d
On Thursday, 7 December 2017 at 01:21:11 UTC, Nicholas Wilson wrote: I'd like to add an attribute to indicate that the annotated function is only available at compile time so that in cases where the operation is invalid at runtime (strings and concatenation on a GPU for instance) but the

Re: Inference of Scoped Destruction

2017-11-30 Thread Stefan Koch via Digitalmars-d
On Thursday, 30 November 2017 at 16:31:25 UTC, Nordlöw wrote: Are there any plans to D compilers to use recent DIP-1000 to infer scoped destruction of GC-allocated data such as in the following case: T sum(T)(in T[] x) // x cannot escape scope of `sum` { /// calculate and return sum of

Re: Basic questions about D lang?

2017-11-28 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 13:39:11 UTC, Jayam wrote: Is D language open source? Do this have GUI Desktop application support ? Do this have web api support ? Can we compile our program to multi program ? yes yes some (dlang-ui for example) yes some (vibe.d or arsd) I don't know what you

Re: Tried C++ to D. Wrong result.

2017-11-27 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 27 November 2017 at 14:08:27 UTC, Dmitry wrote: I tried translate C++ programm to D, but result is different. original: https://github.com/urraka/alpha-bleeding/blob/master/src/alpha-bleeding.cpp result (with removed alpha):

Re: Passing this to void *

2017-11-22 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 15:23:58 UTC, Tim Hsu wrote: I am afraid what will happen when casting this reference to void * a ref is a ptr. The cast will produce a ptr which is valid as long as the ref is valid.

Re: Passing this to void *

2017-11-22 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 15:11:08 UTC, Tim Hsu wrote: On Wednesday, 22 November 2017 at 15:07:54 UTC, Stefan Koch will do. I've tried it in the first place. ... Error: this is not an lvalue In that case casting to void* should be fine.

Re: Passing this to void *

2017-11-22 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 15:07:08 UTC, Tim Hsu wrote: I am a C++ game developer and I want to give it a try. It seems "this" in Dlang is a reference instead of pointer. How can I pass it as void *? void foo(void *); class Pizza { public: this() { Pizza newone = this;

Re: newCTFE Status November 2017

2017-11-19 Thread Stefan Koch via Digitalmars-d
On Sunday, 19 November 2017 at 17:03:32 UTC, Nordlöw wrote: On Saturday, 18 November 2017 at 13:54:45 UTC, Stefan Koch wrote: Hi Guys, I know there has been a lack of visible activity lately in the field of newCTFE. But fear not, there is progress; even if it is much slower then before.

newCTFE Status November 2017

2017-11-18 Thread Stefan Koch via Digitalmars-d
Hi Guys, I know there has been a lack of visible activity lately in the field of newCTFE. But fear not, there is progress; even if it is much slower then before. I just implemented support for varadic function templates. (which produces a curious AST in which you have more arguments then

don't answer (possible/likely) spam

2017-11-10 Thread Stefan Koch via Digitalmars-d
please don't answer messages which are possibly spam. Try this by not answering to this thread.

Re: Why Physicists Still Use Fortran

2017-10-18 Thread Stefan Koch via Digitalmars-d
On Wednesday, 18 October 2017 at 13:42:04 UTC, XavierAP wrote: Dennis Ritchie did only two things wrong: placing the * at the wrong side in pointer declarations; and making arrays as unsafe, raw pointers -- and in consequence providing two redundant ways to do one same thing: [2] or arr+2

Re: partiallyQualifiedName?

2017-10-17 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 16 October 2017 at 23:56:00 UTC, Nicholas Wilson wrote: using fullyQualifiedName [here] (https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl/util.d#L120) leads to a large compilation slowdown, but I only need it to disambiguate up to the module level i.e. so

Re: [OT] Re: Why Physicists Still Use Fortran

2017-10-16 Thread Stefan Koch via Digitalmars-d
On Monday, 16 October 2017 at 15:22:30 UTC, Manu wrote: On 15 Oct. 2017 11:50 pm, "Walter Bright via Digitalmars-d" < digitalmars-d@puremagic.com> wrote: On 10/15/2017 10:09 PM, Manu wrote: Haha, incidentally, I've just moved to LA, and I'm failing to convince myself I won't die if I try and

Re: newCTFE Status August 2017

2017-10-11 Thread Stefan Koch via Digitalmars-d
On Wednesday, 11 October 2017 at 07:39:47 UTC, Tourist wrote: On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: Hi Guys, At the end of July newCTFE became capable of executing the bf-ctfe[1] code and pass the tests. At 5 times the speed. While using 40% the memory. (It should be

Re: newCTFE Status August 2017

2017-10-11 Thread Stefan Koch via Digitalmars-d
On Wednesday, 11 October 2017 at 10:45:32 UTC, Stefan Koch wrote: On Wednesday, 11 October 2017 at 07:39:47 UTC, Tourist wrote: On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [...] What about October 2017? I miss your frequent updates on newCTFE. Sorry about that, I am

Re: Unsigned comparison operators

2017-09-29 Thread Stefan Koch via Digitalmars-d
On Friday, 29 September 2017 at 11:20:13 UTC, Cecil Ward wrote: I love the D >>> operator and I use it a lot. So much safer than the chaos in C. I would absolutely love to have unsigned comparison operators in D. Do you agree? What on earth would the syntax be like? Yes, I could write a

Re: static array with inferred size

2017-09-20 Thread Stefan Koch via Digitalmars-d
On Wednesday, 20 September 2017 at 12:08:45 UTC, Andrei Alexandrescu wrote: On 09/20/2017 07:49 AM, Jonathan M Davis wrote: On Wednesday, September 20, 2017 10:59:56 Per Nordlöw via Digitalmars-d wrote: On Wednesday, 20 September 2017 at 09:13:52 UTC, Jonathan M Davis wrote:

Re: Choosing between __traits(compiles, { ... } ) and is(typeof( { ... } ))

2017-09-20 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 12:01:21 UTC, Nordlöw wrote: When is __traits(compiles, { ... } ) preferred over is(typeof( { ... } )) and vice versa when writing stuff like enum isCopyable(S) = is(typeof( { S foo = S.init; S copy = foo; } )); ? Further, are there cases

Re: Internal error mixing templates and CTFE

2017-09-15 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 15 September 2017 at 05:58:47 UTC, David Bennett wrote: Hi Guys, I've been playing around with CTFE today to see how far I would push it but I'm having an issue appending to an array on a struct in CTFE from a template: [...] are you using ucent ?

Re: Performance Issue

2017-09-05 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 5 September 2017 at 09:44:09 UTC, Vino.B wrote: Hi, The below code is consume more memory and slower can you provide your suggestion on how to over come these issues. [...] Much slower then ?

Re: Compiler scalability. Question inspired by OOM errors seen by Crystal language

2017-08-31 Thread Stefan Koch via Digitalmars-d
On Thursday, 31 August 2017 at 17:39:35 UTC, H. S. Teoh wrote: This is just one example off the top of my head; I'm sure there are plenty of others that we can come up with once we break free of the C++ mold of thinking of templates as "copy-n-paste except substitute X with Y". Another

Re: Compiler scalability. Question inspired by OOM errors seen by Crystal language

2017-08-31 Thread Stefan Koch via Digitalmars-d
On Wednesday, 30 August 2017 at 16:34:13 UTC, H. S. Teoh wrote: The CTFE problem will be fixed soon, once Stefan Koch finishes his newCTFE engine. Templates are still an area where a lot of improvement can be made. But Stefan has indicated interest in visiting this area in the compiler

Re: newCTFE Status August 2017

2017-08-31 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hi Guys, many stabilty fixed have happened and as a result the new preview-build is green on the auto-tester and project tester. However it might still produce !!invalid code!! if a certain combination of features

Re: Parse tree node allocator

2017-08-31 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 31 August 2017 at 15:43:05 UTC, Per Nordlöw wrote: Which allocator is best suited for allocating tree nodes (all of equal size around 40-60 bytes in size) in one shot and then delete them all in one go? My use case is parse trees. Region Allocator.

Re: Remove all blank lines from a file

2017-08-31 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 31 August 2017 at 14:44:07 UTC, vino wrote: Hi All, Can some provide me a example of how to remove all blank lines from a file. From, Vino.B ubyte[] fileData; ubyte[] writeThis; uint lastP; fileData = readRaw(fileName); foreach(uint p; ubyte b;fileData) { if (b ==

Re: writeln() sometimes double prints from main() if I run a thread checking for input?

2017-08-30 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 10:55:20 UTC, Timothy Foster wrote: On Wednesday, 30 August 2017 at 10:44:43 UTC, Ivan Kazmenko wrote: On Wednesday, 30 August 2017 at 10:13:57 UTC, Timothy Foster wrote: I'm not sure if this is a known issue, or if I just don't understand how to use threads,

Re: Tools to help me find memory leaks?

2017-08-23 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 17:30:40 UTC, Drake44 wrote: I'm on a Windows 7 machine and I'm using VisualD as my IDE. I'm trying to work out what's chewing up all the RAM in a program I'm writing... is there a tool that I can use that'll show me what in my program keeps allocating memory?

Re: Stefan Koch: New CTFE fix

2017-08-16 Thread Stefan Koch via Digitalmars-d
On Wednesday, 16 August 2017 at 13:55:51 UTC, Johnson wrote: You know, if you people actually focused on the real issues ... I agree. Please apply said focus. Reflection is not limited to compile-time.

Re: newCTFE Status August 2017

2017-08-14 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Guys, newCTFE is green on 64 and 32bit! I've finally fixed || and &&. For good! whoho ;) Release is coming closer!

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-14 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 14 August 2017 at 04:29:17 UTC, Johnson wrote: ``` auto valueToString(alias v)(){return v.stringof;} enum a = valueToString!(0.75); static assert(a == "0.75"); ``` Thanks! You'd think that to would do this internally automatically ;/ It only works on literals. valueToString!(a)

Re: jai-like CTFE string formating

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Sunday, 13 August 2017 at 19:47:37 UTC, Jerry wrote: Seems like it'd be a good idea to pre compute all of phobos for compile time computations, as they should be changing. That would drastically reduce using any of phobos for compile time computation. You cannot do that. The point of

Re: jai-like CTFE string formating

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Sunday, 13 August 2017 at 18:20:15 UTC, Sönke Ludwig wrote: Am 12.08.2017 um 13:47 schrieb Stefan Koch: Hi Guys, I've just implemented a subset of the std.format functionality. In the same style that Johnathan Blow uses for JAI. It's about 10x faster then using std.format and uses much

Re: newCTFE Status August 2017

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hi there, I've just adjusted the memory allocation behavior. newCTFE will now start-out allocating 32M of memory at startup. and increase the allocated space in 8x steps if it hits the limit while executing concat code.

Re: newCTFE Status August 2017

2017-08-13 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hi Guys, I've fixed a few ABI bugs and as a result my alternative to std.bitmanip.bitfields complies now. I've also made an intrinsic for the concat operation. Which causes ~= to be 6-10x faster when it's heavily used.

Re: jai-like CTFE string formating

2017-08-12 Thread Stefan Koch via Digitalmars-d
On Sunday, 13 August 2017 at 00:42:08 UTC, Manu wrote: On 13 August 2017 at 00:15, Stefan Koch via Digitalmars-d < [ ... ] If you're keen to introduce a new function, I'd strongly suggest changing to {1} {2} {3}, or %1 %2 %3, format/printf functions where you don't supply the place in

Re: jai-like CTFE string formating

2017-08-12 Thread Stefan Koch via Digitalmars-d
On Saturday, 12 August 2017 at 13:19:12 UTC, ixid wrote: On Saturday, 12 August 2017 at 11:47:10 UTC, Stefan Koch wrote: Whereas the following alternative takes 20 ms : { import ctfe_utils; pragma(msg, format_jai("Hello % % % % % % % % %", " I ", " just", " have" , " to", " concat", "

jai-like CTFE string formating

2017-08-12 Thread Stefan Koch via Digitalmars-d
Hi Guys, I've just implemented a subset of the std.format functionality. In the same style that Johnathan Blow uses for JAI. It's about 10x faster then using std.format and uses much less memory :) the follwing code takes over 250 ms to compile : { import std.format; pragma(msg,

Re: newCTFE Status August 2017

2017-08-11 Thread Stefan Koch via Digitalmars-d
On Friday, 11 August 2017 at 20:13:04 UTC, Dominikus Dittes Scherkl wrote: On Friday, 11 August 2017 at 09:27:47 UTC, Stefan Koch wrote: On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hey guys, I just finished &&. Hooray! So what's still missing? Or is this now

Re: newCTFE Status August 2017

2017-08-11 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] Hey guys, I just finished &&. The following test works now: int[2] aaa2(bool b1, bool b2, bool b3, bool b4) { int x = 0; if (b1 && ++x && b2 && x++ && b3 && (b4 || x++)) { return [x, 1]; } else {

Re: newCTFE Status August 2017

2017-08-09 Thread Stefan Koch via Digitalmars-d
On Wednesday, 9 August 2017 at 18:27:37 UTC, 12345swordy wrote: On Wednesday, 9 August 2017 at 15:47:09 UTC, Stefan Koch wrote: On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [...] After a bit of fixing and the unfortunate addition of 4 blacklisted functions, phobos complies

Re: I'm the new package maintainer for D on ArchLinux

2017-08-09 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 9 August 2017 at 20:42:48 UTC, Wild wrote: I hope I can maintain ArchLinux as a great environment to use D. You are not only the new package mainainer but also my new Hero :)

Re: newCTFE Status August 2017

2017-08-09 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] After a bit of fixing and the unfortunate addition of 4 blacklisted functions, phobos complies and passes the unittests under newCTFE. (Which implies that druntime compiles and works as well) A few ABI issues were

Re: rename file, execute os, etc at compile time

2017-08-07 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote: On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote: On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote: [...] It is deliberately not possible. reproducible builds security ect. have a look at dubs

Re: newCTFE Status August 2017

2017-08-05 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] I am quite surprised. newCTFE comes far enough now, that it tries to interpret it's own interpreter (which is CTFEable) Of course it fails in doing so since we do not yet handle newing arrays or associative arrays.

Re: newCTFE Status August 2017

2017-08-05 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] The following code does now compile with newCTFE, and it's a little faster then the old interpreter. Not much though since that is not a pathological case. pure nothrow @nogc @safe uint[256][8] genTables32(uint

Re: lambda function with "capture by value"

2017-08-05 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 5 August 2017 at 18:19:05 UTC, Stefan Koch wrote: On Saturday, 5 August 2017 at 18:17:49 UTC, Simon Bürger wrote: If a lambda function uses a local variable, that variable is captured using a hidden this-pointer. But this capturing is always by reference. Example: int i = 1;

Re: lambda function with "capture by value"

2017-08-05 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 5 August 2017 at 18:17:49 UTC, Simon Bürger wrote: If a lambda function uses a local variable, that variable is captured using a hidden this-pointer. But this capturing is always by reference. Example: int i = 1; auto dg = (){ writefln("%s", i); }; i = 2; dg(); //

Re: newCTFE Status August 2017

2017-08-05 Thread Stefan Koch via Digitalmars-d
On Tuesday, 1 August 2017 at 21:27:32 UTC, Stefan Koch wrote: [ ... ] After a surprisingly small amount of work we are now supporting pointers to array-items. It should be quite doable to add bounds-checked pointer with minimal amount of work. (Note this is only for 1D arrays/Slices ...

Re: Getting enum from value

2017-08-05 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 5 August 2017 at 15:33:57 UTC, Matthew Remmel wrote: I feel like I'm missing something, but there has to be an easier way to convert a value into an enum than switching over every possible value: i.e [...] What you want is already in the standard library. std.conv.to can

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