Re: DUB Error with packcage dformlib

2021-04-18 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 18 April 2021 at 01:37:14 UTC, Marcone wrote: I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2> Just a comment, dforms is millions of years old. It would be nice to see support for it again,

Re: How do I create classes dynamically?

2021-04-16 Thread Imperatorn via Digitalmars-d-learn
On Friday, 16 April 2021 at 18:42:35 UTC, Kagamin wrote: On Friday, 16 April 2021 at 08:31:27 UTC, Imperatorn wrote: One example would be a repl That has little to do with what OP meant. I didn't answer to that though

Re: How do I create classes dynamically?

2021-04-16 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 15 April 2021 at 22:06:23 UTC, Jack wrote: On Thursday, 15 April 2021 at 17:48:02 UTC, Imperatorn wrote: On Thursday, 15 April 2021 at 16:39:30 UTC, Kagamin wrote: On Wednesday, 14 April 2021 at 20:38:16 UTC, Mario wrote: [...] String mixins is D replacement of macros for code

Re: How do I create classes dynamically?

2021-04-15 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 15 April 2021 at 16:39:30 UTC, Kagamin wrote: On Wednesday, 14 April 2021 at 20:38:16 UTC, Mario wrote: Maybe I am just too short in D, but I wanted to find out if it is possible to create classes dynamically. My problem is, I just don't know where to start reading. Maybe at mixin

Re: How do I create classes dynamically?

2021-04-15 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 14 April 2021 at 20:38:16 UTC, Mario wrote: Maybe I am just too short in D, but I wanted to find out if it is possible to create classes dynamically. My problem is, I just don't know where to start reading. Maybe at mixin templates? CreateClassWithName!("MyDynamicClassName");

Re: GC memory fragmentation

