Re: Being reading a lot about betterC, but still have some questions

2024-07-09 Thread evilrat via Digitalmars-d-learn
On Tuesday, 9 July 2024 at 07:54:12 UTC, kiboshimo wrote: Hi, Some stuff must look obvious to an experienced programmer so they are not explicit on articles and documentation over the internet. I'm somewhat inexperienced, so: - betterC does not need glue code to interop with C. Does it

Re: Pointer to dlang spec for this alias construct?

2024-06-16 Thread evilrat via Digitalmars-d-learn
On Monday, 17 June 2024 at 04:32:50 UTC, Andy Valencia wrote: In the alias: alias Unshared(T) = T; alias Unshared(T: shared U, U) = U; as used in: cast(Unshared!mytype)value turns a mytype with shared attribute into one without shared. I deduce the alias is using some sort of

Re: How to use D without the GC ?

2024-06-12 Thread evilrat via Digitalmars-d-learn
On Wednesday, 12 June 2024 at 17:00:14 UTC, Vinod K Chandran wrote: On Wednesday, 12 June 2024 at 10:16:26 UTC, Sergey wrote: Btw are you going to use PyD or doing everything manually from scratch? Does PyD active now ? I didn't tested it. My approach is using "ctypes" library with my dll.

Re: Unintentional sharing?

2024-06-06 Thread evilrat via Digitalmars-d-learn
On Thursday, 6 June 2024 at 17:49:39 UTC, Andy Valencia wrote: I was using instance initialization which allocated a new object. My intention was this initialization would happen per-instance, but all instances appear to share the same sub-object? That is, f1.b and f2.b appear to point to a

Re: How to pass in reference a fixed array in parameter

2024-06-05 Thread evilrat via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 11:27:32 UTC, Nick Treleaven wrote: On Wednesday, 5 June 2024 at 09:24:23 UTC, evilrat wrote: for simple cases like this it might work, but 2d array is not even contiguous, A 2D static array is contiguous: https://dlang.org/spec/arrays.html#rectangular-arrays D

Re: How to pass in reference a fixed array in parameter

2024-06-05 Thread evilrat via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 06:22:34 UTC, Eric P626 wrote: On Tuesday, 4 June 2024 at 16:19:39 UTC, Andy Valencia wrote: On Tuesday, 4 June 2024 at 12:22:23 UTC, Eric P626 wrote: Thanks for the comments. So far, I only managed to make it work by creating a dynamic array and keeping the same

Re: How to pass in reference a fixed array in parameter

2024-06-04 Thread evilrat via Digitalmars-d-learn
On Tuesday, 4 June 2024 at 12:22:23 UTC, Eric P626 wrote: I am currently trying to learn how to program in D. I thought that I could start by trying some maze generation algorithms. I have a maze stored as 2D array of structure defined as follow which keep tracks of wall positions: ~~~

Re: need help to use C++ callback from garnet

2024-05-29 Thread evilrat via Digitalmars-d-learn
On Wednesday, 29 May 2024 at 07:47:01 UTC, Dakota wrote: I try use https://github.com/microsoft/garnet/blob/main/libs/storage/Tsavorite/cc/src/device/native_device_wrapper.cc from D Not sure how to make this work with D: ```c++ EXPORTED_SYMBOL FASTER::core::Status

Re: Sokol now has official D bindings

2024-05-14 Thread evilrat via Digitalmars-d-announce
On Tuesday, 14 May 2024 at 12:36:27 UTC, ryuukk_ wrote: It'll be interesting to know what the experience was for the maintainer to play around with D (for the first time?) From what i could gather, problems encountered: - rvalue ref params (wich led to someone telling him to use -preview=all

Re: D doesn't have weak references. So how can I make a associative array of objects without preventing their destruction?

2024-05-10 Thread evilrat via Digitalmars-d-learn
On Friday, 10 May 2024 at 13:27:40 UTC, Dukc wrote: Steven Schveighoffer kirjoitti 10.5.2024 klo 16.01: On Friday, 10 May 2024 at 11:05:28 UTC, Dukc wrote: This also gets inferred as `pure` - meaning that if you use it twice for the same `WeakRef`, the compiler may reuse the result of the

Re: D doesn't have weak references. So how can I make a associative array of objects without preventing their destruction?

2024-05-09 Thread evilrat via Digitalmars-d-learn
On Thursday, 9 May 2024 at 00:39:49 UTC, Liam McGillivray wrote: What's a good way I can achieve what I'm trying to do, using either reference counting or a garbage-collected object? There is libraries like `automem`[1] that implements refcounting and more. Without showing your code for ref

