Re: Why is the following failing?

2024-01-25 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote: ```D void main() { char[32] id = 0; id = "hello"; } ``` this works fine, and that is what i expect for the example above.. Raise a bug, I'll fix it.

Re: ImportC: Windows.h

2023-12-02 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 2 December 2023 at 05:16:43 UTC, name wrote: Minimum thing to reproduce bug: main.d: ```d import test; void main() { auto a = FILE_MAP_READ; } ``` test.c ```c #define SECTION_MAP_READ 0x0004 #define FILE_MAP_READ SECTION_MAP_READ ``` build with

Re: DConf '23 Talk Videos

2023-09-20 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 20 September 2023 at 00:35:47 UTC, Mike Parker wrote: On Sunday, 17 September 2023 at 15:35:59 UTC, FeepingCreature wrote: Thank you for your work! You're welcome! Unfortunately, last night my GPU started to consistently overheat and shut down when doing anything graphics

Re: DIP1044---"Enum Type Inference"---Formal Assessment

2023-04-26 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 26 April 2023 at 01:39:14 UTC, Walter Bright wrote: On 4/25/2023 1:15 PM, ryuukk_ wrote: Or perhaps, listen to this person: https://github.com/dlang/dmd/pull/14650 That only does a subset of the proposal. The inference only works in specific cases. Things like function

Re: Pure D frontend as library.

2022-12-27 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 27 December 2022 at 12:22:45 UTC, Johan wrote: does semantic analysis (create AST; note that there is a ton of calls needed to complete SeMa), and finally outputs object code. If you want to capitalize the word use SemA. ;)

Re: Thinking about the difference between fixed and 'dynamic' arrays.

2022-12-05 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 4 December 2022 at 09:54:53 UTC, Salih Dincer wrote: Recently DIP1044 was published about enum and although we can use `with()` instead we waste time unnecessarily... With cannot be used in calls. Hence when calling a function you need to either spell out the enum type or wrap the

Re: Does D programming language have work steal queue?

2022-05-22 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 22 May 2022 at 23:35:11 UTC, mw wrote: On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote: On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I have one called

Re: Does D programming language have work steal queue?

2022-05-22 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote: Does D language have task steal queue? The requirements are high-performance, lock-free, and thread-safe. I have one called fluffy: https://github.com/UplinkCoder/fluffy I am not 100% sure about the performance I did try to make it

Re: non-constant expression ["foo":5, "bar":10, "baz":2000]

2022-01-06 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote: On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow wrote: On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi wrote: The point is that I was trying to avoid some cycle between modules, detected by 2.072. This bug

Re: Cannot compile C file using ImportC

2021-11-09 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 21:03:20 UTC, Steven Schveighoffer wrote: On 11/9/21 3:05 PM, Stefan Koch wrote: Yes it is valid C. It is not valid D though. The file is named `tomld.c` The way importC works is, you pass a .c file to the compiler, and it treats it as C. -Steve It

Re: Cannot compile C file using ImportC

2021-11-09 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 19:53:48 UTC, Steven Schveighoffer wrote: On 11/9/21 2:34 PM, Stefan Koch wrote: On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote: [...] What's happening here is that dmd seems to see `free` as function rather than a pointer to a function. changing

Re: Cannot compile C file using ImportC

2021-11-09 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote: ``` toml.c(39): Error: cannot implicitly convert expression `malloc` of type `extern (C) void*(ulong __size)` to `extern (C) void* function(ulong)` toml.c(40): Error: cannot implicitly convert expression `free` of type `extern (C)

Re: What is the meaning of @future ?

