On Tuesday, August 5, 2025 6:42:43 PM Mountain Daylight Time Brother Bill via
Digitalmars-d-learn wrote:
> It doesn't seem like modern D needs the @disable feature.
>
> If a struct has a user provided constructor, then the default
> constructor is removed.
D structs don't really have default cons
On Monday, August 4, 2025 2:02:48 PM Mountain Daylight Time Brother Bill via
Digitalmars-d-learn wrote:
> I feel like I am going into the hornet's nest with this
> discussion.
>
> I have created a struct with some members, and want to have a
> parameterless constructor that sets the member values
On Monday, August 4, 2025 5:21:53 PM Mountain Daylight Time H. S. Teoh via
Digitalmars-d-learn wrote:
> Fast forward 20 or so years, and things have changed a bit. People
> started using structs for many other things, some beyond the original
> design, and inevitably ran into cases where they rea
On Sunday, August 3, 2025 9:31:34 AM Mountain Daylight Time Paul Backus via
Digitalmars-d-learn wrote:
> I have never seen any D programmer use "object" to mean "struct
> or class instance."
That is always how I use the term. I see no reason to differentiate between
what an instance of a struct i
On Sunday, August 3, 2025 5:29:46 AM Mountain Daylight Time Mike Parker via
Digitalmars-d-learn wrote:
> Classes and structs in C++ are both value types, and instances of
> both are referred to as objects. This isn't unusual.
>
> An object is a concrete instance of a type described by a class
> or
On Tuesday, July 29, 2025 5:18:18 PM Mountain Daylight Time Brother Bill via
Digitalmars-d-learn wrote:
> Your changes do work, but at the cost of making i NOT deeply
> immutable: no assignment, no changing any elements, no appending,
> no setting length. This syntax permits appending and setting
On Sunday, July 27, 2025 5:23:40 PM Mountain Daylight Time user1234 via
Digitalmars-d-learn wrote:
> That is confusing, e.g
>
> ```
> extern(C) int r;
>
> int main()
> {
> return r;
> }
> ```
>
> works. But what is likely more intended here is
>
> ```
> extern int r;
>
> int main()
> {
>
On Friday, July 18, 2025 4:47:04 PM Mountain Daylight Time Andy Valencia via
Digitalmars-d-learn wrote:
> Is anyone aware of a library like "tinytag" (a Python module)?
>
> https://github.com/devsnd/tinytag
>
> I guess I'll wrestle with porting it to dlang if there's nothing
> available.
>
> tinyt
On Sunday, July 13, 2025 1:45:01 PM Mountain Daylight Time Ali Çehreli via
Digitalmars-d-learn wrote:
> On 7/12/25 5:35 PM, Jonathan M Davis wrote:
> > On Saturday, July 12, 2025 5:55:39 PM Mountain Daylight Time Ali
> Çehreli via Digitalmars-d-learn wrote:
> Anything can be a part of the impleme
On Sunday, July 13, 2025 8:38:08 AM Mountain Daylight Time H. S. Teoh via
Digitalmars-d-learn wrote:
> On Sat, Jul 12, 2025 at 06:35:42PM -0600, Jonathan M Davis via
> Digitalmars-d-learn wrote:
> > On Saturday, July 12, 2025 5:55:39 PM Mountain Daylight Time Ali Çehreli
> >
On Sunday, July 13, 2025 5:00:12 AM Mountain Daylight Time Bienlein via
Digitalmars-d-learn wrote:
> On Sunday, 13 July 2025 at 00:35:42 UTC, Jonathan M Davis wrote:
>
> > Whereas I think that using private makes perfect sense when you
> > want something to be an implementation detail. Exposing it
On Saturday, July 12, 2025 5:55:39 PM Mountain Daylight Time Ali Çehreli via
Digitalmars-d-learn wrote:
> On 7/11/25 11:36 PM, Bienlein wrote:
>
> > Unhappily class MessageBox is private and therefore cannot be reused.
>
> Ah! :) That's one more data point against 'private', that little feature
>
On Thursday, July 10, 2025 3:22:30 AM Mountain Daylight Time Bienlein via
Digitalmars-d-learn wrote:
> Hello,
>
> I'm looking for some kind of blocking queue for D, that is if the
> queue is empty the thread doing a take on the queue is blocked
> until an item has been added to the queue. Couldn't
On Saturday, July 5, 2025 2:19:11 AM Mountain Daylight Time partypooper via
Digitalmars-d-learn wrote:
> On Saturday, 5 July 2025 at 08:08:08 UTC, Jonathan M Davis wrote:
> > On Friday, July 4, 2025 12:04:55 PM Mountain Daylight Time
> > partypooper via Digitalmars-d-learn wrote:
> >> [...]
> >
>
On Friday, July 4, 2025 12:04:55 PM Mountain Daylight Time partypooper via
Digitalmars-d-learn wrote:
> On Friday, 4 July 2025 at 17:34:59 UTC, monkyyy wrote:
> > On Friday, 4 July 2025 at 17:15:48 UTC, partypooper wrote:
> > if you add ref to line 28 it works; there wont be a reasonable
> > way t
On Friday, June 27, 2025 10:31:42 AM Mountain Daylight Time Quirin Schroll via
Digitalmars-d-learn wrote:
> 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 fo
On Friday, June 27, 2025 1:55:30 PM Mountain Daylight Time WraithGlade via
Digitalmars-d-learn wrote:
> Thanks for responding to my question and for your time, etc.
>
> I was aware of `align` but as far as I am aware it is orthogonal
> to what I'm asking about. The Andrei book says that D
> automa
On Wednesday, June 25, 2025 9:38:55 AM Mountain Daylight Time axricard via
Digitalmars-d-learn wrote:
> When trying to use Nullable with a struct containing an
> overlapping pointer:
>
> ```D
> import std;
>
> struct S
> {
> union
> {
> long foo;
> int[] bar;
> }
> }
On Monday, June 23, 2025 9:56:15 PM Mountain Daylight Time Andy Valencia via
Digitalmars-d-learn wrote:
> I was a little surprised the subclassing syntax didn't do
> structural concatenation for struct's. That is,
>
> ```d
> import std.stdio : writeln;
>
> struct A {
> int a;
> void printA()
On Monday, June 23, 2025 8:53:18 AM Mountain Daylight Time Dennis via
Digitalmars-d-learn wrote:
> On Monday, 23 June 2025 at 10:37:58 UTC, Dom DiSc wrote:
> > I know, it would be needed to enable generic programming, but I
> > find a function that can take both an int and an int* suspect
> > anyw
On Sunday, June 22, 2025 9:04:27 AM Mountain Daylight Time matheus via
Digitalmars-d-learn wrote:
> Hi, could someone please tell me why operador overloading
> (https://dlang.org/spec/operatoroverloading.html) is relegated
> only to classes and structs?
>
> "1 Operator overloading is accomplished
On Tuesday, June 3, 2025 9:39:35 PM Mountain Daylight Time Andy Valencia via
Digitalmars-d-learn wrote:
> On Wednesday, 4 June 2025 at 02:11:18 UTC, H. S. Teoh wrote:
> > The correct way to do this is to create a method in the
> > container that returns a range over its contents. Popping the
> >
On Thursday, May 29, 2025 6:31:56 PM Mountain Daylight Time luafyn via
Digitalmars-d-learn wrote:
> Hi everyone, so dmd includes several -preview flags and I was
> wondering if there were any that are recommended to enable?
>
> I like using the most up to date stuff possible so I've actually
> bee
On Wednesday, May 28, 2025 5:04:06 AM Mountain Daylight Time realhet via
Digitalmars-d-learn wrote:
> I've found a way to eliminate !() by using a function:
Just FYI, you almost never want to instantiate a template with a file and
line number anyway, because that means that every single template
On Friday, May 16, 2025 1:19:41 PM Mountain Daylight Time H. S. Teoh via
Digitalmars-d-learn wrote:
> On Fri, May 16, 2025 at 07:04:24PM +, WhatMeWorry via Digitalmars-d-learn
> wrote:
> [...]
> > void main()
> > {
> > ubyte a;
> > a = a + 5; // onlineapp.d(11): Error: cannot implicit
On Wednesday, May 14, 2025 5:38:59 AM Mountain Daylight Time Nick Treleaven via
Digitalmars-d-learn wrote:
> On Wednesday, 14 May 2025 at 03:36:40 UTC, Jonathan M Davis wrote:
> > to!string definitely deals with null-terminated strings, or it
> > wouldn't work at all. It's not the kind of thing th
On Wednesday, May 7, 2025 10:51:27 PM Mountain Daylight Time Andy Valencia via
Digitalmars-d-learn wrote:
> On Thursday, 8 May 2025 at 00:53:20 UTC, Mike Parker wrote:
> >> tst44.d(6): Error: cannot implicitly convert expression
> >> `fromStringz(ctime(null))` of type `char[]` to `string`
> > `fro
On Monday, May 12, 2025 1:01:49 AM Mountain Daylight Time Justin Allen Parrott
via Digitalmars-d-learn wrote:
> On Friday, 12 August 2011 at 22:51:34 UTC, Andrej Mitrovic wrote:
> > That's pretty stupid, of course you want to modify the
> > arguments.
> >
> > Classic example:
> >
> > void main(str
On Tuesday, May 6, 2025 3:19:29 PM Mountain Daylight Time Pete Padil via
Digitalmars-d-learn wrote:
> I compiled and ran the following test program:
> ```d
> import std.stdio, std.algorithm;
>
> void main()
> {
> long[] a = [1, 2, 3, 15, 4];
> auto b = a[].strip(15);
> writeln(a);
>
On Saturday, May 3, 2025 12:08:45 PM Mountain Daylight Time Ali Çehreli via
Digitalmars-d-learn wrote:
> On 5/2/25 2:44 PM, Python wrote:
> > On Friday, 2 May 2025 at 14:33:57 UTC, Richard (Rikki) Andrew Cattermole
> > wrote:
> >> Have you tried filter?
> >>
> >> https://dlang.org/phobos/std_
On Saturday, May 3, 2025 8:23:00 AM Mountain Daylight Time Andy Valencia via
Digitalmars-d-learn wrote:
> At least on 1.40.1 of the ldc2 distro for x86-64, uses the
> "illegal instruction" instruction.
That sounds like an ldc bug then. With dmd, your program gives
[2, 2, 2, 2, 1, 1, 1, 1]
[2, 2,
On Sunday, April 27, 2025 10:59:24 PM MDT Orion via Digitalmars-d-learn wrote:
> In which programming scenarios should alias be used instead of
> enum?
>
> So far I have only found a simplified notation of a generic
> lambda:
> alias id = (x) => x; x; , which does not work in the case of enum.
>
>
On Wednesday, April 16, 2025 8:48:04 AM MDT H. S. Teoh via Digitalmars-d-learn
wrote:
> On Wed, Apr 16, 2025 at 04:23:43AM +, Andy Valencia via
> Digitalmars-d-learn wrote:
> > On Wednesday, 16 April 2025 at 01:44:33 UTC, Paul Backus wrote:
> > > Nope, you're not missing anything. Using point
On Wednesday, April 9, 2025 1:11:35 AM MDT Anonymouse via Digitalmars-d-learn
wrote:
> On Tuesday, 8 April 2025 at 14:27:24 UTC, Jonathan M Davis wrote:
> > I would assume that you need to create a similar build config
> > which doesn't use -w (though really, -w should be gotten rid
> > of, becaus
On Tuesday, April 8, 2025 9:07:45 AM MDT Guillaume Piolat via
Digitalmars-d-learn wrote:
> On Tuesday, 8 April 2025 at 14:00:56 UTC, Jonathan M Davis wrote:
> > Of course, I'm also increasingly of the opinion that pure was a
> > mistake in general, because it does almost nothing in practice
> > bu
On Sunday, April 6, 2025 9:30:31 AM MDT Anonymouse via Digitalmars-d-learn
wrote:
> I'm using `dub build -b docs` as a way to detect when I did ddoc
> wrong, such as mismatching `Params` sections and actual parameter
> names.
>
> Sadly one of the dependencies I (indirectly) use already *has*
> inc
On Tuesday, April 8, 2025 5:28:57 AM MDT Dom DiSc via Digitalmars-d-learn wrote:
> Hi.
>
> I want to create my own allocator, but using malloc is not pure
> (it internally has to have some "global state"). But the GC also
> has this "global state" and still is considered "pure".
> So internally the
On Thursday, March 20, 2025 6:32:03 PM MDT H. S. Teoh via Digitalmars-d-learn
wrote:
> On Thu, Mar 20, 2025 at 11:51:46PM +, WhatMeWorry via Digitalmars-d-learn
> wrote:
> > Is there an elegant way, like with foreach, to step through a red black
> > tree non-destructively? This destructi
On Saturday, March 22, 2025 11:38:05 AM MDT Paul Backus via Digitalmars-d-learn
wrote:
> On Saturday, 22 March 2025 at 12:05:11 UTC, Ali Çehreli wrote:
> > On 3/21/25 8:35 PM, Andy Valencia wrote:
> >
> > > tst39.d(21):add `alias this = tst39.A.this` to
> > `tst39.B`'s body
> > > to merge
On Wednesday, March 19, 2025 5:48:37 PM MDT H. S. Teoh via Digitalmars-d-learn
wrote:
> On Wed, Mar 19, 2025 at 11:21:15PM +, monkyyy via Digitalmars-d-learn
> wrote:
> [...]
> > ufcs on local functions is hit or miss;
> [...]
>
> I thought it was always a miss. :-D At least, it's never work
On Tuesday, March 18, 2025 1:19:49 PM MDT bauss via Digitalmars-d-learn wrote:
> On Tuesday, 18 March 2025 at 18:04:12 UTC, Steven Schveighoffer
> wrote:
> > On Tuesday, 18 March 2025 at 07:42:37 UTC, Jonathan M Davis
> > wrote:
> >> The base class constructors are not nothrow, so WrappedTCP's
> >>
On Monday, March 17, 2025 4:14:21 PM MDT Andy Valencia via Digitalmars-d-learn
wrote:
> The presence of the "accepting" API in Socket seems to indicate
> that subclassing Socket/TcpSocket is intended to be supported.
> But I'm just not seeing my way through the twisty maze of pure
> and @nothrow b
On Sunday, February 16, 2025 12:38:09 AM MDT Anonymouse via Digitalmars-d-learn
wrote:
> I want to get a reference to a parent function from inside a
> nested function. I need it for `getUDAs!(parentFunction,
> attribute)`.
>
> `__traits(parent, mixin(__FUNCTION__))` works inside the parent
> func
On Monday, March 17, 2025 6:28:19 PM MDT Jonathan M Davis via
Digitalmars-d-learn wrote:
> On Sunday, February 16, 2025 12:38:09 AM MDT Anonymouse via
> Digitalmars-d-learn wrote:
> > I want to get a reference to a parent function from inside a
> > nested function. I ne
On Sunday, March 16, 2025 9:22:04 AM MDT Ian via Digitalmars-d-learn wrote:
> On Tuesday, 25 February 2025 at 00:34:45 UTC, Jonathan M Davis
> wrote:
> > For strings, the way that you normally do constants is with
> > enum, e.g
> >
> > enum foo = "dlang";
> >
> > An enum like this is called a m
On Wednesday, March 12, 2025 12:07:04 PM MDT Manfred Nowak via
Digitalmars-d-learn wrote:
> On Tuesday, 11 March 2025 at 16:56:28 UTC, WhatMeWorry wrote:
> [...]
> > To include the upper bound value, use a square bracket "]" at
> > the end of the range."
>
> [...]
> > foreach( i, e; a[0..3] )
> >
On Monday, February 24, 2025 9:07:07 AM MST Ian via Digitalmars-d-learn wrote:
> Hello,
>
> What's the recommended D way to declare a string constant? Say,
> for example, for a path used inside a class constructor? I've
> seen const string, immutable, enum etc...
>
> Is this the place for these kin
On Monday, February 24, 2025 11:19:48 AM MST Elias Batek (0xEAB) via
Digitalmars-d-learn wrote:
> For string constants you’ll usually want to mark them as `static
> immutable`. Strings with this combination will usually be put
> into read-only sections (ROM) of the resulting binaries.
>
> Unlike `
On Thursday, February 20, 2025 6:02:26 PM MST Quirin Schroll via
Digitalmars-d-learn wrote:
> 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(
On Wednesday, February 19, 2025 11:24:36 PM MST IchorDev via
Digitalmars-d-learn wrote:
> On Saturday, 15 February 2025 at 10:09:39 UTC, Jonathan M Davis
> wrote:
> > I think that you need to be clearer about what you're trying to
> > do. If a module-level variable is not shared, __gshared, or
> >
On Wednesday, February 19, 2025 7:48:48 PM MST Jonathan M Davis via
Digitalmars-d-learn wrote:
> So you should probably either just make your code operate on ranges of
> dchar, or you'll need to wrap your ranges using byChar or byCodeUnit in
> order to get ranges of char. A
On Wednesday, February 19, 2025 11:13:24 AM MST realhet via Digitalmars-d-learn
wrote:
> Hello,
>
> The problematic line is at the very bottom.
>
> I only managed to make it run by precedding the .byChar with
> .text, but that is unwanted because it would convert the whole
> InputRange.
>
> How ca
On Sunday, February 16, 2025 1:57:58 PM MST rkompass via Digitalmars-d-learn
wrote:
> From the source code at
> [https://github.com/dlang/phobos/blob/master/std/container/dlist.d#L784](https://github.com/dlang/phobos/blob/master/std/container/dlist.d#L784)
> I would say it is O(1), as you expecte
On Sunday, February 16, 2025 4:54:46 AM MST ShadoLight via Digitalmars-d-learn
wrote:
> On Sunday, 16 February 2025 at 05:39:07 UTC, Jonathan M Davis
> wrote:
> > _especially_ when VRP comes into play, because then you get
> > nonsense like foo(1) calling the bool overload.
> >
>
> I have often se
On Saturday, February 15, 2025 1:12:43 PM MST Paul Backus via
Digitalmars-d-learn wrote:
> On Saturday, 15 February 2025 at 15:40:51 UTC, Dom DiSc wrote:
> > On Friday, 14 February 2025 at 15:58:26 UTC, Paul Backus wrote:
> >> Oops--it turns out both overloads are equally specialized!
> >
> > This
On Saturday, February 15, 2025 9:33:06 PM MST Andy Valencia via
Digitalmars-d-learn wrote:
> On Saturday, 15 February 2025 at 19:27:19 UTC, Ian wrote:
> > canFind is Perfect. Thank you.
>
> If performance is an issue, putting them as keys in an
> Associative Array and simply using "in" should scal
On Saturday, February 15, 2025 12:53:17 AM MST IchorDev via Digitalmars-d-learn
wrote:
> If I have a module-level variable, each thread sees a different
> value for it. But how would I create a module-level variable that
> can only be accessed by one thread? Do I have to give it its own
> module?
On Wednesday, February 5, 2025 8:16:10 AM MST seany via Digitalmars-d-learn
wrote:
> Is there any built in passowrd verification for Vibe.d? Such as
> bcrypt.verifypassword(password , hash)?
>
> I looked at this library: https://code.dlang.org/packages/passwd
> This is causing linking error ( ld:
On Tuesday, February 4, 2025 5:53:02 AM MST axricard via Digitalmars-d-learn
wrote:
> Basically the same question than
> https://forum.dlang.org/post/aoltazzfmnztsyatf...@forum.dlang.org
> but with functions/delegates and inferred return types:
>
> ``` D
> interface I {
> bool check();
>
On Friday, January 31, 2025 3:45:55 PM MST Kyle Ingraham via
Digitalmars-d-learn wrote:
> On Thursday, 30 January 2025 at 04:44:02 UTC, Jonathan M Davis
> wrote:
> > What we really need is something like tryTo that returns a
> > Nullable which has no value when the conversion fails, and then
> > p
On Wednesday, January 29, 2025 8:00:43 PM MST H. S. Teoh via
Digitalmars-d-learn wrote:
> > Unfortunately, there isn't currently a function like std.conv.to which
> > does not throw.
>
> I thought std.conv.parse* is supposed to fill that role? Or am I
> remembering wrong? They don't quite have t
On Wednesday, January 29, 2025 6:38:07 PM MST Kyle Ingraham via
Digitalmars-d-learn wrote:
> Does D have a 'try' `std.conv:to` that does not throw if it
> fails? Something like:
> ```D
> string input = "9";
> int output;
> auto parsed = input.tryTo!int(output);
> ```
>
> `std.conv:to` is super fle
On Tuesday, January 28, 2025 10:41:31 AM MST DLearner via Digitalmars-d-learn
wrote:
> On Tuesday, 28 January 2025 at 15:00:13 UTC, Jonathan M Davis
> wrote:
> [...]
>
> >
> > -betterC was originally intended to be a tool for making it
> > easier to port C code to D code (after which, the idea was
On Tuesday, January 28, 2025 8:04:36 AM MST Dennis via Digitalmars-d-learn
wrote:
> On Tuesday, 28 January 2025 at 15:00:13 UTC, Jonathan M Davis
> wrote:
> > but we provide no guarantees that any code that works with
> > -betterC right now will continue to do so, and we do not intend
> > to add -
On Tuesday, January 28, 2025 6:01:56 AM MST DLearner via Digitalmars-d-learn
wrote:
> Is there a definitive list somewhere of standard library
> functions that work with -betterC?
>
> For example, the following code fragment (taken from the library
> docs) does not work with -betterC.
> ```
> exte
On Sunday, January 26, 2025 4:41:53 PM MST DLearner via Digitalmars-d-learn
wrote:
> On Monday, 20 January 2025 at 19:54:19 UTC, Jonathan M Davis
> wrote:
> [...]
> > Also, there's really no reason to be doing anything with char[]
> > instead of string unless you're specifically planning on
> > mu
On Friday, January 24, 2025 3:50:15 AM MST Dom DiSc via Digitalmars-d-learn
wrote:
> Is it possible in D to find out if the parameter given to a
> function is a literal or a compile time constant?
Not when calling the function, no. It should be possible to test whether a
particular argument is a
On Friday, January 24, 2025 2:57:05 AM MST axricard via Digitalmars-d-learn
wrote:
> ``` D
> import std;
>
> void main()
> {
> auto sourceName = deleteme ~ "source";
> auto source = File(sourceName, "w");
> source.write("source");
>
> copy(sourceName, "/dev/null");
> }
> ```
>
On Monday, January 20, 2025 12:03:09 PM MST DLearner via Digitalmars-d-learn
wrote:
> // In the code below, what fn needs to go in the commented-out
> line,
> // to make the program print 7, 11 rather than 7, 7?
>
> ```
> void main() {
>
> import std.stdio;
>
> int IntVar1 = 5;
> int I
On Monday, January 6, 2025 1:15:23 PM MST Renato via Digitalmars-d-learn wrote:
> On Monday, 6 January 2025 at 19:58:12 UTC, H. S. Teoh wrote:
> > On Mon, Jan 06, 2025 at 07:30:27PM +, Renato via
> > Digitalmars-d-learn wrote:
> >> Is there any Phobos function that collects "some" items of a
>
On Wednesday, December 18, 2024 3:16:45 PM MST John Dougan via
Digitalmars-d-learn wrote:
> As the subject. The obvious way:
>
> ```D
> import std;
>
> int test(int val)
> {
> writeln("A");
> if (val % 2 == 0)
> {
> writeln("b");
> scope (exit)
> write
On Tuesday, December 17, 2024 2:31:13 PM MST DLearner via Digitalmars-d-learn
wrote:
> On Tuesday, 17 December 2024 at 19:56:32 UTC, H. S. Teoh wrote:
> [...]
> >
> > That means the compiler will have to rerun your program once
> > per unittest. That means your OS has to create a new process
> >
On Monday, December 2, 2024 10:03:22 AM MST Basile B. via Digitalmars-d-learn
wrote:
> I've noticed that empty struct are always at least a size of 1,
> see [D explorer](https://godbolt.org/z/sGYcex4cf). There you can
> see `%example.S = type { [1 x i8] }`
>
> So te compiler inserts a dummy member
On Monday, November 25, 2024 8:09:46 AM MST Paul Backus via Digitalmars-d-
learn wrote:
> On Monday, 25 November 2024 at 14:24:44 UTC, Bastiaan Veelo wrote:
> > I suspect a bug in conv.to, am I right?
>
> Yes, this is a bug. Because of the weird restrictions on `inout`,
> it's very easy to write te
On Thursday, November 21, 2024 2:51:33 PM MST Ben Jones via Digitalmars-d-
learn wrote:
> I'm trying to read integers out of a mmap'd file using
> std.bitmanip.peek and it's failing because
>
> `isForwardRange!(void[])` is false
>
> That seems unexpected, am I missing something or is that a bug?
>
On Friday, November 8, 2024 4:27:40 PM MST Dom DiSc via Digitalmars-d-learn
wrote:
> I _very_ often use this pattern:
>
> ```
> fun(ref int[] a)
> {
> assert(a.length && a.length<=100);
> int[100] b;
> b[0 .. a.length-1] = a[];
> b[a.length .. 100] = 5;
> }
> ```
>
> I consider thi
On Sunday, November 3, 2024 5:01:20 PM MST Andy Valencia via Digitalmars-d-
learn wrote:
> A function can be described as, say, private, or pure, or @nogc.
> When does an annotation have an '@'? Also, a function can be
> annotated
>
> int myfunc(char *arg) pure {
> }
>
> Although I find:
>
> pure
On Wednesday, October 23, 2024 11:18:47 AM MDT Anton Pastukhov via
Digitalmars-d-learn wrote:
> On Wednesday, 23 October 2024 at 14:50:44 UTC, Paul Backus wrote:
> > On Wednesday, 23 October 2024 at 12:46:24 UTC, Paul Backus
> > wrote:
> >
> > You can't use an `alias` to refer to a member variable
On Wednesday, October 23, 2024 9:06:46 AM MDT Salih Dincer via Digitalmars-d-
learn wrote:
> The code also compiles like this. In this case, can we say that
> there are 3 solutions or are static and enum actually the same
> thing?
static and enum are not the same thing.
An enum has no memory loca
On Friday, October 11, 2024 7:09:56 PM MDT Alexander Zhirov via Digitalmars-d-
learn wrote:
> Is it possible to organize a project that will consist of several
> main files. I want to write several simple programs in one
> project, but for them to be divided into different files. So that
> it would
On Friday, September 27, 2024 2:13:45 PM MDT thinkunix via Digitalmars-d-learn
wrote:
> monkyyy via Digitalmars-d-learn wrote:
> > On Friday, 27 September 2024 at 04:23:32 UTC, thinkunix wrote:
> >> What about using 'auto' as the return type?
> >> I tried it and it seemed to work OK.
> >>
> >> Won
On Thursday, September 26, 2024 12:53:12 AM MDT Per Nordlöw via Digitalmars-d-
learn 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 + c
On Monday, September 23, 2024 1:52:02 PM MDT Craig Dillabaugh via Digitalmars-
d-learn wrote:
> Why does the following program:
>
> \
> import std.stdio;
>
> int main(string[] args) {
> uint Q = 7681;
> writeln("Val = ", -1 % Q);
> retur
On Tuesday, September 10, 2024 10:01:53 PM MDT f via Digitalmars-d-learn
wrote:
> i mean , is this a bug?
No, it's not a bug. Assertions with an expression that is known to be false
at compile time are treated as special. They are always left in the
generated code so that they will kill your prog
On Monday, September 9, 2024 6:40:07 PM MDT kookman via Digitalmars-d-learn
wrote:
> On Tuesday, 10 September 2024 at 00:27:43 UTC, Jonathan M Davis
>
> wrote:
> > On Monday, September 9, 2024 5:46:18 PM MDT kookman via
> >
> > Digitalmars-d-learn wrote:
> >> It seems like assertThrown works as ex
On Monday, September 9, 2024 5:46:18 PM MDT kookman via Digitalmars-d-learn
wrote:
> It seems like assertThrown works as expected for case 4, but
> mysteriously not working for case 5 - despite the code under test
> raising the same exception. Am I missing something stupid here?
At a glance, it l
On Wednesday, August 28, 2024 3:44:59 PM MDT Johann Lermer via Digitalmars-d-
learn wrote:
> On Friday, 23 August 2024 at 08:58:16 UTC, Me'vâ wrote:
> > writeln("Result: ", i + ++i);
>
> I would definitely expect 11 as result (but I still have K&R on
> my book shelf, maybe I'm a bit biased). So
On Friday, August 16, 2024 10:37:45 AM MDT Nick Treleaven via Digitalmars-d-
learn wrote:
> On Friday, 16 August 2024 at 16:30:09 UTC, Jonathan M Davis wrote:
> > Whether the result of dup is then able to be implicitly
> > converted to immutable based on whether the operation is pure
> > depends on
On Friday, August 16, 2024 9:58:31 AM MDT Nick Treleaven via Digitalmars-d-
learn wrote:
> On Friday, 16 August 2024 at 13:30:53 UTC, IchorDev wrote:
> > On Friday, 16 August 2024 at 11:37:08 UTC, Nick Treleaven wrote:
> >> On Friday, 16 August 2024 at 06:15:18 UTC, Bruce wrote:
> >> ```d
> >> stri
On Friday, July 26, 2024 2:17:21 AM MDT Dom DiSc via Digitalmars-d-learn
wrote:
> 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
> >
> >> But a parameter given by value is ALWAYS a copy.
> >
> > It has to be a _full_, i
On Thursday, July 25, 2024 4:48:06 PM MDT Quirin Schroll via Digitalmars-d-
learn wrote:
> It seems one can’t have one in a struct together with a copy
> constructor, but what is it? When is it called? What is it for?
An rvalue constructor is a constructor that takes the same type as the
struct th
On Thursday, July 25, 2024 4:50:04 AM MDT Dom DiSc via Digitalmars-d-learn
wrote:
> I have copied some source from C++, where the following pattern
> is common (operator== already renamed):
>
> ```d
> @safe:
> struct S
> {
> bool opEquals(const ref S x) const
> {
>if(&x==&this) ret
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, which it would with an integer type)
>
> But a parameter given by
On Thursday, July 25, 2024 12:50:04 AM MDT Dom DiSc via Digitalmars-d-learn
wrote:
> On Wednesday, 24 July 2024 at 15:40:28 UTC, Dennis wrote:
> >> Is there a way to tell the compiler that it should discard
> >> "const" and "immutable" if it needs to create a copy?
> >> Unqual!T doesn't work :-(
>
On Friday, July 19, 2024 12:02:55 PM MDT H. S. Teoh via Digitalmars-d-learn
wrote:
> On Fri, Jul 19, 2024 at 05:48:37PM +, Dennis via Digitalmars-d-learn
wrote:
> > On Friday, 19 July 2024 at 17:20:22 UTC, matheus wrote:
> > > couldn't this case for example be caught during the compiling time
On Tuesday, July 2, 2024 1:23:42 AM MDT ryuukk_ via Digitalmars-d-learn wrote:
> I said it 2 times already, i don't want string concatenation,
> i'll benchmark later, but not right now, right now i'm looking
> for a functioning code without string concatenation
D has two options for mixins, and bo
On Friday, June 21, 2024 12:39:44 PM MDT mw via Digitalmars-d-learn wrote:
> Looks like `__atomic_thread_fence` is a GCC built-in function, so
> how to make importC recognize it?
dmd cannot handle it. gcc or ldc might, but dmd generally needs standard C
code. Stuff like gcc built-ins basically has
On Sunday, June 16, 2024 10:32:50 PM MDT Andy Valencia via Digitalmars-d-learn
wrote:
> In the alias:
>
> alias Unshared(T) = T;
> alias Unshared(T: shared U, U) = U;
>
> as used in:
>
> cast(Unshared!mytype)value
>
> turns a mytype with shared attribute into one without shared.
>
>
On Friday, May 31, 2024 6:28:27 PM MDT Andy Valencia via Digitalmars-d-learn
wrote:
> On Friday, 31 May 2024 at 16:59:08 UTC, Jonathan M Davis wrote:
>
> Speaking as an old kernel engineer for the Sequent multiprocessor
> product line, this is all very comfortable to me. I'm very glad
> that D ha
On Friday, May 31, 2024 10:07:23 AM MDT Andy Valencia via Digitalmars-d-learn
wrote:
> I'm coding a server which takes TCP connections. I end up in the
> main thread with .accept() which hands me a Socket. I'd like to
> hand this off to a spawn()'ed thread to do the actual work.
>
> Aliases
1 - 100 of 1084 matches
Mail list logo