Beerconf May

2024-05-11 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! This month, we are having our favorite online gathering on the 25-26 of May. We will announce the stream the day of the 25th. Please note that May 17th is the deadline for dconf submissions! Don't be shy, we love new speakers, and you get a free trip if you are chosen! See the

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 Steven Schveighoffer via Digitalmars-d-learn
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 first dereference for the second call, without checking whether the referred value has changed! This

Re: "in" operator gives a pointer result from a test against an Associative Array?

2024-05-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 10 May 2024 at 01:00:09 UTC, Andy Valencia wrote: On Friday, 10 May 2024 at 00:40:01 UTC, Meta wrote: Yes. The reason for this is that it avoids having to essentially do the same check twice. If `in` returned a bool instead of a pointer, after checking for whether the element

Re: I've finally released the source code of the neural network creator, along with the module with tools written in D.

2024-05-07 Thread Steven Schveighoffer via Digitalmars-d-announce
On Wednesday, 8 May 2024 at 02:28:56 UTC, Murilo wrote: I've placed the whole thing in my Github, there is the module called neuralnetwork.d, which contains tools for you to create neural networks, it has classes and functions. And there is the software Neural Network Creator which allows you

Re: TIL: statically initializing an Associative Array

2024-05-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 7 May 2024 at 00:10:27 UTC, Andy Valencia wrote: I had a set of default error messages to go with error code numbers, and did something along the lines of: string[uint] error_text = [ 400: "A message", 401: "A different message" ]; and got "expression is not a

Re: How can I put the current value of a variable into a delegate?

2024-05-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 6 May 2024 at 06:29:49 UTC, Liam McGillivray wrote: Delegates can be a pain, as they often have results different from what one would intuitively expect. This can easily result in bugs. Here's a line that caused a bug that took me awhile to find: ``` foreach(card; unitCards)

Re: Show dialog box for uncaught exception (Windows, lld-link)

2024-05-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 5 May 2024 at 14:55:20 UTC, SimonN wrote: My application is a graphical game. I close stdout and stderr by passing `-subsystem:windows` to `lld-link` to suppress the extra console window. For a few fatal errors (missing required resources, can't open display, ...), I throw

Re: Phobos function to remove all occurances from dynamic array?

2024-05-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 1 May 2024 at 01:09:33 UTC, Liam McGillivray wrote: This is presumably such a common task that I'm surprised it isn't easy to find the answer by searching; Is there a standard library function that removes all elements from a dynamic array that matches an input argument? In

Re: Beerconf April

2024-04-25 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 13 April 2024 at 18:39:29 UTC, Steven Schveighoffer wrote: # BEERCONF! To celebrate taxes, a great eclipse (and my birthday), we will have a nice online meetup known as Beerconf. This month it is on the 27-28. Just a friendly reminder, this is happening in 2 days! See you

Re: photon v0.7.0 with Windows support(!)

2024-04-24 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 23 April 2024 at 19:05:48 UTC, Dmitry Olshansky wrote: On Tuesday, 23 April 2024 at 17:15:13 UTC, Sönke Ludwig wrote: I guess that the Darwin support will be restricted to freely distributed macOS applications, as calling `__syscall` surely is a private API that cannot be used in

Re: Adapting foreign iterators to D ranges

2024-04-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote: The first implementation has the advantage is being simpler and empty being const, but has the downside that next is called even if the range ends up not being used. Is either approach used consistently across the D ecosystem? I always

Re: Statically compiled binary with C interop crashes.

2024-04-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 18 April 2024 at 11:05:07 UTC, yabobay wrote: On Wednesday, 17 April 2024 at 15:24:07 UTC, Ferhat Kurtulmuş wrote: On Wednesday, 17 April 2024 at 11:03:22 UTC, yabobay wrote: I'm using [dray](https://code.dlang.org/packages/dray) in my project with dub, here's the relevant parts

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 14 April 2024 at 22:36:18 UTC, Liam McGillivray wrote: On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer wrote: ```d void InitWindow(int width, int height, ref string title) { InitWindow(width, height, cast(const(char)*)title); } ``` This is invalid, a string may

Beerconf April

2024-04-13 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! To celebrate taxes, a great eclipse (and my birthday), we will have a nice online meetup known as Beerconf. This month it is on the 27-28. Obligatory link to beerconf T's: https://www.zazzle.com/store/dlang_swag/products?cg=196874696466206954 ## What is Beerconf? Check out

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 12 April 2024 at 00:04:48 UTC, Liam McGillivray wrote: Here's what I wanted to do. In the library I'm working on, there are various declarations for functions defined in an external C library following the line `extern (C) @nogc nothrow:`. Here are some examples of such

Re: How can I tell D that function args are @nogc etc.

2024-04-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 12 April 2024 at 03:57:40 UTC, John Dougan wrote: What is the procedure for bug reporting? I'm looking at the issues tracker and have no clue how to drive the search to see if this is already there. https://issues.dlang.org While entering the bug title, it does a fuzzy search

Re: How can I tell D that function args are @nogc etc.

2024-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 11 April 2024 at 03:17:36 UTC, John Dougan wrote: Interesting. Thank you to both of you. On Wednesday, 10 April 2024 at 17:38:21 UTC, Steven Schveighoffer wrote: On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki) Andrew Cattermole wrote: Place your attributes