2021-09-16 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: Hello D community. I was browsing the `__traits` keywords and I found `isFuture` whose descriptions says something about `@future`-annotated variables. [link](https://dlang.org/spec/traits.html#isFuture) I didn't find anything

Re: A little help with Ranges

2021-08-26 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 August 2021 at 02:17:21 UTC, Merlin Diavova wrote: On Friday, 27 August 2021 at 02:10:48 UTC, Stefan Koch wrote: On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova wrote: Hi all, I'm Merlin, I'm just starting out in D and super excited. My questions are:- 1. In a range

Re: A little help with Ranges

2021-08-26 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova wrote: Hi all, I'm Merlin, I'm just starting out in D and super excited. My questions are:- 1. In a range pipeline how does one handle the event of a filter range returning empty? 2. How does one unwrap a single result from a range

Re: Looping over Template Types ... possible?

2021-08-14 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 14 August 2021 at 20:07:21 UTC, james.p.leblanc wrote: Good Evening/Day, Suppose I have a number of function templates that each take two types, say S and T. I would like to exercise my routines over the combinations of types: set of all S: ( double[], float[], Complex!double[],

Re: No compile time bounds checking for static arrays?

2021-08-11 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 06:29:40 UTC, Tejas wrote: ```d import std; void main() { int[40] staticA; auto c = staticA[0..50];//mistake }``` results in: ```d core.exception.RangeError@onlineapp.d(5): Range violation ??:? _d_arrayboundsp [0x55db29a0b645]

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote: On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote: but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html That's what he

Re: __FILE__

2021-07-26 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 26 July 2021 at 12:01:23 UTC, Adam D Ruppe wrote: On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote: __FILE__[0..$] Why do you have that [0..$] there? It is probably breaking the __FILE__ magic. Correct. The compiler has to evaluate the default argument as constant

Re: Performance issue with fiber

2021-07-24 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote: Hi, I'm new to D lang and encounter some performance issues with fiber, not sure if there's something obviously wrong with my code. There is your problem. auto scheduler = new FiberScheduler; The Fiber scheduler will spawn

Re: Are D classes proper reference types?

2021-06-24 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocate a class *instance* on the stack for you, but `c` is still a

Re: How to profile compile times of a source code?

2021-01-30 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: this special version of dmd will generate a trace file which can be read with the included printTraceHeader tool you will want to take a look at the PhaseHist command which shows you the compiler phase that took the most time.

Re: How to profile compile times of a source code?

2021-01-30 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: I'm looking for ways to figure out what parts of the code slows down the compiler other than brute force trial. Can I use -vtemplates switch for this? Would -v (verbose) switch helpful in some way? How would I know if my

Re: Where is pragma Declaration in the grammar?

2020-12-04 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote: On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote: Hi, today I've been dusting my SDC fork and implemented a rudimentary version of pragma(msg). I could pragmaStatement as in void f() { pragma(msg,

Where is pragma Declaration in the grammar?

2020-12-04 Thread Stefan Koch via Digitalmars-d-learn
Hi, today I've been dusting my SDC fork and implemented a rudimentary version of pragma(msg). I could pragmaStatement as in void f() { pragma(msg, typeof(f)); } but not a declaration as in pragma(msg, typeof(f)) without a function body. there is a StaticAssert is in the grammar under

Re: lambdas with types

2020-11-21 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 20 November 2020 at 14:08:23 UTC, jmh530 wrote: Doing something like below fails because I don't seem to be able to make a templated lambda that just takes types. Is the only way to do something similar to create a separate function to handle the condition, or is there some other

Re: is type checking in D undecidable?

2020-10-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad wrote: In general, it is hard to tell if a computation is long-running or unsolvable. You could even say ... it's undecidable :)

Re: Deprecation in traits

2020-09-30 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 30 September 2020 at 08:33:58 UTC, Frak wrote: On Tuesday, 29 September 2020 at 18:25:03 UTC, Steven Schveighoffer wrote: On 9/29/20 1:08 PM, Frak wrote: [...] Because it's probably coming from a constraint, you probably can't figure out the exact usage. What's more annoying

Re: Beta 2.094.0

2020-09-15 Thread Stefan Koch via Digitalmars-d-announce
On Sunday, 13 September 2020 at 17:51:49 UTC, Steven Schveighoffer wrote: On 9/13/20 1:25 PM, MrSmith wrote: On Sunday, 13 September 2020 at 15:12:00 UTC, Steven Schveighoffer wrote: The first part of the change seems disruptive. If you just fix the second part (that you can now retrieve all

Re: Symmetry Investments and the D Language Foundation are Hiring

2020-09-01 Thread Stefan Koch via Digitalmars-d-announce
On Tuesday, 1 September 2020 at 13:30:33 UTC, Stefan Koch wrote: On Tuesday, 1 September 2020 at 13:28:07 UTC, Steven Schveighoffer wrote: On 9/1/20 5:38 AM, Stefan Koch wrote: On Tuesday, 1 September 2020 at 09:09:36 UTC, Jacob Carlborg wrote: BTW, is timestamps vs SHA-1 hashing really the

Re: Symmetry Investments and the D Language Foundation are Hiring

2020-09-01 Thread Stefan Koch via Digitalmars-d-announce
On Tuesday, 1 September 2020 at 13:28:07 UTC, Steven Schveighoffer wrote: On 9/1/20 5:38 AM, Stefan Koch wrote: On Tuesday, 1 September 2020 at 09:09:36 UTC, Jacob Carlborg wrote: BTW, is timestamps vs SHA-1 hashing really the most pressing issue with Dub? We think that not recompiling

Re: Symmetry Investments and the D Language Foundation are Hiring

2020-09-01 Thread Stefan Koch via Digitalmars-d-announce
On Tuesday, 1 September 2020 at 09:09:36 UTC, Jacob Carlborg wrote: On Sunday, 30 August 2020 at 14:13:36 UTC, Mike Parker wrote: Looking for a full-time or part-time gig? Not only is Symmetry Investments hiring D programmers, they are also generously funding two positions for ecosystem work

Re: Where are the DConf Online Submissions?

2020-08-29 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 29 August 2020 at 10:30:50 UTC, Mike Parker wrote: In my experience with DConf and SAOC, a number of submissions/applications come in on the last day, but I usually receive a some before then. So far, I haven't seen a single submission for DConf Online. If need be, I will extend

__traits for checking if a type is dynamic array (slice)

2020-08-18 Thread Stefan Koch via Digitalmars-d-learn
https://forum.dlang.org/post/ptgud7$16f6$1...@digitalmars.com On Monday, 26 November 2018 at 14:02:15 UTC, Andrei Alexandrescu wrote: On 11/26/18 4:04 AM, Per Nordlöw wrote: Why is there no - __traits(isArray, T) alongside - __traits(isStaticArray, T) and - __traits(isAssociativeArray, T)

Re: Forcing inline functions (again) - groan

2020-07-15 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote: I recently noticed pragma(inline, true) which looks extremely useful. A couple of questions : 1. Is this cross-compiler compatible? 2. Can I declare a function in one module and have it _inlined_ in another module at the call

Re: Should a parser type be a struct or class?

2020-06-17 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote: Should a range-compliant aggregate type realizing a parser be encoded as a struct or class? In dmd `Lexer` and `Parser` are both classes. In general how should I reason about whether an aggregate type should be encoded as a

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:54:27 UTC, 12345swordy wrote: On Monday, 15 June 2020 at 20:51:38 UTC, Stefan Koch wrote: On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote: On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy

Re: tardy v0.0.1 - Runtime polymorphism without inheritance

2020-06-15 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 15 June 2020 at 20:47:16 UTC, 12345swordy wrote: On Saturday, 13 June 2020 at 15:11:49 UTC, Atila Neves wrote: https://code.dlang.org/packages/tardy https://github.com/atilaneves/tardy [...] Wouldn't a top type be a better way to achieve this? -Alex the Talias in type functions

Re: Why is there no range iteration with index by the language?

2020-06-09 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing and [...] I don't think there is any particular reason. Other than that might shadow an opApply. And C++ iterators didn't have it.

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-04 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 4 June 2020 at 14:20:45 UTC, Q. Schroll wrote: On Thursday, 4 June 2020 at 09:03:40 UTC, Simen Kjærås wrote: string exists(string s) { return "__traits(compiles, { mixin(\"alias _ = "~s~";\"); })"; } Little nitpicking, but D has many forms of string literals. Escaping is

Re: This Right In: PLDI 2020 will take place online and registration is FREE. Closes on Jun 5, so hurry!

2020-06-04 Thread Stefan Koch via Digitalmars-d-announce
On Thursday, 4 June 2020 at 12:46:51 UTC, Andrei Alexandrescu wrote: PLDI (Programming Language Design and Implementation) is a top academic conference. This year PLDI will be held online and registration is free. This is an amazing treat. https://conf.researchr.org/home/pldi-2020 Workshops

Re: Fastest way to check using if identifier has already been defined, using static if or similar?

2020-06-03 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote: On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote: [...] You can use this template: enum Exists(alias T) = is(typeof(T)); I don't know if there's a faster way bu this technic is used, notatbly in phobos, to workaroud

Re: DIP1028 - Rationale for accepting as is

2020-05-27 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 27 May 2020 at 10:06:41 UTC, rikki cattermole wrote: On 27/05/2020 10:03 PM, Walter Bright wrote: Frankly, I feel that if I could sit down with you folks, I can get the idea across what I'm trying to accomplish. Okay, how is your camera and mic situation? Lets do a Twitch

Re: DIP1028 - Rationale for accepting as is

2020-05-24 Thread Stefan Koch via Digitalmars-d-announce
On Sunday, 24 May 2020 at 09:47:37 UTC, Walter Bright wrote: On 5/24/2020 2:29 AM, Panke wrote: I've always understood that the @safe,@trusted,@system machinery provides the following guarantee once all holes are fixed: If I have a memory corruption in my code than I need to only look at

Re: Compilation memory use

2020-05-04 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 4 May 2020 at 17:00:21 UTC, Anonymouse wrote: TL;DR: Is there a way to tell what module or other section of a codebase is eating memory when compiling? I'm keeping track of compilation memory use using zsh `time` with some environmental variables. It typically looks like this.

Re: dmdcache

2020-04-25 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 25 April 2020 at 10:17:50 UTC, Ali Çehreli wrote: A colleague of mine has written dmdcache which may be very useful for some projects: https://github.com/seeraven/dmdcache It drops our build time from 8 minutes to 45 seconds on a particular build environment for about

Re: describe-d: an introspection library

2020-04-22 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 22 April 2020 at 17:27:48 UTC, Jean-Louis Leroy wrote: On Wednesday, 22 April 2020 at 17:16:28 UTC, Stefan Koch wrote: I am working on a much more powerful and efficient meta programming system. Great! Is it going to be in a library, or part of the compiler? Can we get a

Re: describe-d: an introspection library

2020-04-22 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 22 April 2020 at 13:32:03 UTC, Jean-Louis Leroy wrote: I tried compiling my example with `dmd -vcg-ast -c tmt.d` and I did got neither an AST nor an error, and the option is not in `dmd -h`, where can I read about it? -vcg-ast is a debugging tool I original built to fix an bug

Re: describe-d: an introspection library

2020-04-21 Thread Stefan Koch via Digitalmars-d-announce
On Tuesday, 21 April 2020 at 14:43:04 UTC, Jean-Louis Leroy wrote: I wonder if templates are lazily expanded. I haven't looked at the compiler's code, my guess is: maybe not. If the template gets used it gets instantiated (and cached). if not than not. you can use the -vcg-ast switch to look

Re: odd atomicOp errors from vibe-core

2020-04-09 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer wrote: I'm building a library that uses vibe-core as an indirect dependency. Specifically, I'm testing the library with dub test. [...] Those are signed unsigned mismatches when it tries to lock. that's probably in vibe-d

Re: How do I disable the multithreaded GC?

2020-04-09 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 9 April 2020 at 20:56:59 UTC, Johan wrote: On Thursday, 9 April 2020 at 20:42:18 UTC, Stefan Koch wrote: Simple question, how do I keep the GC from spawning threads? Cheers, Stefan https://dlang.org/changelog/2.087.0.html#gc_parallel Thanks a lot.

How do I disable the multithreaded GC?

2020-04-09 Thread Stefan Koch via Digitalmars-d-learn
Simple question, how do I keep the GC from spawning threads? Cheers, Stefan

Re: Fixing race issues the right way

2020-04-05 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 5 April 2020 at 22:24:27 UTC, solidstate1991 wrote: My game engine is currently broken due to some race issue I don't really know how to resolve. It seems that the compiler tries to skip instructions that are not locked with a `writeln()` or something similar. Usually I can safely

Re: Find the heir.

2020-03-29 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 29 March 2020 at 14:04:53 UTC, TodNaz wrote: Hello! class A { ... } class B : A { ... } class C : A { ... } A example1; B example2 = new B(...); A = example2; auto heir = A.whoheir(); /// The question in this code is: is it possible to track the class inheritor? Or is

Re: Our HOPL IV submission has been accepted!

2020-03-03 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 2 March 2020 at 21:39:01 UTC, Murilo wrote: On Saturday, 29 February 2020 at 01:00:40 UTC, Andrei Alexandrescu wrote: [...] Hi Mr. Andrei, I've searched the official website of HOPL but I didn't find the cost of the ticket to attend it. Do you know if there is a cost at all or if

Re: Strange counter-performance in an alternative `decimalLength9` function

2020-02-26 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote: So after reading the translation of RYU I was interested too see if the decimalLength() function can be written to be faster, as it cascades up to 8 CMP. [...] It can be made faster using binary search. Not by much though.

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 22 February 2020 at 12:24:56 UTC, drathier wrote: On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote: On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: Is there a dmd flag that shows the code after template instantiations has been performed? The -vcg-ast

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: We're looking for a way to speed up compilation of template-heavy code. So we are trying to find out which parts of the code that is most costly to compile. Is there a dmd flag that shows the code after template instantiations

Re: betterC CTFE nested switch

2020-02-21 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 21 February 2020 at 09:03:26 UTC, Abby wrote: On Monday, 17 February 2020 at 19:02:50 UTC, Stefan Koch wrote: Sorry I just realized I never published the code. I am going to add it to ctfeutils. Hi Stefan, I'm sorry to bother you, I just wanted to kindly ask if you would upload

Re: How to get the name of an object's class at compile time?

2020-02-18 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 18 February 2020 at 03:33:21 UTC, Basile B. wrote: On Monday, 17 February 2020 at 22:34:31 UTC, Stefan Koch wrote: Upon seeing this I just implemented typeid(stuff).name; https://github.com/dlang/dmd/pull/10796 With any luck this will be possible in the next release ;) Can this

Re: How to get the name of an object's class at compile time?

2020-02-17 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 17 February 2020 at 18:49:55 UTC, Steven Schveighoffer wrote: On 2/17/20 2:28 AM, Nathan S. wrote: What I want is something like this: string className(in Object obj) {     return obj is null ? "null" : typeid(obj).name; } ...except I want it to work in CTFE. What is the

Re: betterC CTFE nested switch

2020-02-17 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 17 February 2020 at 11:51:03 UTC, Abby wrote: On Monday, 17 February 2020 at 11:05:46 UTC, Stefan Koch wrote: On Monday, 17 February 2020 at 10:18:32 UTC, Abby wrote: [...] I have a ctfe compatible string formatter, you should be to find it here

Re: betterC CTFE nested switch

2020-02-17 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 17 February 2020 at 10:18:32 UTC, Abby wrote: Hi there guys, I was trying to generated code during compile time. Bassicly I'm creating a tokenizer and I would like to generated nested switch using betterC. [...] I have a ctfe compatible string formatter, you should be to find

Re: "register int n" alternative

2020-02-16 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 16 February 2020 at 13:48:43 UTC, Виталий Фадеев wrote: Possible mark variable for force use register ? Example C-code: { register char *buf; long pos; register int n; register int r; if (!n) return 0; } How to implement in D ? Don't you

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote: Hello, When trying to pass a D function to the C callback, the compiler says: 'Error: cannot implicitly convert expression of type extern (C) bool delegate(const(short*) a, ulong b, void* c) to extern (C) bool

Re: Eliding of slice range checking

2019-10-25 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 23 October 2019 at 12:01:47 UTC, Per Nordlöw wrote: On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote: For your example, the template is inferred to be @safe, and `-release` only elides bounds checks in @system functions (corresponding to `-boundscheck=safeonly`). Use

Re: x64 ABI

2019-10-14 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 14 October 2019 at 16:02:28 UTC, Marcel wrote: It appears that the ABI specification only describes the register convention for x86. Where can I find which registers get preserved across function calls for 64-bit targets? It's the same as c++.

Re: initialize float4 (core.simd)

2019-09-21 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 21 September 2019 at 13:42:09 UTC, Bogdan wrote: Well, this seems to be working: float[4] doSimd(float[4] values, float delta) { float4 v_delta = delta; float4 v_values = __simd(XMM.ADDPS, __simd(XMM.LODAPS, values[0]),

Re: Why are extern(C/C++) definitions and references mangled differently in separately compiled modules?

2019-09-06 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote: Consider the following two modules: 1. test.d: module test; import lib.a; void main() { foo(); } 2. lib/a.d: module lib.a; extern(C) void foo() {} When compiled separately (dmd -c lib/a.d; dmd test.d a.o), the

Re: Going on holiday for the next 3 weeks...

2019-09-04 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 4 September 2019 at 15:18:15 UTC, Atila Neves wrote: ... So not going to be available until I'm back. Have fun and relax! Happy holidays!

Re: D1 code to D2I

2019-08-22 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 22 August 2019 at 18:10:51 UTC, jicman wrote: Greetings! Is there any tool out there, I searched around and didn't find any, that would take ton of D1 code and convert it to D2? Thanks. josé There is: https://github.com/sociomantic-tsunami/d1to2fix It might be please ask

Re: Slow UDF call?

2019-08-17 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 17 August 2019 at 19:43:22 UTC, Giovanni Di Maria wrote: Hi, i have seen that a simple operation (in a loop) is faster than the equivalent UDF. The first example takes 4 seconds, the second example takes 16 seconds. Local variables influence the speed of execution? Thank you very

Re: Manipulating alias sequences

2019-07-15 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 15 July 2019 at 13:40:29 UTC, Ben Ogles wrote: I have written a simple function that can call another function over integral types with random arguments: [...] You cannot. meta-programming and compile-time evaluation are supposed to be deterministic, and hence cannot take random

Re: Windows segfault, need brief help

2019-07-12 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 12 July 2019 at 22:46:11 UTC, Anonymouse wrote: I'm suddenly getting segfaults when running tests on Windows. It works fine on Linux. I reduced it to a few lines (plus a dependency) with dustmite, but they don't really make sense[1]. Nevertheless they do trigger the segfault. Can

Re: Munich D Meetup July 2019

2019-07-08 Thread Stefan Koch via Digitalmars-d-announce
On Sunday, 7 July 2019 at 19:45:28 UTC, Stefan wrote: Join us in July for our next event. Last event before the summer break. We will have a look at the GSoC projects, recent DIPs and after that play around with the D Jupyter Notebook Kernel.

Re: Does -profile need the D runtime?

2019-05-18 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 18 May 2019 at 16:35:44 UTC, Robert M. Münch wrote: I want to profile my windows app which has a WinMain(). One of the first statements in WinMain() within a try{} is: Runtime.initialize(); But when I compile my app with -profile, it crashes on entry of WinMain(). Looks like

Re: Creating a RedBlackTree

2019-05-15 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 15 May 2019 at 13:08:18 UTC, Bogdan wrote: I don't have any experience with using templates. Is it possible to create a RB tree containing structs, where the nodes are ordered by one struct member? ``` import std.stdio; import std.container; enum KeyID: uint { KEY_A,

Re: CTFE in imported static initializers

2019-05-14 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 14 May 2019 at 08:26:41 UTC, Steven Schveighoffer wrote: On 5/13/19 9:39 PM, Steven Schveighoffer wrote: Does anyone have a good answer for why this should happen, or should I file a bug? It's been mentioned to me that type inference is used here. However, one could argue that

Re: CTFE sort of tuples

2019-05-02 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote: Hello, I have got this code: [...] I want to sort array of tuples using "data" element in CTFE. But this code give me errors: [...] As I understand the function "sort" sometimes can't be run at CT because of reinterpreting cast.

Re: alias fails to compile

2019-04-22 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran wrote: What am I doing wrong here? struct A { union B { int bb; } B b; alias aa = B.bb; } void main() { A a = A(); // a.b.bb = 4; // works a.aa = 4; // fails } https://run.dlang.io/is/kXaVy2

Re: Poor regex performance?

2019-04-04 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote: On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole wrote: If you need performance use ldc not dmd (assumed). LLVM has many factors better code optimizes than dmd does. Thanks! I already had dmd installed from a brief look at D

Re: Build an alias array

2019-04-02 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 03:15:36 UTC, Alex wrote: Is there any way to build an alias array at compile time that isn't too heavy in resources? {...} Hi Alex, I agree that there should be a way to do that. As soon as newCTFE is a releasable state, I'll work on that again :) I'd be

Re: Darser: A LL(1) to Recursive Decent Parser/AST/Visitor Generator

2019-03-20 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 20 March 2019 at 17:22:07 UTC, Robert Schadek wrote: https://code.dlang.org/packages/darser https://github.com/burner/Darser Have you had a look at fancypars? if not you might want to look at the lexer_generation of it. And the way it represents the grammar.

Re: DLP - D Language Processing 0.1.0

2019-03-20 Thread Stefan Koch via Digitalmars-d-announce
On Monday, 18 March 2019 at 18:52:10 UTC, Jacob Carlborg wrote: Currently it has only one command, "leaf-functions", that will print all leaf functions. A leaf function is a function that doesn't call any other functions or doesn't have a body. Functions without bodies cannot be considered

Re: How is your DConf proposal looking?

2019-03-08 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 8 March 2019 at 18:53:27 UTC, Ali Çehreli wrote: On 03/08/2019 02:18 AM, Bastiaan Veelo wrote: On Thursday, 7 March 2019 at 16:57:11 UTC, Ali Çehreli wrote: Reminder... :)   http://dconf.org/2019/index.html Ali It's shaping up :-) Bastiaan. Great! :) I've decided to submit a

Re: dlang tutorial just posted on Derek Banas's YouTube channel

2019-03-06 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 6 March 2019 at 01:44:45 UTC, Zaydek wrote: tl;dr Derek Banas is a YouTuber that makes long-form programming tutorials. He has almost one million subscribers. He just posted a 90-minute tutorial that covers D beginning to end. This could be great promotional for this community to

Re: Why is my @pure function @system when placed in a struct?

2019-02-27 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote: I have a template function `fImpl` I whish to instantiate manually using the new name `f`. Reason is simple: `f` should not be a template, but overloading it makes it easier that way. Nothing's more simple in D: [...] the

Re: progress-dmd: compilation with a progress bar

2019-02-23 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 22 February 2019 at 08:36:24 UTC, FeepingCreature wrote: https://gist.github.com/FeepingCreature/6c67479c99bc0f20544d1e455622ae82 Usage: DMD= progress-dmd The script sets -v and then uses the code and semantic stages logged in the output to paint a cute little ANSI-colored

Re: How does Rebindable suppress the compiler's optimizations for immutable?

2019-02-14 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 14 February 2019 at 23:55:18 UTC, SimonN wrote: std.typecons.Rebindable!(immutable A) is implemented as: private union { immutable(A) original; A stripped; } ...@trusted assignment operators... @property inout(immutable(A)) get() @trusted pure

Re: How to ensure string compatibility In D?

2019-01-22 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 22 January 2019 at 16:47:45 UTC, FrankLike wrote: On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe wrote: Use "mystring"w, notice the w after the closing quote. Or toStringz is not work like c_str() in C++? stringz creates a char* but you need a wchar*

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-18 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 18 January 2019 at 20:32:35 UTC, Jacob Carlborg wrote: On 2019-01-18 20:28, Stefan Koch wrote: The only difference that type-functions have from what you describe is that it does not need to occupy a keyword 'type'. You're using "alias" instead of my "type" keyword? yes. After

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-18 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 18 January 2019 at 10:23:11 UTC, Jacob Carlborg wrote: On 2019-01-17 23:44, H. S. Teoh wrote: YES! This is the way it should be. Type-tuples become first class citizens, and you can pass them around to functions and return them from functions No no no, not only type-tuples, you

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-17 Thread Stefan Koch via Digitalmars-d-announce
On Thursday, 17 January 2019 at 22:44:08 UTC, H. S. Teoh wrote: On Thu, Jan 17, 2019 at 10:20:24PM +, Stefan Koch via Digitalmars-d-announce wrote: P.S. There is one caveat: because of how type-functions work they cannot, you cannot create a non-anonymous symbol inside a type-function

Re: B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)

2019-01-17 Thread Stefan Koch via Digitalmars-d-announce
On Thursday, 17 January 2019 at 19:31:24 UTC, H. S. Teoh wrote: On Thu, Jan 17, 2019 at 06:03:07PM +, Paul Backus via Digitalmars-d-announce wrote: [...] [2] https://bartoszmilewski.com/2009/10/21/what-does-haskell-have-to-do-with-c/ [...] Coming back to the D example at the end, I

Re: Pass reference to void*

2019-01-09 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 7 January 2019 at 13:15:44 UTC, Andre Pany wrote: On Monday, 7 January 2019 at 13:01:57 UTC, Stefan Koch wrote: On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote: [...] From the function declaration seems to be the correct thing to use here. Have you checked that Open

Re: Pass reference to void*

2019-01-07 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote: Hi, I call a C function from a dll (SO on linux). While the following code works fine for DMD on windows, there are strange errors for LDC on windows. Also the equivalent code does not work for DMD/LDC on linux. (When calling other

Re: Converting an integer to a string with std.format.

2019-01-07 Thread Stefan Koch via Digitalmars-d-learn
On Sunday, 6 January 2019 at 21:53:31 UTC, Per Nordlöw wrote: When converting a single integer to a string is `formatValue` preferred over `formattedWrite` in terms of compilation and run-time performance? I've written my own itos function because using std.conv was too expensive. see

Re: Compile time opAssign/@property constraints

2019-01-04 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 4 January 2019 at 11:45:24 UTC, Jacob Shtokolov wrote: On Friday, 4 January 2019 at 10:34:07 UTC, Basile.B wrote: Show us some code. Here is the simple example: https://run.dlang.io/gist/1a06dd703bea5548ee72b4713a7ce5f6 The thing I'm trying to do is to make an experimental port

Re: The New Fundraising Campaign

2019-01-02 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 2 January 2019 at 15:17:36 UTC, Martin Tschierschke wrote: On Wednesday, 2 January 2019 at 11:11:31 UTC, Stefan Koch wrote: On Wednesday, 2 January 2019 at 10:16:11 UTC, Martin Tschierschke wrote: I would love to have a campaign to increase compilation speed for std.regex and

Re: The New Fundraising Campaign

2019-01-02 Thread Stefan Koch via Digitalmars-d-announce
On Wednesday, 2 January 2019 at 10:16:11 UTC, Martin Tschierschke wrote: I would love to have a campaign to increase compilation speed for std.regex and std.format... You could defer the generation of utf-tables to runtime, which should yield some improvement. But I'll measure the reasons

  1   2   3   4   5   6   7   8   9   10   >