2021-04-14 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 14 April 2021 at 12:47:22 UTC, Heromyth wrote: On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote: Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. The Hunt

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 19:19:12 UTC, kdevel wrote: On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] [...] D can be so much fun! ```d import std.stdio; [...] Of course :D

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:01:02 UTC, kdevel wrote: On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] [...] Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i

Re: GC memory fragmentation

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote: Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. [...] Looks like the GC needs some love

Re: Is there a more elegant way to do this in D?

2021-04-09 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 8 April 2021 at 22:27:38 UTC, Alain De Vos wrote: So which concrete types do you give for the two auto's. Like Paul said. But if you really wanted to type it out: a is int[], conv is ubyte[] and the map is lazy, so add .array and it evaluates to char[]

Re: Is there a more elegant way to do this in D?

2021-04-08 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 8 April 2021 at 22:02:47 UTC, Alain De Vos wrote: I resume in the 4 ways presented, import std; void main(){ auto a=[1,0,1,1,1,0,1,0,1,1,1,0]; string s = format!"%-(%s%)"(a); writeln(s); dchar[12] b = a.map!(to!string).joiner.array;

Re: Gui toolkits alive and gui toolkits dead

2021-04-08 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 7 April 2021 at 13:00:37 UTC, Alain De Vos wrote: I meant dlang bindings. Is the binding dead or alive, Schrödinger's binding. Who knows...

Re: templated overload of opAssign

2021-04-05 Thread Imperatorn via Digitalmars-d-learn
On Monday, 5 April 2021 at 15:05:24 UTC, kdevel wrote: On Sunday, 4 April 2021 at 18:05:04 UTC, tsbockman wrote: ``` [...] [...] [...] [...] ``` [...] Nice, is this documented somewhere? 樂 Maybe we could add a better error message or smth.

Re: Is dlang.slack.com down?

2021-04-04 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 4 April 2021 at 11:12:36 UTC, Per Nordlöw wrote: Trying to access https://dlang.slack.com/ hangs for minutes on my machine. I'm only using the app, same thing there for you? 樂

Re: Vibe.d tutorial

2021-04-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 4 March 2021 at 13:47:11 UTC, Imperatorn wrote: On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: Hi, I wrote a tutorial on Vibe.d while trying to re-learn Vibe.d. I find that most of Kai Nacke's book need updating, so I wrote a tutorial while trying to re-learn it.

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 21:13:18 UTC, H. S. Teoh wrote: On Thu, Apr 01, 2021 at 01:17:15PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: [...] [...] [...] Right, but in a typical program it's unpredictable whether there will be unused pages after the array. [...] [...]

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 19:00:08 UTC, Berni44 wrote: On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I was hoping to beat my dear Python and get similar results to Go, but that is not the case neither using rdmd nor running the executable generated by dmd. I am getting values

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 17:30:15 UTC, Chris Piker wrote: On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I was hoping to beat my dear Python and get similar results to Go, but that is not the case neither using rdmd nor running the executable generated by dmd. I am getting values

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 17:30:15 UTC, Chris Piker wrote: On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I was hoping to beat my dear Python and get similar results to Go, but that is not the case neither using rdmd nor running the executable generated by dmd. I am getting values

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I am a python programmer and I am enjoying Dlang and learning some programming insights on the way, thank everyone. I have no formal education and also program JS and PHP. Watching a video where a guy programs some simple code in

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I am a python programmer and I am enjoying Dlang and learning some programming insights on the way, thank everyone. [...] Could you also post the python code for comparison?

Re: Need for speed

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 1 April 2021 at 17:16:06 UTC, Imperatorn wrote: On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I am a python programmer and I am enjoying Dlang and learning some programming insights on the way, thank everyone. [...] Could you also post the python code for comparison?

Re: Static array initialisation

2021-04-01 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did: immutable uint MemSize=100; // Memory size in bytes. // Memory Pool ubyte[MemSize] MemPool = 8; And had a look in memory. I think the compiler set up 101 '8's, not 100 in memory. Which I did not expect. Best

Re: Static array initialisation

2021-03-31 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did: immutable uint MemSize=100; // Memory size in bytes. // Memory Pool ubyte[MemSize] MemPool = 8; And had a look in memory. I think the compiler set up 101 '8's, not 100 in memory. Which I did not expect. Best

Re: How to parse JSON in D?

2021-03-30 Thread Imperatorn via Digitalmars-d-learn
On Monday, 29 March 2021 at 18:19:35 UTC, Steven Schveighoffer wrote: On 3/29/21 1:48 PM, Imperatorn wrote: On Monday, 29 March 2021 at 17:21:25 UTC, tastyminerals wrote: [...] https://youtu.be/un-bZdyumog?t=27m25s FYI that package is here: https://code.dlang.org/packages/jsoniopipe I

Re: How to parse JSON in D?

2021-03-29 Thread Imperatorn via Digitalmars-d-learn
On Monday, 29 March 2021 at 17:21:25 UTC, tastyminerals wrote: We need to parse a bunch of JSON files. What does D have? It has std.json which is strangely slower than Python json :( Ok, we go to dub repository and search for something that is faster. There are basically two implementations

Re: How to parse JSON in D?

2021-03-29 Thread Imperatorn via Digitalmars-d-learn
On Monday, 29 March 2021 at 17:21:25 UTC, tastyminerals wrote: We need to parse a bunch of JSON files. What does D have? It has std.json which is strangely slower than Python json :( Ok, we go to dub repository and search for something that is faster. There are basically two implementations

Re: code.dlang.org package search subtly broken?

2021-03-27 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 27 March 2021 at 20:36:08 UTC, bachmeier wrote: On Saturday, 27 March 2021 at 14:53:52 UTC, Imperatorn wrote: Yeah, the search is broken sadly. I made a PR about it some time ago. Partial searches doesn't work I don't think it's Dub search that's broken, really, it's that Dub

Re: code.dlang.org package search subtly broken?

2021-03-27 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 27 March 2021 at 13:48:10 UTC, Brian wrote: Hello -- When I go to https://code.dlang.org and use the search function on the top right corner, it usually works fine. However, there was one package I knew I specifically wanted (png-d) but when I typed png-d into the search bar, I

Re: Manually check struct invariants

2021-03-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 22:22:12 UTC, Q. Schroll wrote: For a class object obj, one can use assert(obj) to get its invariants checked. How to do this for structs? It's called after the constructor has run and before the destructor is called. It's called before entering a member

Re: Strange error

2021-03-21 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 21 March 2021 at 07:18:10 UTC, Jack Applegame wrote: Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{ void function() func1; void function() func2; } void noth(Sample smpl)() { smpl.func1();

Re: rawRead from Pipe segfaults

2021-03-18 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 23:08:07 UTC, kdevel wrote: In order to watch out for lost bytes in a pipe I encountered this segfault. It seems that the readEnd is already closed when rawRead = fread is called (uncomment the eof line). [...] Have you tried "scope(exit) wait(" instead?

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: [...] Sure will, thanks for the invite to contribute in a specific way. [...] You probably already know this, just sharing:

Re: can't link a code, is it a bug or my fault?

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:41:27 UTC, rikki cattermole wrote: Try it with: -allinst It may just be deciding a template instance isn't required. The error message could maybe be changed to include this? "Try -allinst bla bla"

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 00:51:05 UTC, Vinod K Chandran wrote: On Tuesday, 16 March 2021 at 19:42:26 UTC, Imperatorn wrote: At last, i found the answer myself. There is a item called dwDrawStage in NMCUSTOMDRAW structure. If value of dwDrawStage is equal to CDDS_PREERASE, call

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 19:15:02 UTC, Vinod K Chandran wrote: On Tuesday, 16 March 2021 at 18:35:00 UTC, Imperatorn wrote: I see  Do you get CLR_INVALID in return? That results might be wrong. So i printed them in hex. These are the hex results. Set Text color result - Set

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 18:27:54 UTC, Vinod K Chandran wrote: On Tuesday, 16 March 2021 at 17:45:09 UTC, Imperatorn wrote: Omg the pain. Are you forced to use raw win api for this? Not at all. It's my hobby project. I choose raw win api. It's a fun. I see  Do you get CLR_INVALID

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 17:26:01 UTC, Vinod K Chandran wrote: Hi all, I am creating a Button class with Win32 API functions. So far so good. I am using NM_CUSTOMDRAW message to change the back color of my buttons. It's really easy to change the back color in this way. But I can't change

Re: Make foreach element optional

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 13:52:29 UTC, Per Nordlöw wrote: On Tuesday, 16 March 2021 at 13:31:34 UTC, Imperatorn wrote: foreach(0..n) could work. Why though. When performing a side-effect n times. Then why not just do: auto times(alias F, T)(T number) {    return number.iota.each!(_ =>

Re: Make foreach element optional

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 12:49:13 UTC, Per Nordlöw wrote: I find myself writing foreach (_; 0 .. n) doSomething(); // no using the variable `_` . What about relaxing the syntax to allow foreach (; 0 .. n) and/or foreach (0 .. n) ? Thereby making the `ForeachTypeList` of

Re: D in AI Field

2021-03-16 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 03:33:55 UTC, Lasheen wrote: Hello, I'm a C programmer, and now i want to migrate to D. i work in AI field, so i have some questions about D language: 1- is D suitable for mission critical systems(such as avionics systems) ? if (true){ 2- what about safety,

Re: WinUI 3

2021-03-15 Thread Imperatorn via Digitalmars-d-learn
On Monday, 15 March 2021 at 22:07:35 UTC, Siemargl wrote: On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote: Could D be used with WinUI 3? https://docs.microsoft.com/en-us/windows/apps/winui/winui3/ Would the win32metadata help? 樂 No need to going in another dead end ?

WinUI 3

2021-03-15 Thread Imperatorn via Digitalmars-d-learn
Could D be used with WinUI 3? https://docs.microsoft.com/en-us/windows/apps/winui/winui3/ Would the win32metadata help? 樂

Re: Why are enums with base type string not considered strings?

2021-03-14 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 14 March 2021 at 10:42:17 UTC, wolframw wrote: enum BoolEnum : bool { TestBool = false } enum CharEnum : char { TestChar = 'A' } enum StringEnum : string { TestString = "Hello" } pragma(msg, isBoolean!BoolEnum); // true pragma(msg, isSomeChar!CharEnum); // true

Re: Workaround to "import" an exception from a DLL

2021-03-14 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 14 March 2021 at 09:35:40 UTC, frame wrote: I know I cannot throw exceptions from a DLL, it will crash. So I currently use a wrapper that collects exceptions and pick it up if the wrapper method returns a failure state. As I know what type of exception will be thrown, I can copy

Re: Dlang spec

2021-03-13 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 13 March 2021 at 11:48:47 UTC, Bastiaan Veelo wrote: On Thursday, 11 March 2021 at 19:38:01 UTC, Imperatorn wrote: [...] The spec is written in ddoc format, and I thought that ddoc was able to output in PDF (at least at one point). It didn’t look very good and I’m not sure if

Re: Storing interfaces as void[]

2021-03-12 Thread Imperatorn via Digitalmars-d-learn
On Friday, 12 March 2021 at 17:57:06 UTC, David Zhang wrote: On Friday, 12 March 2021 at 17:46:22 UTC, Imperatorn wrote: On Friday, 12 March 2021 at 17:37:43 UTC, David Zhang wrote: [...] Have you tried using Variant or jsvar (https://code.dlang.org/packages/arsd-official%3Ajsvar)? 樂 It

Re: Storing interfaces as void[]

2021-03-12 Thread Imperatorn via Digitalmars-d-learn
On Friday, 12 March 2021 at 17:37:43 UTC, David Zhang wrote: I want to store interfaces as untyped void[], then cast them back to the interface at a later time. However, it appears to produce garbage values on get(). Is this even possible, and if so, what is happening here? The alternative

Re: Static initialization of associative arrays

2021-03-11 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 18:41:08 UTC, Ali Çehreli wrote: On 3/11/21 10:06 AM, Chris Piker wrote: >https://dlang.org/spec/hash-map.html#static_initialization > > that this feature is not yet implemented. I use a shared static this() block: immutable string[int] aa; shared static

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-11 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:00:06 UTC, David wrote: On Thursday, 11 March 2021 at 14:49:32 UTC, Imperatorn wrote: On Thursday, 11 March 2021 at 10:29:55 UTC, David wrote: On Thursday, 11 March 2021 at 08:40:58 UTC, Imperatorn wrote: On Thursday, 11 March 2021 at 08:34:48 UTC, David

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-11 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 10:29:55 UTC, David wrote: On Thursday, 11 March 2021 at 08:40:58 UTC, Imperatorn wrote: On Thursday, 11 March 2021 at 08:34:48 UTC, David wrote: I thought it would be fun to convert some old C++/C quant utils to D. I'm starting with a simple library that I call

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-11 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 08:34:48 UTC, David wrote: I thought it would be fun to convert some old C++/C quant utils to D. I'm starting with a simple library that I call from vba in Excel on macos: [...] *trigger warning* "vba in Excel on macos" ⚠️ Btw, have you looked at excel-d?

Re: Unary operators for Variants

2021-03-10 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 20:05:07 UTC, Jeff wrote: So, I can't seem to get unary operators to work with variants. For example: Variant x = 10; writeln(-x); // Error: x is not of arithmetic type, it is a VariantN!32LU Obviously binary operators like + work fine. Is there a reason opUnary

Re: Broken examples

2021-03-09 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 15:44:39 UTC, MoonlightSentinel wrote: On Saturday, 6 March 2021 at 08:15:16 UTC, Imperatorn wrote: Are you sure? 樂 I tried switching to dmd-beta, dmd-nightly, ldc and ldc-beta and none of them worked. Yes. All of those were stuck at 2.093 due to some issues

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 15:40:56 UTC, Rumbu wrote: On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: [...] Where exactly is documented the extern(D) x86-64 calling convention? Because currently seems like a mess according to the dissasembly. First X parameters on stack from

Re: Broken examples

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 09:38:54 UTC, Ali Çehreli wrote: On 3/6/21 12:15 AM, Imperatorn wrote: On Saturday, 6 March 2021 at 01:30:35 UTC, MoonlightSentinel wrote: [...] Are you sure? 樂 I tried switching to dmd-beta, dmd-nightly, ldc and ldc-beta and none of them worked. Are you

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 10:45:08 UTC, Rumbu wrote: On Friday, 5 March 2021 at 21:47:49 UTC, z wrote: [...] I just made some tests, it seems that D has invented his own calling convention. And it's not documented. If you decorate your function with extern(C) it should respect the

Re: How to get output of piped process?

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 March 2021 at 20:43:54 UTC, Danny Arends wrote: On Monday, 22 February 2021 at 14:52:22 UTC, frame wrote: On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: https://github.com/DannyArends/DaNode/blob/master/danode/process.d Danny This example shows how easy

Re: Broken examples

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 01:30:35 UTC, MoonlightSentinel wrote: On Friday, 5 March 2021 at 22:01:37 UTC, Imperatorn wrote: Any idea why? The examples are compiled using an older host compiler (__VERSION__ is 2.093) but use features introduced in a later version. This will be fixed by

Broken examples

2021-03-05 Thread Imperatorn via Digitalmars-d-learn
Basically none of the examples on here compile: https://dlang.org/library/std/conv/parse.html Any idea why?

Re: Broken examples

2021-03-05 Thread Imperatorn via Digitalmars-d-learn
On Friday, 5 March 2021 at 22:01:37 UTC, Imperatorn wrote: Basically none of the examples on here compile: https://dlang.org/library/std/conv/parse.html Any idea why? Output: onlineapp.d(10): Error: template `std.conv.parse` cannot deduce function from argument types `!(bool, string,

Re: Opaque type (struct) with a static immutable fails to compile without constructor - why?

2021-03-04 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 4 March 2021 at 15:19:16 UTC, frankp wrote: On Thursday, 4 March 2021 at 14:54:11 UTC, frankp wrote: I give up. This makes no sense. I just accept this is the work of gremlins. I revert to a plain alias and an enum. Sorry for wasting your time. Not gremlins after all. It was

Re: Vibe.d tutorial

2021-03-04 Thread Imperatorn via Digitalmars-d-learn
On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: Hi, I wrote a tutorial on Vibe.d while trying to re-learn Vibe.d. I find that most of Kai Nacke's book need updating, so I wrote a tutorial while trying to re-learn it. Here it is.

Re: Shared library module system with dub

2021-03-02 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 2 March 2021 at 00:40:06 UTC, Pillager86 wrote: What is the correct multi-platform way to build one dub project as a shared library, and load said shared library in a separate dub project? So far I am able to load a shared library and run a function from it (had to extern(C) it to

Re: tiny alternative to std library

2021-03-01 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 25 February 2021 at 22:39:11 UTC, Anthony wrote: Hello, I noticed that importing some std libraries causes the build time to jump to around 1 - 3 secs. I started creating my own helper functions to avoid importing std for scripting and prototyping in order to keep the compile

Re: DUB is not working correctly

2021-02-24 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 16:13:48 UTC, Maxim wrote: Hello, I have problems with working in dub environment. If I try to init my project with 'dub init', all needed files will be created successfully. However, when I run 'dub run', the manager gives me an error: [...] Wierd, have

Re: Memory allocation

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 19:44:39 UTC, David wrote: Not sure if `learn` is the right topic or not to post this.. I've been going through Bob Nystrom's "Crafting Interpreters" for a bit of fun and over the weekend put together a toy allocator in D - free and gc not yet done. It's single

Re: How to get output of piped process?

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Perhaps a bit late, but this is how I deal with pipes and spawnShell. Read one byte at a time from stdout and stderr:

Re: Why does this not pass

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 09:21:44 UTC, Imperatorn wrote: Why does all these pass: static assert(is(ElementEncodingType!(char[]) == char)); static assert(is(ElementEncodingType!(wstring) == immutable(wchar))); static assert(is(ElementEncodingType!(byte[]) == byte));

Why does this not pass

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
Why does all these pass: static assert(is(ElementEncodingType!(char[]) == char)); static assert(is(ElementEncodingType!(wstring) == immutable(wchar))); static assert(is(ElementEncodingType!(byte[]) == byte)); static assert(is(ElementEncodingType!(ubyte[]) == ubyte)); auto

Re: Include http based module

2021-02-20 Thread Imperatorn via Digitalmars-d-learn
On Friday, 19 February 2021 at 19:20:39 UTC, tcak wrote: I have written a test module and put it into /var/www/html: module mymodule; import std.stdio; void testMe(){ writeln("I tested you!"); } Then I have a main file where I would like to call the function "testMe". My build line is

Re: How to get output of piped process?

2021-02-19 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: On 2/18/21 4:40 AM, frame wrote: [...] It's just the way it is. Everything in Phobos is a C FILE * (wrapped in a File). You need to use alternative i/o systems to get the information. [...] Does your iopipe

Re: Profiling

2021-02-11 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 10 February 2021 at 23:42:31 UTC, mw wrote: On Wednesday, 10 February 2021 at 11:52:51 UTC, JG wrote: As a follow up question I would like to know what tool people use to profile d programs? I use this one: https://code.dlang.org/packages/profdump e.g. ``` dub build

Re: Real simple unresolved external symbols question...

2021-02-11 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 February 2021 at 00:18:23 UTC, H. S. Teoh wrote: On Wed, Feb 10, 2021 at 11:35:27PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] Okay, thanks. Then why does the README.md at https://github.com/dlang/druntime say "Runtime is typically linked together with Phobos in a

Re: Finding position of a value in an array

2021-02-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 February 2021 at 15:47:05 UTC, Rumbu wrote: On Sunday, 29 December 2019 at 08:26:58 UTC, Daren Scot Wilson wrote: [...] Just reactivating this post to tell you that I lost 15 minutes of my life searching for a basic way to obtain the position of an element in an array; Out of

Re: Minimize GC memory footprint

2021-02-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 February 2021 at 09:42:38 UTC, rikki cattermole wrote: On 06/02/2021 3:32 PM, frame wrote: [...] This won't do anything. [...] Don't forget to stdout.flush; Otherwise stuff can get caught in the buffer before erroring out. [...] Turn on the precise GC, 32bit is a

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 15:59:28 UTC, H. S. Teoh wrote: On Wed, Feb 03, 2021 at 03:47:34PM +, Imperatorn via Digitalmars-d-learn wrote: On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote: > [...] [...] Or dustmite? https://dlang.org/blog/2020/04/13/dustmite-the-gene

Re: Any tools to track heap/stack corruptions?

2021-02-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 14:00:23 UTC, JN wrote: I am dealing with some nasty issue in my code. Basically random unrelated lines of code are crashing with access violations, and if I switch from dmd to ldc the crash goes away, or crash comes back, or it crashes in a different spot.

Refactoring tools

2021-02-02 Thread Imperatorn via Digitalmars-d-learn
As the title says: 1. Are there any (automated) refactoring tools for D? 2. If not, why? (Is D still too small?)

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

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 31 January 2021 at 12:31:59 UTC, Johan Engelen wrote: On Sunday, 31 January 2021 at 12:16:50 UTC, Imperatorn wrote: On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: [...] Interesting. Is this something that we could get into dmd with a switch? 樂 Try LDC 1.25

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

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote: On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote: [...] I have a way of getting the profile data your are after. Get the dmd_tracing_20942 branch from https://github.com/UplinkCoder/dmd Compile that version of

Re: Minimize GC memory footprint

2021-01-31 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 31 January 2021 at 04:12:14 UTC, frame wrote: On Saturday, 30 January 2021 at 22:57:41 UTC, Imperatorn wrote: On Saturday, 30 January 2021 at 16:42:35 UTC, frame wrote: Is there a way to force the GC to re-use memory in already existing pools? I set maxPoolSize:1 to gain pools

Re: Minimize GC memory footprint

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 16:42:35 UTC, frame wrote: Is there a way to force the GC to re-use memory in already existing pools? I set maxPoolSize:1 to gain pools that can be quicker released after there no longer in use. This already reduces memory usage to 1:3. Sadly the application

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 12:28:16 UTC, Ali Çehreli wrote: On 1/30/21 1:34 AM, Imperatorn wrote: > [...] should be > [...] I wonder whether doing something in the runtime is possible. For example, it may be more resilient and not crash when suspending a thread fails because the thread

Re: Why filling AA in shared library freezes execution?

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Friday, 29 January 2021 at 15:34:49 UTC, H. S. Teoh wrote: On Fri, Jan 29, 2021 at 12:45:02PM +, Imperatorn via Digitalmars-d-learn wrote: On Wednesday, 27 January 2021 at 15:25:17 UTC, H. S. Teoh wrote: > On Wed, Jan 27, 2021 at 02:39:08PM +, Adam D. Ruppe via > Digitalmars-d

Re: Initializing D runtime and executing module and TLS ctors for D libraries

2021-01-30 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 30 January 2021 at 05:44:37 UTC, Ali Çehreli wrote: On 1/24/21 2:28 AM, IGotD- wrote: > [...] course. Any > [...] not do D > [...] [...] Hmm, interesting, or what you should call it  With this knowledge we have now, what changes could and/or should be made to make this

Re: What does this code snippet even do?

2021-01-29 Thread Imperatorn via Digitalmars-d-learn
On Friday, 29 January 2021 at 22:59:14 UTC, H. S. Teoh wrote: On Fri, Jan 29, 2021 at 10:41:33PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] This means: "does the type of 'a' have the form U[], where U is a type that implicitly converts to T?". [...] This means: "does the