Re: mmap file performance

2024-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 11 April 2024 at 00:24:44 UTC, Andy Valencia wrote: I wrote a "count newlines" based on mapped files. It used about twice the CPU of the version which just read 1 meg at a time. I thought something was amiss (needless slice indirection or something), so I wrote the code in C.

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew Cattermole wrote: On 10/04/2024 11:21 AM, Liam McGillivray wrote: On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. So that

Re: How can I tell D that function args are @nogc etc.

2024-04-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 10 April 2024 at 11:34:06 UTC, Richard (Rikki) Andrew Cattermole wrote: Place your attributes on the right hand side of the function, not the left side. Use the left side for attributes/type qualifiers that go on the return type. Just a word of warning, this explanation

Re: Boneheaded question regarding compilation...

2024-04-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 1 April 2024 at 21:23:50 UTC, WhatMeWorry wrote: Huge fan of Mike Shah's YouTube videos regarding D and his latest for D conference: https://mshah.io/conf/24/DConf%20%20Online%202024%20_%20The%20Case%20for%20Graphics%20Programming%20in%20Dlang.pdf So I installed github desktop

Re: Release D 2.108.0

2024-04-01 Thread Steven Schveighoffer via Digitalmars-d-announce
On Monday, 1 April 2024 at 22:34:14 UTC, Iain Buclaw wrote: Glad to announce D 2.108.0, ♥ to the 36 contributors. This release comes with 8 major changes and 36 fixed Bugzilla issues, including: - In the language, named arguments for functions have been implemented and documented. - In

Re: Limits of implicit conversion of class arrays