Re: Question on shared memory concurrency

2024-03-04 Thread evilrat via Digitalmars-d-learn
On Monday, 4 March 2024 at 16:02:50 UTC, Andy Valencia wrote: On Monday, 4 March 2024 at 03:42:48 UTC, Richard (Rikki) Andrew Cattermole wrote: A way to do this without spawning threads manually: ... Thank you! Of course, a thread dispatch per atomic increment is going to be s.l.o.w., so

Re: Is D programming friendly for beginners?

2024-03-04 Thread evilrat via Digitalmars-d-announce
On Monday, 4 March 2024 at 13:37:53 UTC, Fidele wrote: I want to start learning D programming language it looks interesting Answering thread question: It can be complicated, D has a lot of features and mastering it will take quite a lot of time. Since D is statically typed compiled system

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-19 Thread evilrat via Digitalmars-d-learn
On Friday, 19 January 2024 at 16:55:25 UTC, ryuukk_ wrote: You do hash map lookup for every character in D, it's slow, whereas in Rust you do it via pattern matching, java does the same, pattern matching Yet another reason to advocate for pattern matching in D and switch as expression

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-17 Thread evilrat via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 11:20:14 UTC, Renato wrote: That means the input file is still not ASCII (or UTF-8) as it should. Java is reading files with the ASCII encoding so it should've worked fine. It seems that it is only works with ASCII encoding though.

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-17 Thread evilrat via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 10:43:22 UTC, Renato wrote: On Wednesday, 17 January 2024 at 10:24:31 UTC, Renato wrote: It's not Java writing the file, it's the bash script [`benchmark.sh`](https://github.com/renatoathaydes/prechelt-phone-number-encoding/blob/master/benchmark.sh#L31): ```

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-17 Thread evilrat via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 07:06:25 UTC, Renato wrote: On Tuesday, 16 January 2024 at 22:15:04 UTC, Siarhei Siamashka wrote: On Tuesday, 16 January 2024 at 21:15:19 UTC, Renato wrote: It's a GC allocations fest. Things like this make it slow: ```diff { -string digit =

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-17 Thread evilrat via Digitalmars-d-learn
On Wednesday, 17 January 2024 at 07:11:02 UTC, Renato wrote: If you want to check your performance, you know you can run the `./benchmark.sh` yourself? Out of curiosity I've tried to manually run this on Windows and it seems that Java generator for these numbers files is "broken", the

Re: Less verbose or at least "higher level" 2D game engines for Dlang.

2023-12-29 Thread evilrat via Digitalmars-d-learn
On Saturday, 30 December 2023 at 00:47:04 UTC, Agent P. wrote: Hello everyone, I'm looking for a 2D game engine for Dlang that offers flexibility but has a high-level interface, preferably less verbose. Although I've explored options on GitHub and in general, I haven't found something that

Re: [vibe] what's wrong with linking time of vibe applications?

2023-12-24 Thread evilrat via Digitalmars-d-learn
On Friday, 22 December 2023 at 19:12:14 UTC, Dmitry Ponyatov wrote: D lang noted as having a very fast compilation time. Playing with tiny web-interface apps I found that modern versions of dmd & vibe has such a fast compiling but a very long executable linking time. Something like 2-3

Re: [vibe] statically precompile some JS libs into an app binary

2023-12-24 Thread evilrat via Digitalmars-d-learn
On Friday, 22 December 2023 at 19:55:07 UTC, Dmitry Ponyatov wrote: It is possible to statically precompile some JS libs and media fragments into an app binary? My colleagues asks me to distribute app as a single standalone executable if it is possible, and maybe few millisecond of page load

Re: What is :-) ?

2023-11-20 Thread evilrat via Digitalmars-d-learn
On Monday, 20 November 2023 at 16:09:33 UTC, Antonio wrote: Is there any way to force D compiler to treat this "createCounter" declaration as **delegate** instead of **function**? ```d auto createCounter = (int nextValue) => () => nextValue++; ``` generally there is a way to tell the

Re: What is :-) ?

2023-11-20 Thread evilrat via Digitalmars-d-learn
On Monday, 20 November 2023 at 09:44:32 UTC, Antonio wrote: - Why writeln doesn't treat ```next``` and ```Counter``` the same way? (I think I understand why, but it shows a "low" level difference of something that syntactically is equivalent) - What is the way to show Counter signature

Re: What is :-) ?

