Re: How do I install a non-outdated D compiler on Linux? (not in userspace-container)

2024-06-07 Thread bachmeier via Digitalmars-d-learn
On Saturday, 8 June 2024 at 00:21:59 UTC, solidstate1991 wrote: On Friday, 7 June 2024 at 23:19:37 UTC, solidstate1991 wrote: I **need** to link against various system libraries, and otherwise some tools won't be able to access the D compiler unless I start them from a command line after an in

Re: How to use D without the GC ?

2024-06-12 Thread bachmeier via Digitalmars-d-learn
A SafeRefCounted example with main marked @nogc: ``` import std; import core.stdc.stdlib; struct Foo { double[] data; double * ptr; alias data this; @nogc this(int n) { ptr = cast(double*) malloc(n*double.sizeof); data = ptr[0..n]; printf("Data has been allocated\n"); }

Re: How to use D without the GC ?

2024-06-12 Thread bachmeier via Digitalmars-d-learn
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; double * ptr; alias data this; @nogc t

Re: How to use D without the GC ?

2024-06-12 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 12 June 2024 at 20:31:34 UTC, Vinod K Chandran wrote: On Wednesday, 12 June 2024 at 18:57:41 UTC, bachmeier wrote: Try `foo[10] = 1.5` and `foo.ptr[10] = 1.5`. The first correctly throws an out of bounds error. The second gives `Segmentation fault (core dumped)`. We can use it

Re: How to use D without the GC ?

2024-06-12 Thread bachmeier via Digitalmars-d-learn
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 main marked @nogc: ``` import std; im

Re: How to use D without the GC ?

2024-06-14 Thread bachmeier via Digitalmars-d-learn
On Friday, 14 June 2024 at 07:52:35 UTC, Dukc wrote: Lance Bachmeier kirjoitti 14.6.2024 klo 4.23: We must be talking about different things. You could, for instance, call a function in a C library to allocate memory at runtime. That function returns a pointer and you pass it to SafeRefCounted

Re: ImportC "no include path set"

2024-06-22 Thread bachmeier via Digitalmars-d-learn
On Friday, 21 June 2024 at 17:40:39 UTC, mw wrote: On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote: On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote: So how am I supposed to set the include path? https://dlang.org/spec/importc.html#preprocessor The -Ppreprocessorflag s

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread bachmeier via Digitalmars-d-learn
On Monday, 11 July 2022 at 21:46:10 UTC, IGotD- wrote: Just depreciate the the DMD backend, it's just not up to the task anymore. Just deprecate LDC and GDC. They compile slowly and are unlikely to ever deliver fast compile times, due to their design. Some people say they like it because it

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread bachmeier via Digitalmars-d-learn
On Thursday, 11 August 2022 at 18:32:54 UTC, realhet wrote: On Thursday, 11 August 2022 at 18:10:31 UTC, Paul Backus wrote: ... If you remove `std.algorithm` from `testcmpmodule2`'s `public import` line, the code compiles successfully. Yes, but in the 40 module project I'm unable to make it wo

Re: std.algorithm.cmp is conflicting with itself.