2024-03-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 25 March 2024 at 07:16:35 UTC, Per Nordlöw wrote: On Saturday, 23 March 2024 at 11:04:04 UTC, Dmitry Olshansky wrote: The first and second is unsound (infamously allowed in Java). In the general case, yes. But, do you see any errors with the code ```d class Base {} class Derived

Re: Unittests pass, and then an invalid memory operation happens after?

2024-03-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 27 March 2024 at 21:43:48 UTC, Liam McGillivray wrote: In my current [game project](https://github.com/LiamM32/Open_Emblem), [something strange](https://github.com/LiamM32/Open_Emblem/issues/20) has happened as of a recent commit. When running `dub test`, all the unittests

Re: Beerconf March (dconf online)

2024-03-22 Thread Steven Schveighoffer via Digitalmars-d-announce
On Monday, 18 March 2024 at 22:15:49 UTC, Richard (Rikki) Andrew Cattermole wrote: Perhaps we can do the usual end of month time as well, I'll give you a ping if I can do it. Depends upon how the week leading up to it for me goes (may not go well). I missed everything, due to being on a

Re: Reworking the control flow for my tactical role-playing game

2024-03-21 Thread Steven Schveighoffer via Digitalmars-d-learn
ommended [raylib-d](https://github.com/schveiguy/raylib-d), a binding for [raylib](https://www.raylib.com/) by @Steven Schveighoffer. Raylib is a rather simple graphical library written in C. I ended up sticking with it because the website has so many easy-to-follow examples that make it ea

Re: Disable wrilten buf in docker

2024-03-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 12 March 2024 at 06:36:09 UTC, zoujiaqing wrote: Hi, my application use writeln in docker don't display. Python add -u disable it. https://stackoverflow.com/questions/29663459/why-doesnt-python-app-print-anything-when-run-in-a-detached-docker-container Use setvbuf to switch to

Beerconf March (dconf online)

2024-03-09 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! Dconf online is upon us next weekend! Instead of holding the normal beerconf at the end of the month, this month we will do a special early edition, to coincide with dconf online. We will start it on the 16th, and go through Sunday as usual. ## What is Beerconf? Check out the

Re: D Language Foundation November 2023 Monthly Meeting Summary

2024-03-04 Thread Steven Schveighoffer via Digitalmars-d-announce
g/dmd/pull/15715). Steven Schveighoffer [is working on a spec PR](https://github.com/schveiguy/dlang.org/blob/istring/spec/istring.dd).) The spec is updated (that link is dead because I deleted the branch, always good to use the `y` button on github to get a link to the direct commit). You can still

Re: New update fix

2024-03-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 2 March 2024 at 09:18:58 UTC, user1234 wrote: On Saturday, 2 March 2024 at 08:41:40 UTC, Salih Dincer wrote: SLM, What exactly did this patch with the new update fix? Nothing, it looks like what happened is that the issue was wrongly referenced by a dlang.org PR

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 23:27:49 UTC, Liam McGillivray wrote: I don't know whether I should continue this topic or start a new one now that the problem mentioned in the title is fixed. I have now uploaded some of the code to [a GitHub repository](https://github.com/LiamM32/Open_Emblem).

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 22:40:49 UTC, Liam McGillivray wrote: On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote: You can't give a class the same name as the file it's in. If you do, then when you try to use it from another file, the compiler will get confused and think

Re: Beerconf February 2024

2024-02-22 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 10 February 2024 at 17:07:04 UTC, Steven Schveighoffer wrote: # BEERCONF! February is the short month, but it's a tad bit longer this year. However, beerconf doesn't care about this, we still just pick the last weekend, and that isn't any different. This means, Feb 24-25

Re: Crow programming language

2024-02-16 Thread Steven Schveighoffer via Digitalmars-d-announce
On Thursday, 15 February 2024 at 23:46:10 UTC, andy wrote: On Thursday, 15 February 2024 at 15:24:37 UTC, IchorDev wrote: You can make a scope with `nothrow`, `@nogc`, etc.: I've been setting `@safe @nogc pure nothrow:` at the top of (almost) every module, but then I still have to do it at

Re: The difference between the dates in years

2024-02-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov wrote: Is it possible to calculate the difference between dates in years using regular means? Something like that ``` writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1))); ``` At the same time, keep in mind that the month and

Re: The difference between the dates in years

2024-02-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 10 February 2024 at 23:48:56 UTC, Jonathan M Davis wrote: If I understand correctly, he cares about how far into the month the dates are, whereas diffMonths ignores the smaller units, meaning that you get the same result no matter when in the month the dates are. So, 2000-05-10

Re: The difference between the dates in years

2024-02-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 10 February 2024 at 15:53:09 UTC, Alexander Zhirov wrote: Is it possible to calculate the difference between dates in years using regular means? Something like that ``` writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1))); ``` At the same time, keep in mind that the month and

Beerconf February 2024

2024-02-10 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! February is the short month, but it's a tad bit longer this year. However, beerconf doesn't care about this, we still just pick the last weekend, and that isn't any different. This means, Feb 24-25 is the time for having conversations about D and other fun stuff! Obligatory link

Re: Beerconf January 2024

2024-02-08 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 21 January 2024 at 02:27:03 UTC, Steven Schveighoffer wrote: Hi everyone! On Saturday the 27th, at 17:00 UTC, github user Chibisi has asked to give a presentation on his project, [Saucer](https://github.com/chibisi/saucer). The purpose of the saucer project is to create

Re: How to get the client's MAC address in Vibe

2024-02-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 7 February 2024 at 22:16:54 UTC, Alexander Zhirov wrote: Is there a way to identify a client by MAC address when using the Vibe library? The `NetworkAddress` [structure](https://vibed.org/api/vibe.core.net/NetworkAddress) does not provide such features. Or did I miss something?

Re: Scripting with Variant from std.variant: parameter passing

2024-02-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 2 February 2024 at 08:22:42 UTC, Carl Sturtivant wrote: It seems I cannot pass e.g. an int argument to a Variant function parameter. What's the simplest way to work around this restriction? You'd have to implement the function that accepts the parameters and wraps in a Variant.

Re: import locality with function parameters

2024-02-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 2 February 2024 at 00:29:51 UTC, Carl Sturtivant wrote: Hello, I seem to recall that there is surprising template to import a module and get a type from it inside the declaration of the type of a parameter to a function, so that the module need not be imported outside of the

Re: Effective String to Date conversion?

2024-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 22 January 2024 at 10:56:04 UTC, atzensepp wrote: Dear D-gurus, being new to D I am trying my first steps and the language is quite intuitive and appealing. When reading a file and creating a hash for the reocrds I want to get only the most recent ones. For this I need to convert

Re: Safety is not what you think

2024-01-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 30 January 2024 at 15:38:26 UTC, Paul Backus wrote: This definitely isn't allowed in C or C++. I wonder what the rationale is for having this behavior in D? It isn't allowed in C, but allowed in C++ https://godbolt.org/z/9xTPhsb5G As for rationale... I don't know why it wouldn't

Re: Preparing for the New DIP Process

2024-01-27 Thread Steven Schveighoffer via Digitalmars-d-announce
On Thursday, 25 January 2024 at 15:03:41 UTC, Max Samukha wrote: On Monday, 22 January 2024 at 23:28:40 UTC, Jonathan M Davis wrote: Of course, ultimately, different programmers have different preferences, and none of us are going to be happy about everything in any language. It's not

Re: Accessing array elements with a pointer-to-array

2024-01-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 26 January 2024 at 11:38:39 UTC, Stephen Tashiro wrote: On Thursday, 25 January 2024 at 20:36:49 UTC, Kagamin wrote: On Thursday, 25 January 2024 at 20:11:05 UTC, Stephen Tashiro wrote: void main() { ulong [3][2] static_array = [ [0,1,2],[3,4,5] ];

Re: Beerconf January 2024

2024-01-27 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 27 January 2024 at 16:05:46 UTC, Richard (Rikki) Andrew Cattermole wrote: Reminder Chibisi's talk on https://github.com/chibisi/saucer is in an hour! The purpose of the saucer project is to create bidirectional interop between R, the statistics programming language and D. The

Re: Beerconf January 2024

2024-01-25 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 14 January 2024 at 20:29:06 UTC, Steven Schveighoffer wrote: # BEERCONF! Happy new year! It's getting to be that time again, where we chat about our favorite language, and enjoy some beverages! If it seems like it's been a long time, that's because it has. Last month's Beerconf

Re: Would this be a useful construct to add to D? auto for constructor call.

2024-01-23 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 23 January 2024 at 11:11:00 UTC, ryuukk_ wrote: On Tuesday, 23 January 2024 at 06:30:08 UTC, Jonathan M Davis wrote: That being said, I expect that it would be pretty easy to write a mixin to do something like that if you really wanted to. Also, if you're simply looking to not have

Re: Providing implicit conversion of

2024-01-21 Thread Steven Schveighoffer via Digitalmars-d-learn
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 (without any warning(s)): johnstone -11 However you choose to look at

Re: sqlite support added to sqlbuilder

2024-01-21 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 21 January 2024 at 21:27:30 UTC, zoujiaqing wrote: Thank you! I want postgresql :) It should be pretty straightforward. I had to rewrite a lot of it to fit the API of sqlite, those changes should make it easier to add postgresql (which is on my todo list). -Steve

Re: Delegates and values captured inside loops

2024-01-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 21 January 2024 at 14:52:45 UTC, Renato wrote: On Saturday, 20 January 2024 at 16:53:12 UTC, ryuukk_ wrote: This is the workaround according to: https://issues.dlang.org/show_bug.cgi?id=21929#c9 Go used to have the same issue [but they fixed

Re: Beerconf January 2024

2024-01-20 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 14 January 2024 at 20:29:06 UTC, Steven Schveighoffer wrote: # BEERCONF! The next one will be January 27-28, and I hope to see you all there! Hi everyone! On Saturday the 27th, at 17:00 UTC, github user Chibisi has asked to give a presentation on his project, [Saucer](https

Re: vector crash

2024-01-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 18 January 2024 at 03:07:13 UTC, zjh wrote: ```d import dparse.ast; import dparse.lexer; import dparse.parser : parseModule; import dparse.rollback_allocator : RollbackAllocator; import core.stdcpp.vector; import core.stdcpp.string; ... ``` I have no experience with using cpp from

Re: `static` function ... cannot access variable in frame of ...

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 22:23:27 UTC, Bastiaan Veelo wrote: On Monday, 15 January 2024 at 18:43:43 UTC, user1234 wrote: The two calls are not equivalent. so what is passed as alias need to be static too. Thanks all. I thought a static member function just isn't able to access the

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 18:40:00 UTC, bomat wrote: Sorry, I probably should have mentioned I was on Windows. For testing it under Linux I commented out the call to `connectMongoDB`, since I don't have it installed there - and the warning went away. Interesting, I did not suspect that as

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 15 January 2024 at 17:24:40 UTC, bomat wrote: On Sunday, 14 January 2024 at 20:36:44 UTC, Steven Schveighoffer wrote: There should be a version you can enable that tells you where that socket handle was allocated. That might give you a further clue as to why it's not closed when

Re: Socket handle leak and active handle warning with Vibe-D

2024-01-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 13 January 2024 at 20:49:54 UTC, bomat wrote: I am still getting this in 2024 and vibe.d 0.9.7: ``` Warning: 1 socket handles leaked at driver shutdown. ``` I was wondering if maybe someone has new info on this... There should be a version you can enable that tells you where

Beerconf January 2024

2024-01-14 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! Happy new year! It's getting to be that time again, where we chat about our favorite language, and enjoy some beverages! If it seems like it's been a long time, that's because it has. Last month's Beerconf was early, but now that the holidays are over, we are back to a normal

Re: Non-blocking keyboard input

2024-01-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 14 January 2024 at 13:41:26 UTC, Joe wrote: This does not actually work on my computer. It still blocks. Adam is no longer using mainstream D, and apparently not posting on this forum. I suggest you try to contact him via the arsd github page: https://github.com/adamdruppe/arsd

Re: sqlite support added to sqlbuilder

2024-01-04 Thread Steven Schveighoffer via Digitalmars-d-announce
On Thursday, 4 January 2024 at 18:03:56 UTC, Leonardo wrote: On Saturday, 30 December 2023 at 22:11:55 UTC, Steven Schveighoffer wrote: auto andrei = db.fetchOne(select(ads).where(ads.firstname, " = 'Andrei'")); How SQL injection are avoided here? SQL injection is avoided

Re: Release D 2.106.1

2024-01-01 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 2 January 2024 at 02:48:29 UTC, Andrej Mitrovic wrote: Does anyone know when did named arguments initially land in the compiler, as part of which release..? I never saw it as a headline feature in any previous release notes. They are not finished yet, which is why they were not

Re: Synchronisation help

2024-01-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 1 January 2024 at 15:48:16 UTC, Anonymouse wrote: What is the common solution here? Do I add a module-level `Object thing` and move everything accessing the AA into `synchronized(.thing)` statements? Or maybe add a `shared static` something to `Foo` and synchronise with

sqlite support added to sqlbuilder

2023-12-30 Thread Steven Schveighoffer via Digitalmars-d-announce
https://code.dlang.org/packages/sqlbuilder This project is something I use extensively in my work project, and allows dynamic building of SQL statements in a way that automatically deals with joins. It also automatically serializes directly to structs representing database rows. It was

Re: jsoniopipe now supports JSON5

2023-12-29 Thread Steven Schveighoffer via Digitalmars-d-announce
On Friday, 29 December 2023 at 08:04:31 UTC, Zz wrote: Any plans on having an interface similar to std.json? I replied on the [learn forum](https://forum.dlang.org/post/szepssmksyrcdzbvs...@forum.dlang.org). -Steve

Re: jsoniopipe - exaples?

2023-12-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 29 December 2023 at 08:09:58 UTC, Zz wrote: Hi, Here are some samples from the std.json documentation. Any idea on how to do something similar using jsoniopipe? Directly copied from https://dlang.org/phobos/std_json.html import std.conv : to; // parse a file or string of json into

Re: How to get serve-d to find dub dependencies

2023-12-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 23 December 2023 at 16:28:28 UTC, Renato wrote: On Saturday, 23 December 2023 at 16:13:01 UTC, Renato wrote: I am trying to use dependencies, so I need dub. On emacs, the imports from dub libraries cannot be found, even though dub can build it fine. How can I get emacs/serve-d

Re: Operator "+=" overloading for class?

2023-12-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 18 December 2023 at 14:38:14 UTC, Ki Rill wrote: your code just return result value, but it should not return but save result to "this" see example at https://dlang.org/spec/operatoroverloading.html#index_op_assignment I get an error, but don't understand why. ```d auto

