Re: Looking for Feedback (3D engine)

2025-05-18 Thread drug007 via Digitalmars-d-learn
On 17.05.2025 11:00, Danny Arends wrote: On Saturday, 17 May 2025 at 07:20:06 UTC, drug007 wrote: On 17.05.2025 01:26, Danny Arends wrote: [...] This patch fixed the issue: ```bash root@1be5cfa937c3:/DImGui#  git diff diff --git a/src/math/lsystem.d b/src/math/lsystem.d index 394e902..02c085d

Re: Looking for Feedback (3D engine)

2025-05-17 Thread drug007 via Digitalmars-d-learn
On 17.05.2025 01:26, Danny Arends wrote: Never seen it being a problem, but changing line 94 of lsystem.d from ```   test.rules[Symbols.Origin] ~= Rule("W.O", 5); ``` To ```   test.rules[Symbols.Origin] = Rule("W.O", 5); ``` Would fix it, I guess appending might not be allowed when the key

Re: Looking for Feedback (3D engine)

2025-05-16 Thread drug007 via Digitalmars-d-learn
On 17.05.2025 00:26, Danny Arends wrote: Thanks, I'll look into that one never had issues assigning to the L-System AA array. Does it cause a crash? If so could you do a stack trace to see if it comes from D runtime or just me not initializing it? ```bash INFO: createScene: Add a Square I

Re: Looking for Feedback (3D engine)

2025-05-16 Thread drug007 via Digitalmars-d-learn
On 16.05.2025 14:16, drug007 wrote: On 16.05.2025 13:29, Danny Arends wrote: On Friday, 16 May 2025 at 09:53:06 UTC, drug007 wrote: [...] Should be solved in commit: 86259698fd24be5f2fbad5fbcfe9ae4d1f416f01 Thanks for trying it, and reporting this. Let me know if it works now :) Thank you!

Re: Looking for Feedback (3D engine)

2025-05-16 Thread drug007 via Digitalmars-d-learn
On 16.05.2025 13:29, Danny Arends wrote: On Friday, 16 May 2025 at 09:53:06 UTC, drug007 wrote: [...] Should be solved in commit: 86259698fd24be5f2fbad5fbcfe9ae4d1f416f01 Thanks for trying it, and reporting this. Let me know if it works now :) Thank you! The problem is fixed. Now I need to

Re: Looking for Feedback (3D engine)

2025-05-16 Thread drug007 via Digitalmars-d-learn
On 16.05.2025 12:37, drug007 wrote: On 15.05.2025 11:29, Danny Arends wrote: Hey all, ```bash user@host:~/workspace/DImGui$  uname -a Linux host 6.8.0-59-generic #61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux userg@host:~/workspace/DImGui$ 

Re: Looking for Feedback (3D engine)

2025-05-16 Thread drug007 via Digitalmars-d-learn
On 15.05.2025 11:29, Danny Arends wrote: Hey all, ```bash user@host:~/workspace/DImGui$ uname -a Linux host 6.8.0-59-generic #61~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:03:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux userg@host:~/workspace/DImGui$ dub Starting Performing "debug" b

Re: Would appreciate some help porting Q3VM to D (mainly C macros and type conversions)

2024-10-15 Thread drug007 via Digitalmars-d-learn
On 15.10.2024 20:37, Mark Bauermeister wrote: On Tuesday, 15 October 2024 at 16:05:48 UTC, Lance Bachmeier wrote: On Tuesday, 15 October 2024 at 13:30:03 UTC, Mark Bauermeister wrote: On Tuesday, 15 October 2024 at 12:27:42 UTC, barbosso wrote: Are you heard of https://github.com/dkorpel/ctod

Re: Tuple List

2024-09-04 Thread drug007 via Digitalmars-d-learn
On 04.09.2024 10:51, Salih Dincer wrote: import std.algorithm; import std.typecons; alias T = Tuple!(string, "key", int, "value"); auto t1 = [T("WC", 0), T("Atelye", 0), T("Mutfak", 41),     T("Salon", 42) ]; assert(t1.find!"a.value > 0"   .map!"a.key" .equal(["Mutfak", "Salon"]) ); au

Re: Wrapper around a recursive data type

2024-07-14 Thread drug007 via Digitalmars-d-learn
On 09.07.2024 06:54, Steven Schveighoffer wrote: On Monday, 8 July 2024 at 08:56:51 UTC, drug007 wrote: How can I "break" this recursion or some other work around to fix it? A few ideas: 1. If it's immediately recursive (that is, contains a pointer to itself), just use the type itself someho

Wrapper around a recursive data type