2023-11-20 Thread evilrat via Digitalmars-d-learn
On Monday, 20 November 2023 at 08:47:34 UTC, Antonio wrote: Now, I uncomment the ```writeln( "'Counter' is ", Counter );``` line and compiler says ``` /home/antonio/Devel/topbrokers/whatsapp-srv/admin/x.d(12): Error: function `x.Counter(int nextValue)` is not callable using argument types

Re: Translating C precompiler macros to D

2023-11-09 Thread evilrat via Digitalmars-d-learn
On Wednesday, 8 November 2023 at 20:43:21 UTC, solidstate1991 wrote: Here's this precompiler macro from Pipewire, on which many important inline functions depend on, like this one: ```c /** * Invoke method named \a method in the \a callbacks. * The \a method_type defines the type of the

Re: Symbolic computations in D

2023-10-29 Thread evilrat via Digitalmars-d-learn
On Sunday, 29 October 2023 at 10:44:03 UTC, ryuukk_ wrote: If D had tagged union and pattern matching, it would be a great candidate to succeed in that field Well, we sort of have it, just not as good as it can be. https://dlang.org/phobos/std_sumtype.html The default example though makes

Re: Symbolic computations in D

2023-10-29 Thread evilrat via Digitalmars-d-learn
On Sunday, 29 October 2023 at 08:55:24 UTC, Dmitry Ponyatov wrote: Maybe someone played in this topic, and can give some advice: is D language with its OOP without multiple inheritance and maybe other semantic limitations able and good enough to be used with these books mechanics? You can

Re: Can't get into debugger in vscode on macOS

2023-10-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 October 2023 at 06:03:06 UTC, Daniel Zuncke wrote: Hello, I need some help getting into the debugger in vscode on macOS. It did work some months ago but that was finicky to set up. Maybe I am forgetting something now? I am compiling the project with `dub build --build debug

Re: How to get all modules in a package at CT?

2023-10-05 Thread evilrat via Digitalmars-d-learn
On Thursday, 5 October 2023 at 22:32:36 UTC, mw wrote: So ModuleInfo contains all the modules (transitive closure) built into the current binary that is running? Is there document about this ModuleInfo? I only find Struct object.ModuleInfo https://dlang.org/library/object/module_info.html

Re: Meaning of the dot-function syntax

2023-10-01 Thread evilrat via Digitalmars-d-learn
On Sunday, 1 October 2023 at 08:22:48 UTC, dhs wrote: Hi, What's the meaning of the dot in the call to writeln() below? ```d .writeln("Hello there!"); ``` I haven't found this in the spec or anywhere else. This is used very often in the source code for Phobos. Thanks, dhs It is

Re: implicit-context v0.0.1

2023-09-30 Thread evilrat via Digitalmars-d-announce
On Saturday, 30 September 2023 at 12:40:29 UTC, Guillaume Piolat wrote: On Friday, 29 September 2023 at 16:56:47 UTC, Imperatorn wrote: Sounds a bit like dependency injection but for state Possibly, I'm not familiar with dependency injection. When is it useful? Dependency injection is a

Re: change object class

2023-09-17 Thread evilrat via Digitalmars-d-learn
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev wrote: It works! But I want to ask how to make this 100% the best of the best? What should I consider before changing ```__vptr``` ? If that works for you with that constraint of having exact memory layout then it should be ok.

Re: pipeProcess output to hash string

2023-09-09 Thread evilrat via Digitalmars-d-learn
On Saturday, 9 September 2023 at 16:49:30 UTC, user1234 wrote: not sure why you append "/?" to the program name. Windows maybe? Try this. auto result = std.process.pipeProcess(["whoami", "/?"], redirect);

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 September 2023 at 11:50:52 UTC, rempas wrote: That's interesting, I wasn't able to find something else! The bug happens when I run the testing suit and well... the tests before pass so I cannot find anything that goes wrong except for the fact that I do not free the memory that

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 September 2023 at 07:59:37 UTC, rempas wrote: I do have the following struct: ```d struct Vec(T) { private: T* _ptr = null; // The pointer to the data u64 _cap = 0; // Total amount of elements (not bytes) we can store public: /* Create a vector by just allocating memory

Re: I don't understand betterC

2023-09-04 Thread evilrat via Digitalmars-d-learn
On Monday, 4 September 2023 at 07:39:21 UTC, confused wrote: So then I guess I'd still like to know how I'm expected to store and access an array of characters without the C runtime as I tried in my original post. Without C runtime functions such as malloc you can still have fixed-length

Re: I don't understand betterC

2023-09-02 Thread evilrat via Digitalmars-d-learn
On Saturday, 2 September 2023 at 03:27:51 UTC, confused wrote: So I guess my next question is why, exactly, classes *can*, in fact, be implemented in ``` betterC ```, but are not? IIRC you can have extern(C++) classes in betterC, the real issue is the plain extern(D) classes which has some

Re: I don't understand betterC

2023-09-01 Thread evilrat via Digitalmars-d-learn
On Friday, 1 September 2023 at 13:17:08 UTC, confused wrote: On Friday, 1 September 2023 at 08:19:55 UTC, Richard (Rikki) Andrew Cattermole wrote: ``size_t`` is defined in ``object.d`` which is implicitly imported into all modules. If it cannot be found, one of three things is happening: 1)

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread evilrat via Digitalmars-d-learn
On Saturday, 25 February 2023 at 19:31:10 UTC, solidstate1991 wrote: Well, VS turned to be even less cooperative than before. Now it only loads and runs a specific old version of an EXE file. I'm asking around for other debuggers, I'm definitely moving to another. Nothing happens without

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread evilrat via Digitalmars-d-learn
On Saturday, 25 February 2023 at 16:58:44 UTC, solidstate1991 wrote: I used to use Visual Studio, but I forgot how to set it up properly to break on handled throws. Now it doesn't do anything if throws are handled in any fashion, and I can't find an option to change it (it was removed

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread evilrat via Digitalmars-d-learn
On Saturday, 25 February 2023 at 15:55:33 UTC, solidstate1991 wrote: I had a lot of trouble trying to get Visual Studio to catch handled exceptions VisualD for Visual Studio provides some extra help with displaying your data in debugger and on Windows is the best you can get for D. You can

godot-dlang v0.2.0

2023-02-24 Thread evilrat via Digitalmars-d-announce
# Release godot-dlang v0.2 This release includes support for Godot 4 RC ## What is godot-dlang? godot-dlang is a wrapper over Godot engine scripting API using new native extensions feature, simply put you can now extend engine using native code in a shared library form. ## What it can be

Re: How to a link to a C library to create static bindings?

2023-01-27 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 January 2023 at 02:40:58 UTC, thebluepandabear wrote: I am really confused as to how I even am supposed to get the library name in the first place, which is another thing that is confusing me. It is up to the library author to choose a name. The extensions is

Re: Hipreme's #8 Tip of the day - Using custom runtime with dub projects

2023-01-22 Thread evilrat via Digitalmars-d-learn
On Sunday, 22 January 2023 at 18:16:35 UTC, Hipreme wrote: Nope. Those DFLAGS environment variable is used to affect projects such as my dependencies. For example, my dependency needs to be built using my own runtime. The dflags defined in the dub.json only affect the current project, not

Re: Hipreme's #8 Tip of the day - Using custom runtime with dub projects

2023-01-22 Thread evilrat via Digitalmars-d-learn
On Sunday, 22 January 2023 at 16:57:56 UTC, Hipreme wrote: The way to use dub's packages is by using the DFLAGS. With DFLAGS, I can set the import path to my own DRuntime and own std. That way I can make the dependencies behave more or less the same, this is an example of what is being done

Re: Function which returns a sorted array without duplicates

2023-01-21 Thread evilrat via Digitalmars-d-learn
On Sunday, 22 January 2023 at 04:42:09 UTC, dan wrote: I would like to write a function which takes an array as input, and returns a sorted array without duplicates. ```d private S[] _sort_array( S )( S[] x ) { import std.algorithm; auto y = x.dup; y.sort; auto z =

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread evilrat via Digitalmars-d-learn
On Friday, 20 January 2023 at 13:17:05 UTC, Ruby The Roobster wrote: On Friday, 20 January 2023 at 13:03:18 UTC, thebluepandabear wrote: ll a function without instantiating said class, as functions act on the class object. Ok, thanks. I think D should implement something similar to `static

Re: Vibe.d serve files from filesystem

2023-01-12 Thread evilrat via Digitalmars-d-learn
On Wednesday, 11 January 2023 at 18:56:47 UTC, eXodiquas wrote: Hello everyone, I build a web tool that allows people to upload some files. Those files should not be public, so I copy them into a folder hidden away on the filesystem. But, I want an authenticated user to be able to look at

Godot 4 beta-4 released

2022-11-05 Thread evilrat via Digitalmars-d-announce
Godot is an open source 2d/3d game engine has just released new beta version! https://godotengine.org/article/dev-snapshot-godot-4-0-beta-4 Godot-d is a bindings for Godot, latest official release is for Godot 3 only, however here is a WIP branch for Godot 4 latest beta-4.

Re: Background thread, async and GUI (dlangui)

2022-07-11 Thread evilrat via Digitalmars-d-learn
On Sunday, 10 July 2022 at 09:15:59 UTC, Bagomot wrote: Based on Thread, I managed to do what I intended. I have not yet been able to figure out how to do the same through the Task. Here in the example, when you click on the Start button, a worker is launched that updates the progress bar.

Re: What happened to Circular Studio?

2022-06-09 Thread evilrat via Digitalmars-d-learn
On Monday, 6 June 2022 at 21:07:58 UTC, Steven Schveighoffer wrote: On 6/6/22 3:46 PM, Jack wrote: I just found out a game using D to develop games but later I see the last updates on the github, web site, twitter etc is from 2015. Does anyone knows what happend to the company? It appears to

Re: Release D 2.099.0

2022-03-09 Thread evilrat via Digitalmars-d-announce
On Wednesday, 9 March 2022 at 10:08:50 UTC, meta wrote: On Wednesday, 9 March 2022 at 09:04:03 UTC, Martin Nowak wrote: Glad to announce D 2.099.0, ♥ to the 100 contributors. This release comes with __traits(parameters), unittests only from root modules, throw expressions, and plenty of more

Re: Trying to cross compile from windows to android

2022-01-21 Thread evilrat via Digitalmars-d-learn
On Thursday, 20 January 2022 at 19:31:06 UTC, H. S. Teoh wrote: I'm not sure how it works on Windows, but there should be corresponding binaries that might give a hint as to what's the correct -fuse-ld=... option you need to use. Here I documented some of the quirks I've hit during android

Re: Good intellisense support IDE/Editor?

2021-12-22 Thread evilrat via Digitalmars-d-learn
On Wednesday, 22 December 2021 at 10:37:51 UTC, Michel wrote: Hey, I've tried coding in Visual Studio Code but there isn't any function checking/showing what arguments a function accepts, I can just write `Foo.Bar("somerandomarg");` and it will not give me errors or warnings. Which IDE do

Re: How to pass a class by (const) reference to C++

2021-12-15 Thread evilrat via Digitalmars-d-learn
On Wednesday, 15 December 2021 at 12:02:08 UTC, Jan wrote: On Wednesday, 15 December 2021 at 11:03:27 UTC, rikki cattermole wrote: On 15/12/2021 11:54 PM, Jan wrote: On Wednesday, 15 December 2021 at 09:36:54 UTC, Jan wrote: Unfortunately it's the "annoying little details" that I immediately

Re: How to pass a class by (const) reference to C++

2021-12-13 Thread evilrat via Digitalmars-d-learn
On Tuesday, 14 December 2021 at 06:21:39 UTC, Tejas wrote: Hey, evilrat, I've seen people make claims that our C++ interop has reached phenomenal levels and that going any further would basically require a C++ compiler ala ImportC++, the issue is just that the docs haven't been updated yet

Re: How to pass a class by (const) reference to C++

2021-12-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 December 2021 at 12:16:03 UTC, Ola Fosheim Grøstad wrote: On Monday, 13 December 2021 at 12:08:30 UTC, evilrat wrote: Yeah but it sucks to have making C++ wrapper just for this. I think either pragma mangle to hammer it in place or helper dummy struct with class layout that

Re: How to pass a class by (const) reference to C++

2021-12-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 December 2021 at 11:13:12 UTC, Tejas wrote: On Monday, 13 December 2021 at 09:21:26 UTC, Jan wrote: On Monday, 13 December 2021 at 07:48:34 UTC, evilrat wrote: On Sunday, 12 December 2021 at 21:24:39 UTC, Jan wrote: In D I have an extern(C++) class: ```cpp extern(C++) class A {

Re: How to pass a class by (const) reference to C++

2021-12-12 Thread evilrat via Digitalmars-d-learn
On Sunday, 12 December 2021 at 21:24:39 UTC, Jan wrote: In D I have an extern(C++) class: ```cpp extern(C++) class A { ~this(); // other stuff } ``` An a function that takes A by const reference: ```cpp void CppFunc(const A& arg); ``` But how do I bind this in D ? ```cpp

Re: DQt: Qt bindings using extern(C++)

2021-12-11 Thread evilrat via Digitalmars-d-announce
On Saturday, 11 December 2021 at 00:47:56 UTC, LorenDB wrote: On Friday, 10 December 2021 at 17:38:56 UTC, Tim wrote: I have not released the converter yet. It is currently not very user friendly and needs many manual changes to the result, which I want to improve. It also has Qt specific

Re: How to "stringnify"?

2021-10-10 Thread evilrat via Digitalmars-d-learn
On Sunday, 10 October 2021 at 08:28:30 UTC, rempas wrote: Is there a way to "stringnify" in Dlang? In C we would do something like the following: `#define STRINGIFY(x) #x` What's the equivalent in D? That's probably depends on what you are trying to achieve. If you want to write code-like

Re: What is the meaning of @future ?

2021-09-18 Thread evilrat via Digitalmars-d-learn
On Saturday, 18 September 2021 at 08:02:13 UTC, Dylan Graham wrote: On Friday, 17 September 2021 at 14:37:29 UTC, Meta wrote: On Friday, 17 September 2021 at 10:31:34 UTC, bauss wrote: On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: [...] It's just another "useless" attribute

Re: dmdtags 1.0.0: an accurate tag generator for D source code

2021-08-28 Thread evilrat via Digitalmars-d-announce
On Friday, 27 August 2021 at 22:45:15 UTC, WebFreak001 wrote: I'm just worried about how the memory usage will grow with this, considering dmd never frees. Still not sure if it *should* be used in same process, but DMD definitely has -lowmem switch for turning on GC, and for DMD as a

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Saturday, 21 August 2021 at 23:50:51 UTC, Ruby The Roobster wrote: On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote: On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: First parameter for CreateWindow should be window class string that you used in

Re: C to D convertor

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Saturday, 21 August 2021 at 08:14:22 UTC, Виталий Фадеев wrote: I know, i know... It not possible, but part of the C code we can to convert to the D. Show me, please, solutions, projects, tools, scripts, docs. Can you give the link ? `htod` is 1. Any more ? dstep

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote: int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { // ... if(!RegisterClassA()) { return 0; } hwnd = CreateWindowA( "Test",

Re: D equivalent of C++ explicit

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: As the topic says: Is there an equivalent to C++'s `explicit` keyword in D? No, because all constructors are

Re: How to call destructor before free without dropping @nogc?

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 15:12:03 UTC, Ferhat Kurtulmuş wrote: On Thursday, 19 August 2021 at 07:30:38 UTC, Bienlein wrote: Hello, I allocate some instance of class C manually and then free the memory again: [...] I just wanted to leave this here.

Re: How to call destructor before free without dropping @nogc?

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 08:25:23 UTC, Bienlein wrote: Oops, I just realized that you can also not call emplace when @nogc is present. Well that is at least consistent with not either being able to call destroy ;-). So, I guess this means that you can forget about manually allocating

Re: Two major problems with dub

2021-08-04 Thread evilrat via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 07:21:56 UTC, Denis Feklushkin wrote: On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote: vibe-d - probably because it handles DB connection and/or keep things async way, sure you probably can do it with Phobos but it will be much more PITA and less

Re: Two major problems with dub

2021-08-01 Thread evilrat via Digitalmars-d-learn
On Sunday, 1 August 2021 at 17:25:26 UTC, Alain De Vos wrote: A simple example, dub package dpq2 pulls in, money,vide-d,stdx-allocator,derelict-pq,derelict-util This all for a handfull of C-functions. let's see Money - fits pretty ok, cause your average SQL has decimal type for that purpose

Re: Two major problems with dub

2021-08-01 Thread evilrat via Digitalmars-d-learn
On Sunday, 1 August 2021 at 15:38:32 UTC, Alain De Vos wrote: 2. Let's say you need bindings to postgresql library and you will see dub pulling in numerous of libraries, which have nothing at all to do with postgresql. More like a framework stuff. This creates unneeded complexity, bloatware,

Re: How to create friends of a class at compile time?

2021-07-15 Thread evilrat via Digitalmars-d-learn
On Thursday, 15 July 2021 at 17:49:06 UTC, Tejas wrote: I'm sorry, I should've explicitly mentioned I'm interested in learning how to do friend injection in D. I know that access specifiers operate at module scope, seen a few posts about that here already. Thank you for answering though.

Re: LDC 1.27.0-beta3

2021-07-15 Thread evilrat via Digitalmars-d-announce
On Thursday, 15 July 2021 at 11:58:28 UTC, Guillaume Piolat wrote: On Thursday, 15 July 2021 at 02:54:14 UTC, rikki cattermole wrote: Will -fvisibility=public support be upstreamed into dmd? If yes, it might be worth it to get rid of export as a keyword Please, no. -fvisibility=public

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 19:06:42 UTC, Tejas wrote: But how scalable will this be? We have to get real D code to enrich our ambiguously-defined-small ecosystem. It says bindings generator, but it has to convert the code keeping the semantic as close as possible. It does direct

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:09:02 UTC, Tejas wrote: Sorry, I'm rather ignorant when it comes to this, but why can't we use [pegged](https://github.com/PhilippeSigaud/Pegged) to transpile C++ code to D? Then we won't need a nogc compatible std library and so many other things could get

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:57:44 UTC, Imperatorn wrote: On Thursday, 10 June 2021 at 15:09:02 UTC, Tejas wrote: Sorry, I'm rather ignorant when it comes to this, but why can't we use [pegged](https://github.com/PhilippeSigaud/Pegged) to transpile C++ code to D? Then we won't need a nogc

Re: Class member initialization with new points to a single instance?

2021-06-09 Thread evilrat via Digitalmars-d-learn
On Wednesday, 9 June 2021 at 17:56:24 UTC, Gregor Mückl wrote: Consider the following code: ```d class Foo { } class Bar { Foo foo = new Foo(); } void main() { Bar b1 = new Bar(); Bar b2 = new Bar(); assert(b1.foo != b2.foo); } ``` The assert fails. This is

Re: [Semi-OT] Cross-Platform GitHub Action

2021-06-09 Thread evilrat via Digitalmars-d-announce
On Wednesday, 9 June 2021 at 14:05:33 UTC, Steven Schveighoffer wrote: On 6/9/21 6:49 AM, Steven Schveighoffer wrote: On 6/9/21 4:17 AM, evilrat wrote: Just a note from terms of service: you get 2000 minutes available for Github Actions every month for free, however for using Windows hosts it

Re: [Semi-OT] Cross-Platform GitHub Action

2021-06-09 Thread evilrat via Digitalmars-d-announce
On Wednesday, 9 June 2021 at 05:20:14 UTC, Jacob Carlborg wrote: On Tuesday, 8 June 2021 at 19:40:01 UTC, kinke wrote: Thx for sharing! Interesting; I've recently worked on something similar, but on Linux hosts and using a kvm/qemu/libvirt stack for running CI jobs in Windows VMs. Yeah, this

Re: (Oh My) Gentool 0.4.0 released

2021-06-08 Thread evilrat via Digitalmars-d-announce
On Monday, 7 June 2021 at 10:15:28 UTC, evilrat wrote: On Monday, 7 June 2021 at 09:45:53 UTC, Andrea Fontana wrote: On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote: ## (oh my) gentool v0.4 is now out. It is my fancy tool to generate extern(C++) stuff quicker, it takes regular compiler

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-07 Thread evilrat via Digitalmars-d-learn
On Monday, 7 June 2021 at 14:02:14 UTC, Prokop Hapala wrote: Basically I'm desperate do find anything which encapsulates OpenGL calls into some nice D-lang classes to learn from it. I don't really want to use Dagon, nor Godot. What I want is to use it as learning resources fro learning

Re: (Oh My) Gentool 0.4.0 released

2021-06-07 Thread evilrat via Digitalmars-d-announce
On Monday, 7 June 2021 at 09:45:53 UTC, Andrea Fontana wrote: On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote: ## (oh my) gentool v0.4 is now out. It is my fancy tool to generate extern(C++) stuff quicker, it takes regular compiler flags that you usually pass to clang and translates

Re: (Oh My) Gentool 0.4.0 released

2021-06-06 Thread evilrat via Digitalmars-d-announce
On Sunday, 6 June 2021 at 10:38:22 UTC, sighoya wrote: On Sunday, 6 June 2021 at 10:03:11 UTC, evilrat wrote: ## (oh my) gentool v0.4 is now out. It is my fancy tool to generate extern(C++) stuff quicker, it takes regular compiler flags that you usually pass to clang and translates C/C++

(Oh My) Gentool 0.4.0 released

2021-06-06 Thread evilrat via Digitalmars-d-announce
## (oh my) gentool v0.4 is now out. It is my fancy tool to generate extern(C++) stuff quicker, it takes regular compiler flags that you usually pass to clang and translates C/C++ code to D. This release has one new feature: support pragma mangle on aggregates (class, struct, etc...). Also

Re: Release D 2.097.0

2021-06-05 Thread evilrat via Digitalmars-d-announce
On Saturday, 5 June 2021 at 10:19:47 UTC, Martin Nowak wrote: Glad to announce D 2.097.0, ♥ to the 54 contributors. This release comes with a new `std.sumtype` packcage, support for `while (auto n = expression)`, an overhauled formatting package, and many more changes.

Re: Release D 2.097.0

2021-06-05 Thread evilrat via Digitalmars-d-announce
On Saturday, 5 June 2021 at 10:19:47 UTC, Martin Nowak wrote: Glad to announce D 2.097.0, ♥ to the 54 contributors. This release comes with a new `std.sumtype` packcage, support for `while (auto n = expression)`, an overhauled formatting package, and many more changes.

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread evilrat via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 05:43:49 UTC, evilrat wrote: Yep, use Skia/Cairo or something like this, don't build your own full blown 2D engine for every possible graphics API. I would like to tune my C++ bindings generator to be able to handle Skia ASAP, but can't tell when it will be

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-01 Thread evilrat via Digitalmars-d-learn
Btw there is also (dear) imgui, which is immediate mode GUI that builds geometry to draw for you, how one would draw it is up to programmer. It is very popular in game dev because there is very little setup to get it working. Source https://github.com/ocornut/imgui D bindings with GL3 demo

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-01 Thread evilrat via Digitalmars-d-learn
On Tuesday, 1 June 2021 at 20:07:39 UTC, Prokop Hapala wrote: After some sime I tried to return to this, using dependency on older version of dagon I got errors in dlib Not sure how to understadn this ``` Error: incompatible types for (box.pmax) - (box.center): both operands are of type

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-01 Thread evilrat via Digitalmars-d-learn
On Tuesday, 1 June 2021 at 06:31:28 UTC, Ola Fosheim Grostad wrote: On Tuesday, 1 June 2021 at 05:27:41 UTC, Imperatorn wrote: On Tuesday, 1 June 2021 at 03:32:50 UTC, someone wrote: [...] Yeah, "fragmentation" is a problem. We do a lot of things 90%. We need more "100% projects" that are

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-30 Thread evilrat via Digitalmars-d-learn
On Sunday, 30 May 2021 at 07:03:38 UTC, Chris Piker wrote: On Thursday, 27 May 2021 at 07:00:32 UTC, Imperatorn wrote: I would like to recommend DlangUI [1], but we have tried now for months to get in contact with the owner of it (to take over development) and are getting no reponse. 1.

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 18:12:27 UTC, Gavin Ray wrote: On Tuesday, 25 May 2021 at 18:03:00 UTC, evilrat wrote: That last one with someInt is what I warned about. D ctor messed up class layout, in this simple case where class data isn't used it almost works, but will be practically unusable

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 17:52:14 UTC, Gavin Ray wrote: ```d void main() { Derived dlangDerived = new Derived(123); printf("[D] Derived.Base1::getSomething() = %d \n", dlangDerived.getSomething()); printf("[D] Derived.Base2::getOtherThing() = %d \n", dlangDerived.getOtherThing());

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 08:10:25 UTC, sighoya wrote: On Tuesday, 25 May 2021 at 02:47:19 UTC, Gavin Ray wrote: The below seems to work at least, which is encouraging: Awesome! At least, it becomes problematic with fields in base classes, it would be nice if we could map them to @property

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 02:47:19 UTC, Gavin Ray wrote: Unfortunately, it does not work if I try to add `final int getSomething()` or the other one to the D interfaces, it throws a symbol error because the mangled names are slightly different: ```sh unresolved external symbol "public:

Re: gtkd ,drawingarea, capture mouse pressed

2021-05-21 Thread evilrat via Digitalmars-d-learn
On Friday, 21 May 2021 at 12:28:36 UTC, Alain De Vos wrote: On a gtkd drawingarea I want to capture the mouse-pressed event and get the coordinates of the pointer on the area. I have ``` addEvents(GdkEventMask.BUTTON_PRESS_MASK); ``` Maybe I must add a signal-handler ? Not a gtk user, but

Re: What is the difference between these template declaration forms?

2021-05-15 Thread evilrat via Digitalmars-d-learn
On Saturday, 15 May 2021 at 08:37:21 UTC, cc wrote: Are these identical? Or is there a different usage for the (T : something) form? ```d auto opCast(T)() if (is(T == bool)) { return _obj !is null; } ``` They are the same in this case. ```d auto

Re: CalderaD - SDL2 Vulkan renderer for windows, linux, and android

2021-05-14 Thread evilrat via Digitalmars-d-announce
On Friday, 14 May 2021 at 17:38:54 UTC, Danny Arends wrote: Hmm, things gotta have a license, why not GPL would CC0 be better? is attribution and sharing code so weird ? I think: "license": "proprietary" also doesn't sound very inviting It's a WIP tutorial project. It is not finished yet.

Re: CalderaD - SDL2 Vulkan renderer for windows, linux, and android

2021-05-14 Thread evilrat via Digitalmars-d-announce
On Friday, 14 May 2021 at 16:39:53 UTC, Danny Arends wrote: Find the GPL-v3 licensed code here: https://github.com/DannyArends/CalderaD You can set up platform filters in dub to automatically match target platforms without specifying configuration for build. See this

  1   2   3   4   >