For example, I originally filed
[DMD#19271](https://github.com/dlang/dmd/issues/19271), but as
far as GitHub is concerned, I’m not the author of that issue so I
can’t close it.
What’s the process for that? I can comment on that issue, but how
would anyone know I did?
On Tuesday, 24 June 2025 at 02:05:40 UTC, Jonathan M Davis wrote:
There's also the issue of templated code. If an attribute is
desirable in the cases where it works, and it's fine for it to
be ignored in the cases where it doesn't apply, then that means
that you can have code such as
```d
scop
It seems a cast does more than change the static type and VRP.
```d
void foo(uint) { }
int x = -1;
foo(x); // compiles (debatable)
foo(long(x)); // compiles(!)
foo(cast(long)x); // compiles(!)
foo((() => cast(long)x)()); // Error: foo is not callable using
argument types […]
```
Why do the lat
```d
extern int x;
// int y;
```
(How) can I get the information that `x` is `extern` and `y` is
not? There seems to be no `__traits` for it.
On Thursday, 26 September 2024 at 06:53:12 UTC, Per Nordlöw wrote:
Should a function like
```d
uint parseHex(in char ch) pure nothrow @safe @nogc {
switch (ch) {
case '0': .. case '9':
return ch - '0';
case 'a': .. case 'f':
return 10 + ch
On Thursday, 25 July 2024 at 13:07:03 UTC, Jonathan M Davis wrote:
On Thursday, July 25, 2024 6:00:58 AM MDT Dom DiSc via
Digitalmars-d-learn wrote:
> And no, in general, you don't want to be casting away const
> or immutable. There are cases where it can work (e.g. if the
> cast does a copy, w
On Sunday, 21 July 2024 at 05:43:32 UTC, IchorDev wrote:
Obviously when writing optimised code it is desirable to reduce
heap allocation frequency. With that in mind, I'm used to being
told by the compiler that I can't do this in `@nogc` code:
```d
void assign(ref int[4] a) @nogc{
a[] = [1,3,6
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:
~~~
struct
On Wednesday, 5 June 2024 at 18:31:12 UTC, Basile B. wrote:
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote:
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
```d
void main(string[] args)
{
ushort a = 0b;
bool* b = cast(bool*)&a;
setIt(*b);
In the DMD compiler frontend, the type `TypeFunction` (cf.
astbase.d) representing a function type has a `linkage` member.
Setting this member when parsing seems to have no effect. How do
I set the linkage of a function type?
For alias declarations which support setting function type
linkage,
On Monday, 11 December 2023 at 23:21:45 UTC, Quirin Schroll wrote:
[…]
1. Instead of implementing a function `opApply(scope int
delegate(...))`, write a function template
`opApplyImpl(DG)(scope int delegate(...))` (or whatever name)
and let it take the delegate type as a template type paramete
In an attempt to come up with an [answer to a
post](https://forum.dlang.org/post/dnsuyvnfcszwefsfz...@forum.dlang.org), I found something odd, but useful, that I nonetheless don’t understand.
As far as I know – or rather thought I knew – `foreach` loops can
infer the types of the “loop variable
I recently removed Visual Studio 2017 and upgraded to 2022. When
I installed the latest DMD, it told me it couldn’t find a Visual
Studio installation and offered me to download e.g. Visual Studio
2019 or just VS 2019 Build Tools, etc.
Unsure what to do, I thought VS 2019 Build Tools is probabl
On Monday, 31 July 2023 at 18:15:25 UTC, Jonathan M Davis wrote:
On Monday, July 31, 2023 4:55:44 AM MDT Quirin Schroll via
Digitalmars-d-learn wrote:
Apparently, functions can be overloaded solely distinguished by
attributes:
```d
void f(ref int x) pure { x = 1; }
void f(ref int x) { x
Apparently, functions can be overloaded solely distinguished by
attributes:
```d
void f(ref int x) pure { x = 1; }
void f(ref int x) { x = 2; static int s; ++s; }
```
I thought that, maybe, a `pure` context calls the `pure` function
and an impure context calls the impure function, but no:
On Thursday, 25 May 2023 at 20:18:08 UTC, Dennis wrote:
On Thursday, 25 May 2023 at 15:37:00 UTC, Quirin Schroll wrote:
Is there a process? I can’t be the first one running into this.
Doing it in 3 PRs is the process.
Okay. It’s not that bad.
This is one of the reasons why druntime was merg
I have 2 PRs, [one on
dlang/dlang.org](https://github.com/dlang/dlang.org/pull/3446)
and [one on dlang/dmd](https://github.com/dlang/dmd/pull/15245).
The latter fails a test because an example on the (current)
dlang.org fails. The dlang.org PR changes the example, and fails
likewise it’s based
On Tuesday, 23 May 2023 at 13:52:15 UTC, Vladimir Panteleev wrote:
On Tuesday, 23 May 2023 at 13:50:09 UTC, Quirin Schroll wrote:
```
object.Exception@%LOCALAPPDATA%\dub\packages\ae-0.0.3236\ae\sys\d\manager.d(898): Command ["make", "-f",
"win32.mak", "MODEL=32",
"HOST_DC=C:\\Users\\qschroll\\
The dlang-bot writes a message to every PR:
Testing this PR locally
If you don't have a local development environment setup, you
can use Digger to test this PR:
```bash
dub run digger -- build "master + dmd#<>"
```
I installed the current DMD (version 2.103.1) and executed the
above co
On Tuesday, 23 May 2023 at 13:50:09 UTC, Quirin Schroll wrote:
The dlang-bot writes a message to every PR:
Testing this PR locally
If you don't have a local development environment setup, you
can use Digger to test this PR:
```bash
dub run digger -- build "master + dmd#<>"
```
I instal
On Wednesday, 3 May 2023 at 11:38:46 UTC, Adam D Ruppe wrote:
On Tuesday, 2 May 2023 at 13:57:23 UTC, Steven Schveighoffer
wrote:
Isn't that what `__traits(child)` is for?
https://dlang.org/spec/traits.html#child
Yes, `__traits(child, object, method_alias)(args)` is the way
to do it.
This
How do I invoke the member function in a reliable way? Given
`obj` of the type of the object, I used `mixin("obj.",
__traits(identifier, memberFunc), "(params)")`, but that has
issues, among probably others, definitely with visibility. (The
member function alias is a template parameter.)
Is there a trait (or a combination of traits) that gives me the
constraints of a template?
Example:
```D
void f(T1 : long, T2 : const(char)[])(T x) { }
template constraintsOf(alias templ) { /*Magic here*/ }
alias constraints = constraintsOf!f; // tuple(long, const(char)[])
```
At the moment, I
When I do `new void[](n)`, is that buffer allocated with an
alignment of 1 or what are the guarantees? How can I set an
alignment? Also, is the alignment of any type guaranteed to be a
power of 2?
On Friday, 16 September 2022 at 22:43:43 UTC, frame wrote:
```d
import std.variant;
// error: destructor `std.variant.VariantN!32LU.VariantN.~this`
is not `nothrow`
void fun(Variant v) nothrow
{
}
void main()
{
fun(Variant());
}
```
A reference, pointer or slice works. I could do somethi
On Thursday, 22 September 2022 at 10:53:32 UTC, Salih Dincer
wrote:
Is there a more accurate way to delete the '\0' characters at
the end of the string?
Accurate? No. Your code works. Correct is correct, no matter
efficiency or style.
I tried functions in this module:
https://dlang.org/phob
26 matches
Mail list logo