2024-07-08 Thread drug007 via Digitalmars-d-learn
I need to generate some meta info of my data types. I do it this [way](https://gist.github.com/drug007/b0a00dada6c6ecbf46b4f6988401d4e2): ```D import std.range, std.format, std.stdio, std.traits; struct NestedType { string s; double d; } struct Node { string value; int i; Ne

Re: Why does this mixin fail to compile?

2024-07-01 Thread drug007 via Digitalmars-d-learn
On 01.07.2024 15:26, ryuukk_ wrote: Ok, i'll just do it and benchmark at the end Another question: Why doesn't this work?: I'm pretty sure your code does not work the way you think it does. String Mixins and Template Mixins are two different things. If you want to use String Mixins just m

Re: Why does this mixin fail to compile?

2024-07-01 Thread drug007 via Digitalmars-d-learn
On 01.07.2024 13:31, ryuukk_ wrote: On Monday, 1 July 2024 at 10:20:25 UTC, drug007 wrote: No problem, make a full string then mixin it. Your "no problem" = lot of string concatenation therefore slower and memory hungry, i have no desire to do that Do you think that string concatenation is

Re: Why does this mixin fail to compile?

2024-07-01 Thread drug007 via Digitalmars-d-learn
On 01.07.2024 12:39, ryuukk_ wrote: On Monday, 1 July 2024 at 09:29:50 UTC, Dennis wrote: On Monday, 1 July 2024 at 09:25:39 UTC, ryuukk_ wrote: This simple mixin fails to compile, anyone know why? ```D mixin implement; mixin template implement() {     mixin("struct _gen(T) {");     mixin("}"

Re: SumType extraction

2024-06-28 Thread drug007 via Digitalmars-d-learn
On 28.06.2024 15:43, Josh Holtrop wrote: On Friday, 28 June 2024 at 10:52:01 UTC, drug007 wrote: Nothing prevents that, and indeed I still plan to use item.match! like that when I need to handle multiple/all types. I just wanted the get! functionality when I only expect or want to handle one t

Re: SumType extraction

2024-06-28 Thread drug007 via Digitalmars-d-learn
What prevents you from doing: ```D import std.sumtype; class Foo {} class Bar {} alias Item = SumType!(Foo, Bar); void main() { Item[] items = [Item(new Foo()), Item(new Bar()), Item(new Foo()), Item(new Bar())]; foreach (item; items) { item.match!( (Foo v) { /

Re: How to use D without the GC ?

2024-06-12 Thread drug007 via Digitalmars-d-learn
On 12.06.2024 23:56, bachmeier wrote: On Wednesday, 12 June 2024 at 20:37:36 UTC, drug007 wrote: On 12.06.2024 21:57, bachmeier wrote: On Wednesday, 12 June 2024 at 18:36:26 UTC, Vinod K Chandran wrote: On Wednesday, 12 June 2024 at 15:33:39 UTC, bachmeier wrote: A SafeRefCounted example with

Re: How to use D without the GC ?

2024-06-12 Thread drug007 via Digitalmars-d-learn
On 12.06.2024 21:57, bachmeier wrote: On Wednesday, 12 June 2024 at 18:36:26 UTC, Vinod K Chandran wrote: On Wednesday, 12 June 2024 at 15:33:39 UTC, bachmeier wrote: A SafeRefCounted example with main marked @nogc: ``` import std; import core.stdc.stdlib; struct Foo {   double[] data;   doub

Re: How to use D without the GC ?

2024-06-11 Thread drug007 via Digitalmars-d-learn
On 11.06.2024 17:59, Kagamin wrote: 1) arena allocator makes memory manageable with occasional cache invalidation problem 2) no hashtable no problem [OT] could you elaborate what problems they cause? 3) error handling depends on your code complexity, but even in complex C# code I found excep

Re: How to generate a random number from system clock as seed

2024-06-09 Thread drug007 via Digitalmars-d-learn
On 09.06.2024 16:37, Eric P626 wrote: On Saturday, 8 June 2024 at 18:25:20 UTC, drug007 wrote: ~~~     {     const seed = castFrom!long.to!uint(Clock.currStdTime);     auto rng = Random(seed);     auto result = generate!(() => uniform(0, 10, rng))().take(7); // new random number

Re: How to generate a random number from system clock as seed

2024-06-08 Thread drug007 via Digitalmars-d-learn
On 08.06.2024 16:19, Eric P626 wrote: I managed to create a random number generator using the following code: ~~~ auto rng = Random(42); // uniform(0,10,rng); ~~~ Now I want to seed the generator using system time. I looked at Date & time functions/classes and systime functions/classes. Th

Re: Recommendation on plotting library

2023-07-20 Thread drug007 via Digitalmars-d-learn
20.07.2023 05:37, Chris Piker пишет: Hi D One of my jobs is to release and maintain public data archives from long-running scientific instruments.  In order to help people understand how to process the data, sample code is often included with the archive. Recently this has been in the form of

Re: How to free memory ater use of "new" to allocate it.

2023-07-17 Thread drug007 via Digitalmars-d-learn
17.07.2023 15:45, Alain De Vos пишет: This works also: [snipped] Despite this time you use new you still allocate your class on stack using scope and its scope still is `dofun`. But I just want to inform you. Your solutions work. Don't get me wrong. N.B. I would say if you do not have TH

Re: How to free memory ater use of "new" to allocate it.

2023-07-17 Thread drug007 via Digitalmars-d-learn
17.07.2023 13:17, Alain De Vos пишет: The following code works: ``` import std.stdio:writefln; import object: destroy; import core.memory: GC; import core.stdc.stdlib: malloc,free; import std.typecons; class C { int * pa; int [] a;     // Constructor     this() {writefln("

Re: How get struct value by member name string ?

2023-05-30 Thread drug007 via Digitalmars-d-learn
30.05.2023 11:46, John Xu пишет: How to put above enum as a function parameter? Following code wouldn't work:     string getTMember(T t, enum string memberName) {     return __traits(getMember, t, memberName);     } My database table is very wide, with many columns. Above ddbc allows

Re: Coding Challenges - Dlang or Generic

2023-01-10 Thread drug007 via Digitalmars-d-learn
10.01.2023 14:23, drug007 пишет: 10.01.2023 13:57, matheus пишет: On Tuesday, 10 January 2023 at 05:21:15 UTC, H. S. Teoh wrote: Printing it in this format is trivial, and not very interesting.  The interest in the challenge is to lay it out like I posted, side-by-side,... Like I said I di

Re: Coding Challenges - Dlang or Generic

2023-01-10 Thread drug007 via Digitalmars-d-learn
10.01.2023 13:57, matheus пишет: On Tuesday, 10 January 2023 at 05:21:15 UTC, H. S. Teoh wrote: Printing it in this format is trivial, and not very interesting.  The interest in the challenge is to lay it out like I posted, side-by-side,... Like I said I did it over D online compiler which

Re: Is `void` the correct way to say "do not initialize this variable"?

2022-10-03 Thread drug007 via Digitalmars-d-learn
On 10/3/22 09:35, tsbockman wrote: On Sunday, 2 October 2022 at 23:45:45 UTC, drug007 wrote: It works but not as someone could expect. In case of ```D Foo[2] arr = void; ``` `arr` value is not defined, it is not an initialized array of uninitialized elements like you want, it is just uninitiali

Re: Is `void` the correct way to say "do not initialize this variable"?

2022-10-02 Thread drug007 via Digitalmars-d-learn
On 10/3/22 02:30, ryuukk_ wrote: I have tried to look at the documentation and various places on the DMD source, but i couldn't find the answer https://dlang.org/spec/declaration.html#void_init ```D MyStruct test = void; ``` Does this guarantee that the compiler will not initialize it? Ye

Re: std.container.array.Array is not @nogc?

2017-01-15 Thread drug007 via Digitalmars-d-learn
On 15.01.2017 15:49, Jack Stouffer wrote: No you're not. Array was designed before the @nogc attribute was created, so it wasn't coded with it's requirements in mind. Looking at the code, Array allocates GC memory for exception throwing in some cases. These can and should be changed to asserts.

std.container.array.Array is not @nogc?

2017-01-15 Thread drug007 via Digitalmars-d-learn
Is there a way to use Array in @nogc code: ``` import std.container.array : Array; @nogc: void main(string[ ] args) { Array!int ai; ai ~= 1; assert(ai[0] == 1); } ``` fails: ``` main.d(8): Error: @nogc function 'D main' cannot call non-@nogc function 'std.container.array.Array!int.Array

Re: Accessing members through pointers to structs (also, CTFE associative arrays)

2016-12-13 Thread drug007 via Digitalmars-d-learn
On 13.12.2016 23:30, Ali wrote: Hi, Long time watcher and recently started playing with D a bit more. Ran in to a couple of snags that I'll combine in one post. It involves a data set that contains a list of strings. Each string represents a Room name. What I'm trying to do is pluck out the room

Re: Using the result of a comma expression is deprecated

2016-11-27 Thread drug007 via Digitalmars-d-learn
On 27.11.2016 14:07, Suliman wrote: I am getting deprecation message: "Using the result of a comma expression is deprecated" on this code: string sqlinsert = (`INSERT INTO usersshapes (userlogin, uploading_date, geometry_type, data) VALUES ('%s', '%s', '%s', '%s') `, login, uploading_date, geome

Re: How do i convert this Makefile to dub

2016-08-08 Thread drug007 via Digitalmars-d-learn
On 08.08.2016 21:48, Adil wrote: On Monday, 8 August 2016 at 18:45:35 UTC, drug007 wrote: On 08.08.2016 21:35, Adil wrote: On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: [...] One minor addition. I use the Makefile in our CI tool, that inserts auto-increment numbers in place of git ha

Re: How do i convert this Makefile to dub

2016-08-08 Thread drug007 via Digitalmars-d-learn
On 08.08.2016 21:35, Adil wrote: On Monday, 8 August 2016 at 18:29:54 UTC, Adil wrote: I have a Makefile setup that I use to return the latest git tag/commit from within my program. The setup is as below: VERSIONED_LIB = myversion.d && rm -f myversion.d VERSION_STRING ?= $(shell git rev-p

Re: Array of const objects with indirections and std.algorithm.copy

2016-07-28 Thread drug007 via Digitalmars-d-learn
On 28.07.2016 21:45, Ali Çehreli wrote: On 07/27/2016 04:51 AM, drug wrote: > cfoo.copy(foo); // fails to compile because phobos in case of array uses > // array specialization and this specialization fails > // see > https://github.com/dlang/phobos/blob/v2.07