2022-08-11 Thread bachmeier via Digitalmars-d-learn
On Thursday, 11 August 2022 at 22:34:11 UTC, realhet wrote: On Thursday, 11 August 2022 at 19:33:31 UTC, bachmeier wrote: std.string does a public import of std.algorithm.cmp. That was it! Thanks! Conclusion: This is how to overload cmp() A search of the forum suggests [this is how I learne

Re: Recommendation for parallelism with nested for loops?

2022-08-19 Thread bachmeier via Digitalmars-d-learn
On Friday, 19 August 2022 at 02:02:57 UTC, Adam D Ruppe wrote: Even if they aren't equal, you'll get decent benefit from parallel on the outer one alone, but not as good since the work won't be balanced. Unless there's some kind of blocking going on in D's implementation, if the number of pa

Re: Replacing tango.text.Ascii.isearch

2022-10-07 Thread bachmeier via Digitalmars-d-learn
On Friday, 7 October 2022 at 07:16:19 UTC, Siarhei Siamashka wrote: On Friday, 7 October 2022 at 06:34:50 UTC, Siarhei Siamashka wrote: Also are we allowed to artificially construct needle and haystack to blow up this test rather than only benchmarking it on typical real data? Such as generat

Re: Catching C errors

2022-10-20 Thread bachmeier via Digitalmars-d-learn
On Thursday, 20 October 2022 at 10:13:41 UTC, Sergey wrote: On Thursday, 20 October 2022 at 09:52:05 UTC, data pulverizer wrote: I'm currently writing a D interop with R, the dynamic statistical programming language. There's a function called How is your project related to EmbedR? The descrip

Re: Find in assoc array then iterate

2022-10-22 Thread bachmeier via Digitalmars-d-learn
On Saturday, 22 October 2022 at 04:53:09 UTC, Kevin Bailey wrote: Steven, Just because you don't see the value doesn't mean I don't. You should try to be more helpful, or don't bother. Programs are written to do things that have value. Programming languages are designed to support that goa

Re: Using glibc headers with ImportC

2022-11-12 Thread bachmeier via Digitalmars-d-learn
On Saturday, 12 November 2022 at 15:08:22 UTC, qua wrote: On Saturday, 12 November 2022 at 14:57:23 UTC, Adam D Ruppe wrote: I still don't think that's been released yet, so if you aren't on the git master or at least the latest beta build it isn't going to work. Which dmd version are you runni

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread bachmeier via Digitalmars-d-learn
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: Dear dlang community. I am unsure about what idiomatic D is. Idiomatic D code produces the correct result, it's readable, and it's easy for others to use. Some of the Dconf talks tells people just to use the GC, until you can't affo

Re: Solving optimization problems with D

2023-01-03 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 3 January 2023 at 21:13:55 UTC, Sergey wrote: On Sunday, 1 January 2023 at 21:11:06 UTC, Ogi wrote: I’ve read this [series if articles](https://www.gamedeveloper.com/design/decision-modeling-and-optimization-in-game-design-part-1-introduction) about using Excel Solver for all kinds o

Re: Coding Challenges - Dlang or Generic

2023-01-10 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 10 January 2023 at 01:22:33 UTC, H. S. Teoh wrote: Here's a challenge. Given an input year, for example, "2023", write a program that outputs (for the corresponding year): snip- 2023

Re: Problem with ImportC example?

2023-01-17 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 17 January 2023 at 13:21:37 UTC, DLearner wrote: On Tuesday, 17 January 2023 at 11:21:08 UTC, Dennis wrote: On Tuesday, 17 January 2023 at 11:16:25 UTC, DLearner wrote: ``` C:\Users\SoftDev\Documents\BDM\D\ImportC>dmd ex01.c ex01.c(1): Error: C preprocessor directive `#include` is

Re: Problem with ImportC example?

2023-01-18 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 18 January 2023 at 16:37:17 UTC, Ali Çehreli wrote: On 1/18/23 08:04, DLearner wrote: > Unfortunately, neither works: > ``` > C:\Users\SoftDev>cl.exe > 'cl.exe' is not recognized as an internal or external command, > operable program or batch file. That supports the theory that yo

Re: Problem with ImportC example?

2023-01-18 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 18 January 2023 at 16:51:27 UTC, bachmeier wrote: On Wednesday, 18 January 2023 at 16:37:17 UTC, Ali Çehreli wrote: On 1/18/23 08:04, DLearner wrote: > Unfortunately, neither works: > ``` > C:\Users\SoftDev>cl.exe > 'cl.exe' is not recognized as an internal or external > command,

Re: Are there more up-to-date D template tutorials?

2023-01-19 Thread bachmeier via Digitalmars-d-learn
On Thursday, 19 January 2023 at 04:22:21 UTC, thebluepandabear wrote: Help would be appreciated. Regards, thebluepandabear A bit off topic/ranty but I did find the book by Ali on D extremely useful, but it was good as an 'introduction'. I feel like when it comes to more advanced features (su

Re: Pyd examples or resources for Python 3.x

2023-01-19 Thread bachmeier via Digitalmars-d-learn
On Friday, 20 January 2023 at 00:39:47 UTC, Seamus wrote: Howdy folks I am new around these parts and looking forward to getting stuck into some D development. Really liking it so far, just one some questions though... I am working on a project that did not sit well with me when I tried it in

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear wrote: I recently did a fresh install of CSFML and I am getting this errors when running my csfml D bindings program: ``` object.Exception@source/app.d(38): Fatal error(s) encountered whilst calling `loadSFML()` function: ["Error: l

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-03 Thread bachmeier via Digitalmars-d-learn
On Friday, 3 February 2023 at 12:23:40 UTC, thebluepandabear wrote: On Friday, 3 February 2023 at 11:43:46 UTC, thebluepandabear wrote: On Friday, 3 February 2023 at 11:37:43 UTC, bachmeier wrote: On Friday, 3 February 2023 at 10:15:37 UTC, thebluepandabear wrote: I recently did a fresh install

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-04 Thread bachmeier via Digitalmars-d-learn
On Saturday, 4 February 2023 at 05:29:43 UTC, thebluepandabear wrote: I have tested on arch linux and everything works fine, i'll try to setup a linux mint / ubuntu VM tomorrow Thanks. It seems like an issue with my system then. I've been stuck on it for a week or so, but haven't been able

Re: betterC DLL in Windows

2023-02-04 Thread bachmeier via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:29:41 UTC, Tamas wrote: What's the reason to prefer LDC over DMD? Anyone that cares about performance will use LDC rather than DMD. It's hard to imagine a case where someone would want betterC to avoid the GC, but they wouldn't want to use LDC. When I start

Re: betterC DLL in Windows

2023-02-04 Thread bachmeier via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:40:51 UTC, Tamas wrote: It is hopelessly broken, but thankfully, it also brings zero benefit, so simply not using it is a viable path forward. I do take your word for it, but now I have to re-evaluate my expectations towards D and perhaps use it for another

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-04 Thread bachmeier via Digitalmars-d-learn
On Saturday, 4 February 2023 at 23:51:17 UTC, thebluepandabear wrote: "Error: Missing Symbol, Message: sfText_getLineSpacing", "Error: Missing Symbol, Message: sfText_getLineSpacing"] source/app.d:19 void app.loadDyn() [0x55d86edd1931] source/app.d:24 _Dmain [0x55d86edd1954] ```

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-06 Thread bachmeier via Digitalmars-d-learn
On Sunday, 5 February 2023 at 03:38:04 UTC, thebluepandabear wrote: On Sunday, 5 February 2023 at 03:19:43 UTC, bachmeier wrote: Something of a puzzle that it works with Arch, though, but not Ubuntu/Mint. It doesn't sound like Arch has that problem. What problem doesn't Arch have, the missin

Re: ImportC "no include path set"

2023-02-06 Thread bachmeier via Digitalmars-d-learn
On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote: So how am I supposed to set the include path? https://dlang.org/spec/importc.html#preprocessor The -Ppreprocessorflag switch passes preprocessorflag to the preprocessor. So if you normally use `-I/foo`, you'd add `-P-I/foo`.

Re: betterC DLL in Windows

2023-02-06 Thread bachmeier via Digitalmars-d-learn
On Sunday, 5 February 2023 at 08:48:34 UTC, Tamas wrote: I appreciate all of this... however, as a newcomer, I wish the docs were simply more honest, instead of representing wishful thinking. I guess in any programming language, experience reveals things not present in the docs, but it seems t

Re: ImportC "no include path set"

2023-02-08 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 8 February 2023 at 06:49:06 UTC, Elfstone wrote: I believe all three versions (2017,2019,2022) of my VS are up to date, and I have working C/C++ projects on them. But you encouraged me to give a few more tries, and I found out I had been using ..bin64/dmd.exe. Running ..bin/dmd.ex

Re: ImportC "no include path set"

2023-02-09 Thread bachmeier via Digitalmars-d-learn
On Thursday, 9 February 2023 at 06:07:35 UTC, Elfstone wrote: Maybe Walter doesn't care about Windows enough, but I thought it'd be a must to add basic tests (say, "dmd hello.c") to run on all the platforms before release. Unlikely, since his text editor [doesn't even compile on Linux](https

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

2023-02-09 Thread bachmeier via Digitalmars-d-learn
On Thursday, 9 February 2023 at 23:51:18 UTC, thebluepandabear wrote: btw. When a newbie to D raises ideas, suggestions, etc... and you counter them with (in essence) 'we don't need that in D, but go write a dip if you think we do' attitude, is a real turn off. yeah it seems like the communit

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

2023-02-09 Thread bachmeier via Digitalmars-d-learn
On Friday, 10 February 2023 at 00:18:59 UTC, Ali Çehreli wrote: On 2/9/23 15:58, thebluepandabear wrote: >> In contrast, I use D every day and love its relaxed attitude towards >> private. > > the fact that private stuff is accessible from other classes in the same > module is really really bad,

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

2023-02-10 Thread bachmeier via Digitalmars-d-learn
On Friday, 10 February 2023 at 07:04:31 UTC, Max Samukha wrote: Having class-private doesn't preclude module-private. Dennis even submitted a PR implementing class-private, but it stalled because people couldn't agree on whether class-private should be "private to class" or "private to class i

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

2023-02-14 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 10:16:47 UTC, ProtectAndHide wrote: In any case, there is nothing 'picky' about wanting to be able to explicately 'declare' a member of my class type as being private. That to me, is what a programmer should expect to be able to do in a language that says it su

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

2023-02-14 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 02:14:30 UTC, Mike Parker wrote: On Wednesday, 15 February 2023 at 01:16:00 UTC, thebluepandabear wrote: I think what you could say is that D lacks _encapsulation_ which is also an OOP concept. So D is partially OOP but not fully OOP due to there being no e

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

2023-02-15 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 19:44:50 UTC, ProtectAndHide wrote: A user-defined type is a type that has a mechanism to keep it representation private. D does not support this. It only enables it. You (and others) may well argue that D should not enable this (directly), it should only s

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

2023-02-15 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 07:13:41 UTC, thebluepandabear wrote: Time to move on to OCaml programmers telling us D doesn't have floating point arithmetic because there's no `+.` operator. that's not the same thing though, you've created a great false equivalence! Congrats. Only if you

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

2023-02-16 Thread bachmeier via Digitalmars-d-learn
On Thursday, 16 February 2023 at 21:23:53 UTC, ProtectAndHide wrote: Forcing programmers to use a design mechanism rather than a language mechanism to achieve the above abstraction is wrong. This seems to be the source of the disagreement, correct? There's no disagreement. It's you posting t

Re: stdin.readln line editing and recall with up arrow

2023-02-25 Thread bachmeier via Digitalmars-d-learn
On Saturday, 25 February 2023 at 08:45:27 UTC, Daren Scot Wilson wrote: On Saturday, 25 February 2023 at 05:41:48 UTC, Richard (Rikki) Andrew Cattermole wrote: On 25/02/2023 6:36 PM, Daren Scot Wilson wrote: stdin.readln() works fine until I, out of habit, use the up arrow to recall an earlier

Re: Implicit type conversion depending on assignment

2023-03-24 Thread bachmeier via Digitalmars-d-learn
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov wrote: Is it possible to convert such records inside the structure to the assigned type? ```d struct MyVal { string value; // Here it would be possible to use an alias to this, but it can only be used 1 time } auto a = MyVa

Re: Implicit type conversion depending on assignment

2023-03-24 Thread bachmeier via Digitalmars-d-learn
On Friday, 24 March 2023 at 13:53:02 UTC, bachmeier wrote: On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov wrote: Is it possible to convert such records inside the structure to the assigned type? ```d struct MyVal { string value; // Here it would be possible to use an alia

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-31 Thread bachmeier via Digitalmars-d-learn
On Friday, 31 March 2023 at 16:26:36 UTC, ryuukk_ wrote: I disagree, global mutables are not bad That the same bad advice as telling people to "embrace OOP and multiple inheritance" and all the Java BS "just put your variable into a class and make it static, and then have your singleton to

Re: ImportC issue?

2023-04-19 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 10:21:22 UTC, DLearner wrote: C source ex01.c: ``` #include int main() { printf("hello world\n"); return 0; } ``` 'dmc ex01.c' produces message: ``` link ex01,,,user32+kernel32/noi; ``` but does generate .obj, .map and .exe files, and the exe executes proper

Re: ImportC issue?

2023-04-19 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 13:11:45 UTC, DLearner wrote: On Wednesday, 19 April 2023 at 12:09:44 UTC, Richard (Rikki) Andrew Cattermole wrote: On 20/04/2023 12:07 AM, DLearner wrote: Error: C preprocess command sppn.exe failed for file ex01.c, exit status 1 Did you verify that sppn is acc

Re: Calling C functions that modify a string

2023-06-15 Thread bachmeier via Digitalmars-d-learn
On Thursday, 15 June 2023 at 15:53:57 UTC, Steven Schveighoffer wrote: On 6/15/23 10:04 AM, Jonathan M Davis wrote: On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer via Digitalmars-d-learn wrote: But in general, if you want a mutable character array that's zero terminated, you ne

Re: Pre-import version statements

2023-07-20 Thread bachmeier via Digitalmars-d-learn
On Thursday, 20 July 2023 at 15:45:04 UTC, Chris Piker wrote: On Thursday, 20 July 2023 at 06:44:30 UTC, Jonathan M Davis wrote: D has nothing equivalent to that. You compile your code with whichever version of dmd (or ldc, gdc, etc.) that you want, and it either compiles or it doesn't. Tha

Re: Designated initializers to function argument

2023-07-28 Thread bachmeier via Digitalmars-d-learn
On Friday, 28 July 2023 at 07:35:00 UTC, IchorDev wrote: On Tuesday, 11 July 2023 at 17:43:43 UTC, Steven Schveighoffer wrote: On 7/11/23 11:22 AM, Ki Rill wrote: On Tuesday, 11 July 2023 at 15:16:54 UTC, Ki Rill wrote: apply(Appearance(color: BLACK, strokeWidth: 4)); // other fields are defau

Re: Designated initializers to function argument

2023-07-28 Thread bachmeier via Digitalmars-d-learn
On Friday, 28 July 2023 at 17:07:37 UTC, IchorDev wrote: On Friday, 28 July 2023 at 17:04:33 UTC, bachmeier wrote: [The DIP](https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md) was approved long ago. It was waiting for an implementation. No shit, it felt like an eternity. But

Re: How can overloads be distinguished on attributes alone?

2023-07-31 Thread bachmeier via Digitalmars-d-learn
On Monday, 31 July 2023 at 16:52:03 UTC, Dennis wrote: On Monday, 31 July 2023 at 16:09:11 UTC, bachmeier wrote: Is there a reason it would be difficult to make this not compile? No, except that might result in code breakage. The only way you could have code breakage is if you have ``` void

Re: toLower

2023-08-15 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 20:09:28 UTC, Joel wrote: On Tuesday, 15 August 2023 at 16:54:49 UTC, FeepingCreature wrote: On Tuesday, 15 August 2023 at 16:47:36 UTC, Joel wrote: [...] When you pass a string to a lambda, it's evaluated in `std.functional.unaryFun`/`binaryFun`. At that point,

Re: toLower

2023-08-17 Thread bachmeier via Digitalmars-d-learn
On Thursday, 17 August 2023 at 09:28:05 UTC, Joel wrote: I get an compile time error with sort after using toLower, putting in array before sort, didn’t work: ```d void main() { Import std; "EzraTezla" .to!(char[]) .byCodeUnit .map!(

Re: I don't understand betterC

2023-09-01 Thread bachmeier 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) Y

Re: I don't understand betterC

2023-09-01 Thread bachmeier via Digitalmars-d-learn
On Saturday, 2 September 2023 at 03:18:31 UTC, confused wrote: On Friday, 1 September 2023 at 13:31:37 UTC, bachmeier wrote: You can read the documentation for object.d [here](https://dlang.org/phobos/object.html). It's kind of important. I'm not sure which specific part of the documentation

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

2023-09-08 Thread bachmeier 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 f

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

2023-09-09 Thread bachmeier via Digitalmars-d-learn
On Saturday, 9 September 2023 at 09:30:10 UTC, rempas wrote: Bingo! You and Brad found out! Hate to be that guy, but I posted a link to a stackoverflow question with the exact error message you were getting, and the solution. And I told you I had experienced the same error and that question

Re: Associate information with a pointer address.

2023-09-29 Thread bachmeier via Digitalmars-d-learn
On Friday, 29 September 2023 at 14:31:54 UTC, BoQsc wrote: After being very happy about associative arrays of D Language, I encountered that they are not `@nogc`friendly. Unsure if I should wait for D language to support it, or do I need to rethink everything. You can work with AA's inside @n

Re: Straight Forward Arrays

2023-10-01 Thread bachmeier via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tuple: (pointer to elements, length, capacity). I tried two implementations: D's dynamic array and std.container.array. Whe

Re: Straight Forward Arrays

2023-10-01 Thread bachmeier via Digitalmars-d-learn
On Sunday, 1 October 2023 at 11:39:11 UTC, bachmeier wrote: On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tuple: (pointer to elements, length, capacity). I tried two imple

Re: Associate information with a pointer address.

2023-10-01 Thread bachmeier via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:41:39 UTC, BoQsc wrote: The package dependency `emsi_containers` that can be found in https://code.dlang.org/packages/emsi_containers might be a viable way to resolve the problem. ``` /+dub.sdl: dependency "emsi_containers" version="~>0.7" +/ import std; void

Re: Define a new custom operator in D Language.

2023-10-02 Thread bachmeier via Digitalmars-d-learn
On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: Overloading seems to only overload behaviour of existing operator, like: ``` + - * / % ^^ & | ^ <<>>>>>~ in ``` I'm unable to see how the operator overloading woul

Re: how to assign multiple variables at once by unpacking array?

2023-10-07 Thread bachmeier via Digitalmars-d-learn
On Saturday, 7 October 2023 at 07:31:45 UTC, mw wrote: https://stackoverflow.com/questions/47046850/is-there-any-way-to-assign-multiple-variable-at-once-with-dlang How to do this Python code in D: ``` s = "1 2 3" A,B,C = map(int, s.split(" ")) A,B,C (1, 2, 3) ``` Is there a better way (sinc

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-10 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 10 October 2023 at 13:55:44 UTC, rempas wrote: On Tuesday, 10 October 2023 at 11:46:38 UTC, Hipreme wrote: My engine has its own implementation of toString(long), which does not have dependency with the C runtime: https://github.com/MrcSnm/HipremeEngine/blob/master/modules/util/sou

Setting GTK_BASEPATH for gtkd

2023-10-16 Thread bachmeier via Digitalmars-d-learn
On Monday, 16 October 2023 at 18:28:52 UTC, dan wrote: (Now, i still think that when module initialization order is not forced, it should be something a programmer or systems integrator can choose, but i don't want to be too greedy.) Thanks again for your help!! dan I changed the subject l

Re: Symbolic computations in D

2023-10-29 Thread bachmeier 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? The theme

Re: How do I install a package globally?

2023-11-11 Thread bachmeier via Digitalmars-d-learn
On Saturday, 11 November 2023 at 23:28:18 UTC, Trevor wrote: Thanks for the detailed reply. I guess what I'd like to do is not create a DUB package for every little project I work on. It seems like most modern languages require a package/dependency manager though. Being able to install librari

Re: D is a great language, but I've had a bad experience getting started

2023-12-14 Thread bachmeier via Digitalmars-d-learn
On Thursday, 14 December 2023 at 12:59:32 UTC, Renato wrote: On Thursday, 14 December 2023 at 12:30:35 UTC, Renato wrote: The other compilers were also easily installable on Kubuntu using snap. It seems that the Ubuntu "snap"s are not being updated for a few years?? It seems some of my

Re: D is nice whats really wrong with gc??

2023-12-22 Thread bachmeier via Digitalmars-d-learn
On Friday, 22 December 2023 at 12:53:44 UTC, bomat wrote: If you use (or even feel tempted to use) a GC, it means that you don't care about your memory. Neither about its layout nor its size, nor when chunks of it are allocated or deallocated, etc. And if you don't care about these things, you

Re: static array is not a range

2024-01-09 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 9 January 2024 at 10:11:35 UTC, Alexibu wrote: It looks like isInputRange is false for arrays with fixed length by design. I can do: ```d float[4] arr; foreach(x;arr) writefln("%s",x) ``` but not : ```d arr.each!(a => a.writefln("%s",a)); ``` Is there a good reason for this ? I

Re: The One Billion Row Challenge

2024-01-11 Thread bachmeier via Digitalmars-d-learn
On Thursday, 11 January 2024 at 08:57:43 UTC, Christian Köstlin wrote: Did someone already try to do this in dlang? I guess it will be very hard to beat the java solutions running with graalvm! https://news.ycombinator.com/item?id=38851337 Kind regards, Christian The problem with this chall

Re: Providing implicit conversion of

2024-01-21 Thread bachmeier via Digitalmars-d-learn
On Monday, 22 January 2024 at 01:14:06 UTC, Steven Schveighoffer wrote: On Sunday, 21 January 2024 at 16:05:40 UTC, Gavin Gray wrote: The following code: ulong charlie = 11; long johnstone = std.algorithm.comparison.max(0, -charlie); writeln(format!"johnstone %s"(johnstone)); Results in

Re: Providing implicit conversion of

2024-01-22 Thread bachmeier via Digitalmars-d-learn
On Monday, 22 January 2024 at 06:43:17 UTC, thinkunix wrote: Gavin Gray via Digitalmars-d-learn wrote: The following code:   ulong charlie = 11;   long johnstone = std.algorithm.comparison.max(0, -charlie);   writeln(format!"johnstone %s"(johnstone)); Results in (without any warning(s)): jo

Re: Setting field of struct object

2024-01-22 Thread bachmeier via Digitalmars-d-learn
On Monday, 22 January 2024 at 15:45:45 UTC, zjh wrote: On Monday, 22 January 2024 at 15:33:01 UTC, ryuukk_ wrote: it only took me 1 project to never want to touch C++ again.. D language used to have no `copy constructor`, isn't it now added in again? You have to admit the good aspects of `

Re: Setting field of struct object

2024-01-22 Thread bachmeier via Digitalmars-d-learn
On Monday, 22 January 2024 at 15:56:59 UTC, zjh wrote: On Monday, 22 January 2024 at 15:51:37 UTC, zjh wrote: I spent `too much time` on D. And some of the inherent `drawbacks` of `C++` are too hateful. It's a package deal. Everything in C++ is there because there were benefits when they a

Re: Providing implicit conversion of

2024-01-22 Thread bachmeier via Digitalmars-d-learn
On Monday, 22 January 2024 at 16:39:10 UTC, Nick Treleaven wrote: I've said multiple times that it's silly to spend so much time on memory safety if the language is going to allow stuff like this without a simple way to prevent it. Memory safety issues are a worse class of bug than arithmetic

Re: Providing implicit conversion of - memory-safety

2024-01-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 12:34:38 UTC, Nick Treleaven wrote: But I'm strongly in favour of catching any bugs at compile-time (and have been since before I discovered D). I just object to anyone trying to downgrade the importance of automated memory-safety checking. I'm not downgrading

Re: Providing implicit conversion of - memory-safety

2024-01-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 19:27:26 UTC, Renato wrote: Here's a reduced version of one of the most bizarre bugs I've dealt with in any language. The only reason I didn't move on to another language was because I was too busy at the time. The code allows for initial values if the index is l

Re: Providing implicit conversion of - memory-safety

2024-01-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 21:40:46 UTC, Renato wrote: While I can understand your frustration, it seems to me D is not to blame in this instance because the code is quite patently using unsafe constructs (D does not claim to be fully safe). It pretends to be safe. Consider this: ``` vo

Re: Providing implicit conversion of - memory-safety

2024-01-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 23:40:55 UTC, Danilo wrote: On Tuesday, 23 January 2024 at 17:54:25 UTC, bachmeier wrote: Here's a reduced version of one of the most bizarre bugs I've dealt with in any language. The only reason I didn't move on to another language was because I was too busy at t

Re: length's type.

2024-02-09 Thread bachmeier via Digitalmars-d-learn
On Friday, 9 February 2024 at 11:00:09 UTC, thinkunix wrote: If your issue is that the compiler didn't catch this, shouldn't you raise the issue on a compiler internals list? Maybe I've misunderstood the purpose of d-learn "Questions about learning and using D". It's been discussed many, ma

Re: length's type.

2024-02-12 Thread bachmeier via Digitalmars-d-learn
On Monday, 12 February 2024 at 17:26:25 UTC, Nick Treleaven wrote: On Friday, 9 February 2024 at 15:19:32 UTC, bachmeier wrote: It's been discussed many, many times. The behavior is not going to change - there won't even be a compiler warning. (You'll have to check with the leadership for their

Re: length's type.

2024-02-12 Thread bachmeier via Digitalmars-d-learn
On Monday, 12 February 2024 at 18:22:46 UTC, H. S. Teoh wrote: Honestly, I think this issue is blown completely out of proportion. Only for people that don't have to deal with the problems it causes. D decided on an unsigned type. You just learn that and adapt your code accordingly, end of

Re: Recommendation about templating engine library

2024-03-11 Thread bachmeier via Digitalmars-d-learn
On Monday, 11 March 2024 at 14:59:52 UTC, Ferhat Kurtulmuş wrote: You have already mentioned mustache-d. If it compiles with the recent compilers go for it. I used it some time a go for a similar task involving in d code gen. I found mustache-d easy enough and good enough for my needs. I hav

Re: How to make a struct containing an associative array to deeply copy (for repeated usage in foreach) ?

2024-03-15 Thread bachmeier via Digitalmars-d-learn
On Friday, 15 March 2024 at 20:36:56 UTC, rkompass wrote: I'm quite new to D yet. But I have some acquaintance with Python. Therefore, together with templates the discovery of the Variant type was inspiring me to the following: I wanted to explore if it's possible to do sort of type-agnostic p

Re: Best way to use large C library in D as of 2024

2024-03-26 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 19:24:39 UTC, Chris Piker wrote: Hi D I have a C library I use for work, it's maintained by an external organization that puts it through a very through test framework. Though source code is supplied, the intended use is to include the header files and link again

Re: Best way to use large C library in D as of 2024

2024-03-26 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote: On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote: Should be able to just use it, as described here: https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and then

Re: How to contact people on the forum

2019-07-24 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 24 July 2019 at 16:37:33 UTC, Greatsam4sure wrote: On Wednesday, 24 July 2019 at 15:56:43 UTC, drug wrote: 24.07.2019 18:51, Greatsam4sure пишет: Good day everyone. I am thinking,  if there is a  way to contact any person on dlang forums through mail or any other means. How do I

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:19:12 UTC, BoQsc wrote: There are some other bad news, I switched from rdmd to dub package manager since I need a package from Adam D. Ruppe. It is all good and well: this one works perfectly. #!/usr/bin/env dub /+ dub.sdl: name "hello" +/ impo

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Re: Help me decide D or C

2019-07-31 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:49:10 UTC, SashaGreat wrote: On Wednesday, 31 July 2019 at 22:16:42 UTC, bachmeier wrote: What is your goal? In my opinion, learning C is a waste of time in 2019 unless you have something specific in mind related to a job. C is mostly "fun with segmentation faul

Re: Help me decide D or C

2019-08-01 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 23:42:10 UTC, SashaGreat wrote: About Mike's book, you're talking about this one: https://www.amazon.com/Learning-D-Michael-Parker/dp/1783552484/ref=as_li_ss_tl?ie=UTF8&qid=1448974911&sr=8-1&keywords=learning+d&linkCode=sl1&tag=aldacron-20&linkId=d696b771c78030fc27

Re: Help me decide D or C

2019-08-01 Thread bachmeier via Digitalmars-d-learn
On Thursday, 1 August 2019 at 03:59:23 UTC, Bert wrote: But if you really want to learn to program I suggest you go with Haskell. You can do them all together too but Haskell is like learning Alien while D is learning German. There's nothing wrong with Haskell if you want to take a deep dive

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Friday, 2 August 2019 at 13:57:44 UTC, Bastiaan Veelo wrote: On Thursday, 1 August 2019 at 20:02:08 UTC, Aurélien Plazzotta wrote: [...] But don't fool yourself, D is not for beginners. Ali Çehreli is a very skilled programmer, ergo, he can't reason like a new/starting programmer anymore, r

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Thursday, 1 August 2019 at 22:36:06 UTC, Russel Winder wrote: On Thu, 2019-08-01 at 14:49 +, bachmeier via Digitalmars-d-learn wrote: […] There's nothing wrong with Haskell if you want to take a deep dive into pure functional programming. I personally find Haskell to be more

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk wrote: I would write my compare function and let qsort sort it out. I'm confused by this statement. Are you referring to the qsort in C's stdlib? I had never heard of using that to sort a linked list, so I searched, and it is not

Re: Sort Associative Array by Key

2019-08-27 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 27 August 2019 at 20:14:21 UTC, Machine Code wrote: It isn't really hard: It really is hard. foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => a.value); is a lot to digest for someone learning the language. There's a big difference between not being hard for someone that

Re: Is there has an pdf document for Phobos.

2019-09-04 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 12:24:47 UTC, lili wrote: On Wednesday, 4 September 2019 at 04:21:10 UTC, Mike Parker wrote: On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote: Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for d

  1   2   3   4   5   >