Re: Beerconf December 2023

2023-12-14 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 2 December 2023 at 21:48:21 UTC, Steven Schveighoffer wrote: # BEERCONF! So it's now down to December 16-17, which is in 2 weeks. Now in 2 days. See you there! -Steve

Re: Manually relesing memory

2023-12-09 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 9 December 2023 at 10:12:11 UTC, Vlad Stanimir wrote: I am new to the language and am curios about manual memory management options. From what i can tell dlang offers the option for both manul and automatic management of memory resources. You might find all the answers in

Re: now I need -allinst when dmd compiles the unittest

2023-12-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 1 December 2023 at 22:00:52 UTC, kdevel wrote: If I not use -allinst the linker complains when using the current msgpack-d v1.0.5, e.g. [...]msgpack-d/src/msgpack/package.d:203: undefined reference to `pure nothrow @nogc @safe immutable(char)[]

Re: Advent of Code 2023

2023-12-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 3 December 2023 at 18:56:32 UTC, Johannes Miesenhardt wrote: On Sunday, 3 December 2023 at 14:51:37 UTC, Siarhei Siamashka wrote: [...] Thanks, this is super helpful. I have one other question, in the solution you posted and also the one I posted in the discord today. I was

Beerconf December 2023

2023-12-02 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! Beerconf this month is not on December 30-31, because that's new years eve. It's not on December 23-24 because that's Christmas eve So it's now down to December 16-17, which is in 2 weeks. Note that even though I didn't get much response to the poll I posted on Beerconf

Re: msghdr and cmsghdr mismatch for alpine musl

2023-11-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 25 November 2023 at 05:04:57 UTC, d007 wrote: `import core.sys.posix.sys.socket : msghdr, cmsghdr, iovec;` `msg_iovlen`, `msg_controllen`, `cmsg_len` is ulong for x86-64 in druntime. in alpine musl, they are int, socklen_t(uint), socklen_t(uint). Is this mismatch can

Re: Beerconf November

2023-11-23 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 12 November 2023 at 20:59:57 UTC, Steven Schveighoffer wrote: # BEERCONF! This month we will be having beerconf in 2 weeks on November 25-26. Online as usual, hope to see you all there! Happy Thanksgiving to my American friends! Beerconf in 2 days. If you haven’t yet voted, I

Re: Dirty DMD

2023-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 18 November 2023 at 18:52:07 UTC, JN wrote: Latest DMD for Windows downloaded from here: https://downloads.dlang.org/releases/2.x/2.105.3/dmd-2.105.3.exe reports version as dirty: DMD64 D Compiler v2.105.3-dirty Copyright (C) 1999-2023 by The D Language Foundation, All Rights

Re: D: How to check if a function is chained? a().b().c();

2023-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 18 November 2023 at 07:47:19 UTC, BoQsc wrote: Let's say we have a chain of functions. ``` a().b().c(); ``` I would like to have a behaviour in `a()` that would check if there is `b()` or `c()` chained to it. If `a();`is not chained: do a `writeln("You forgot to chain this

Re: DLF September 2023 Planning Update

2023-11-15 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 14 November 2023 at 20:09:53 UTC, Dennis wrote: On Tuesday, 14 November 2023 at 19:13:38 UTC, Steven Schveighoffer wrote: As I understand the current thinking, that is not what D is intending to do. Additional changes don't require a new edition to be enabled, only breaking

Re: Beerconf November

2023-11-15 Thread Steven Schveighoffer via Digitalmars-d-announce
On Sunday, 12 November 2023 at 21:12:34 UTC, Sergey wrote: At last beerconf was discussion that last week of the month is always under pressure of deadlines and plans.. There were proposals to postpone it in the middle of the month I must not have been online during that discussion. I'm

Re: DLF September 2023 Planning Update

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 14 November 2023 at 18:40:58 UTC, Adam D Ruppe wrote: On Tuesday, 14 November 2023 at 17:57:36 UTC, Steven Schveighoffer wrote: That's not any better. If you have to opt-in to the language as it exists, people are going to quit immediately. Counterpoint: javascript's "use s

Re: DLF September 2023 Planning Update

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 14 November 2023 at 16:07:26 UTC, Mike Parker wrote: Experience with deprecations has shown people don't want to take extra steps to make their outdated dependencies compile. The goal with editions is that you should never have to take any extra steps to use older code in your

Re: First Beta 2.106.0

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-announce
On Thursday, 2 November 2023 at 00:57:23 UTC, Iain Buclaw wrote: Glad to announce the first beta for the 2.106.0 release, ♥ to the 33 contributors. Kind of buried in the changelog (because it's just a few issues closed) is a really significant change coming to this version: the much-hated

Re: Struct copy constructor with inout

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 14 November 2023 at 13:58:17 UTC, Paul Backus wrote: It's easier to see if you compare the actual and expected argument lists side-by-side Expected: (ref const(S1) s) const Actual: (const(S1) ) ^ Mismatched

Re: DLF September 2023 Planning Update

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-announce
On Tuesday, 14 November 2023 at 08:18:20 UTC, Mike Parker wrote: * Editions will most likely be implemented via an attribute on the module declaration. We haven't discussed any details about that, but for now, just imagine something like `@edition(2024) module foo;`. When considering how

Re: Struct copy constructor with inout

2023-11-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 14 November 2023 at 08:50:34 UTC, dhs wrote: I am using following code: ```d struct S1 { this(ref const S1 s) const { writeln("copy"); } int i; } struct S2 { this(ref inout S2 s) inout { writeln("copy"); } int i; } void test() { const(S1) s1; S1 ss1 = s1;

Beerconf November

2023-11-12 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! This month we will be having beerconf in 2 weeks on November 25-26. Online as usual, hope to see you all there! The usual post for the official beerconf t-shirt: https://www.zazzle.com/store/dlang_swag/products?cg=196874696466206954 ## What is beerconf? Check out the [wiki

Re: Dlang installer with VSCode broken

2023-11-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 5 November 2023 at 22:28:29 UTC, Daniel Donnelly, Jr. wrote: This is on my friend's machine, who I am teaching D. What can be done? Can you describe what you did? Also, might be helpful to file an issue on the code-d github repository itself: https://github.com/Pure-D/code-d

Re: Convert String to Date and Add ±N Hours

2023-11-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 4 November 2023 at 18:11:53 UTC, Vahid wrote: Hi, I have a date string with the format of "2023-11-04 23:10:20". I want to convert this string to Date object and also, add ±N hours to it. For example: `"2023-11-04 23:10:20" + "+2:00" = "2023-11-05 01:10:20"` `"2023-11-04

Re: why remove octal literal support?

2023-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:07:41 UTC, d007 wrote: dlang is know for compile speed, but in reality d project compile slow because so much ctfe and tempalte. Why bring more ctfe call by remmove octal literal ? octal literals are extremely error prone, because people sometimes use

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I tried std.io but write() only outputs ubyte[] while I'm trying to output text so I abandoned idea early. Just specifically to answer this, this is so you understand this is what is going into the file -- bytes. You should

Re: Beerconf October 2023

2023-10-27 Thread Steven Schveighoffer via Digitalmars-d-announce
On Saturday, 14 October 2023 at 20:15:49 UTC, Steven Schveighoffer wrote: # BEERCONF! This month we will be having beerconf in 2 weeks on October 28-29. Online as usual, hope to see you all there! A reminder that this is tomorrow! -Steve

Beerconf October 2023

2023-10-14 Thread Steven Schveighoffer via Digitalmars-d-announce
# BEERCONF! This month we will be having beerconf in 2 weeks on October 28-29. Online as usual, hope to see you all there! Halloween is coming up, need a costume? https://www.zazzle.com/store/dlang_swag/products?cg=196874696466206954 ## What is beerconf? Check out the [wiki

Re: is the array literal in a loop stack or heap allocated?

2023-10-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/10/23 10:54 PM, mw wrote: Hi, I want to confirm: in the following loop, is the array literal `a` vs. `b` stack or heap allocated? and how many times? ask the compiler: ```d void main() @nogc { int[2] a; int[] b; int i; while(++i <=100) { a = [i, i+1]; // array literal //b =

Re: T[] opIndex() Error: .. signal 11

2023-10-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/5/23 1:49 AM, ag0aep6g wrote: For some further reading, there's an open issue about the unexpected slicing: https://issues.dlang.org/show_bug.cgi?id=14619 Thank you I had forgotten about that issue! -Steve

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/3/23 11:12 AM, Joel wrote: The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? It's a stack overflow. when doing foreach on your type, the compiler *always* uses a slice first if it

Re: The difference between T[] opIndex() and T[] opSlice()

2023-10-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/3/23 12:09 PM, Paul Backus wrote: On Tuesday, 3 October 2023 at 13:07:00 UTC, Steven Schveighoffer wrote: Now, you can define a further `opIndexAssign(T val, size_t idx)`. However, now you lose capabilities like `a[0]++`, which I don't think has a possibility of implementing using

Re: The difference between T[] opIndex() and T[] opSlice()

2023-10-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 2 October 2023 at 20:42:14 UTC, Paul Backus wrote: On Monday, 2 October 2023 at 20:34:11 UTC, Salih Dincer wrote: In an old version (for example, v2.0.83), the code you implemented in the places where Slice is written above works as desired. In the most current versions, the

Re: The difference between T[] opIndex() and T[] opSlice()

2023-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/23 1:41 PM, Salih Dincer wrote: Hi, What is the difference between T[] opIndex() and T[] opSlice(), which haven't parameters? None. It used to be that opSlice was the only way, and the mechanisms opSlice uses are still valid. -Steve

Re: Straight Forward Arrays

2023-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/23 1:13 PM, dhs wrote: It may not be a problem in practice. My concern was performance, because each time we add an element to the array, the garbage collector has to map the slice to the allocation it belongs to. FWIW, there is a cache that makes this decently fast, so it doesn't

Re: Straight Forward Arrays

2023-10-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/1/23 10:34 AM, Steven Schveighoffer wrote: The complexity is from the way d does operator overloading and indexing. It should be pretty straightforward. I’ll see if I can post a simple wrapper. I didn't tackle any attribute or memory safety issues, or many operator overloads

  1   2   3   4   5   6   7   8   9   10   >