Re: Why filling AA in shared library freezes execution?

2021-01-29 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 27 January 2021 at 15:25:17 UTC, H. S. Teoh wrote: On Wed, Jan 27, 2021 at 02:39:08PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: On Wednesday, 27 January 2021 at 14:36:16 UTC, Adam D. Ruppe wrote: > (btw as for me fixing it myself oh edit, I should point out it also

Re: 200-600x slower Dlang performance with nested foreach loop

2021-01-26 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 17:40:36 UTC, methonash wrote: Greetings Dlang wizards, I seek knowledge/understanding of a very frustrating phenomenon I've experienced over the past several days. [...] Source please 

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-24 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 24 January 2021 at 11:44:04 UTC, Marcone wrote: On Saturday, 23 January 2021 at 21:26:28 UTC, James Blachly wrote: On 1/20/21 6:50 AM, Marcone wrote: On Tuesday, 19 January 2021 at 14:20:06 UTC, Imperatorn wrote: [...] I do not mean resources .res, except if is possible use files

Re: std.algorithm.splitter on a string not always bidirectional

2021-01-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 January 2021 at 17:29:08 UTC, Steven Schveighoffer wrote: On 1/22/21 11:57 AM, Jon Degenhardt wrote: [...] But that is possible with all 3 splitter variants. Why is one allowed to be bidirectional and the others are not? [...] +1

Re: Issue with socket recieve

2021-01-22 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 21 January 2021 at 03:30:50 UTC, Tim wrote: On Thursday, 21 January 2021 at 03:21:41 UTC, Adam D. Ruppe wrote: On Wednesday, 20 January 2021 at 21:31:54 UTC, Tim wrote: [...] [snip] generate a core.exception.InvalidMemoryOperationError that I can't catch. None of this makes

Re: What are the advantages of using betterC?

2021-01-19 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 19 January 2021 at 17:44:03 UTC, Rempas wrote: On Tuesday, 19 January 2021 at 17:40:52 UTC, Adam D. Ruppe wrote: betterC is a niche restricted feature set. If you don't already have a use case in mind, I'd recommend avoiding it. It is for cases where you're stuck with certain

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-19 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 19 January 2021 at 11:10:25 UTC, Marcone wrote: On Tuesday, 19 January 2021 at 06:25:31 UTC, Imperatorn wrote: On Monday, 18 January 2021 at 19:42:22 UTC, Marcone wrote: How can I create a Standalone Bundle Portable file application using Dlang? Could you describe what you mean

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 January 2021 at 19:42:22 UTC, Marcone wrote: How can I create a Standalone Bundle Portable file application using Dlang? Could you describe what you mean with "Bundle portable file application"?

Re: Why many programmers don't like GC?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 January 2021 at 12:41:31 UTC, Ola Fosheim Grøstad wrote: On Monday, 18 January 2021 at 12:17:24 UTC, aberba wrote: [...] Not fighting the GC, but the whole argument about improving it, or mix or match, does not work for most developers looking for a new language. So either

Re: Why many programmers don't like GC?

2021-01-18 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 21:49:07 UTC, H. S. Teoh wrote: On Fri, Jan 15, 2021 at 09:04:13PM +, welkam via Digitalmars-d-learn wrote: [...] As the joke goes, "you can write assembly code in any language". :-D If you code in a sloppy way, it doesn't matter what language you write

Re: To switch GC from FIFO to LIFO paradigm.

2021-01-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 12:39:30 UTC, MGW wrote: GC cleans memory using the FIFO paradigm. Is it possible to switch GC to work using the LIFO paradigm? AFAIK the GC just sweeps, and the only queue is for destructors (unreachable memory) iirc

Re: Static constructor

2021-01-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 16:04:02 UTC, ludo wrote: I believe so. I've never used OpenAL so it may have additional restrictions with multithreading, but from a simple "This function is only ever executed on one thread at a time", your above suggestions should work. Apologies for the late

Re: Open question: what code pattern you use usually for null safety problem

2021-01-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 15 January 2021 at 14:25:09 UTC, Steven Schveighoffer wrote: On 1/15/21 9:19 AM, Steven Schveighoffer wrote: Something similar to BlackHole or WhiteHole. Essentially there's a default action for null for all types/fields/methods, and everything else is passed through. And now

  1   2   >