Re: DIP-1000 and return

2017-01-02 Thread Nordlöw via Digitalmars-d-learn
On Monday, 2 January 2017 at 14:38:53 UTC, Nordlöw wrote: I've tried as many combinations of `return` and `scope` as I can think of such as Update: Qualifying `asStatic` with `@safe pure nothrow @nogc` as T[length] asStatic(T, size_t length)(T[length] arr) @safe pure nothrow @nogc { r

Sorting with unaryFun predicate

2017-01-06 Thread Nordlöw via Digitalmars-d-learn
Why isn't there an overload for `std.algorithm.sorting.sort` that takes a `unaryFun` lambda? Something like x[].sort!"a.m"; sorting elements in `x` according to the value of element member `m` compared to the longer x[].sort!"a.m < b.m";

Re: Sorting with unaryFun predicate

2017-01-06 Thread Nordlöw via Digitalmars-d-learn
On Friday, 6 January 2017 at 15:36:42 UTC, Nordlöw wrote: Something like x[].sort!"a.m"; Perhaps under a different name `sortBy` x[].sortBy!"a.m";

Re: Sorting with unaryFun predicate

2017-01-06 Thread Nordlöw via Digitalmars-d-learn
On Friday, 6 January 2017 at 15:36:42 UTC, Nordlöw wrote: Why isn't there an overload for `std.algorithm.sorting.sort` that takes a `unaryFun` lambda? x[].sort!"a.m < b.m"; Oops, http://forum.dlang.org/post/nxdsmdimnfssqmeyb...@forum.dlang.org https://github.com/nordlow/phobos-next/blob/

taggedPointer to char array on heap

2017-01-10 Thread Nordlöw via Digitalmars-d-learn
If taggedPointer!char* allocated on the heap the pointer

Re: taggedPointer to char array on heap

2017-01-10 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 00:11:47 UTC, Nordlöw wrote: If taggedPointer!char* allocated on the heap the pointer A taggedPointer!char* cannot use any tags, eventhough a heap-allocated pointer clearly has non-byte alignment. Is there a way around this?

Re: taggedPointer to char array on heap

2017-01-10 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 01:18:24 UTC, Ali Çehreli wrote: Ali Thanks!

Re: taggedPointer to char array on heap

2017-01-11 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 00:26:27 UTC, Ali Çehreli wrote: @property char* p() { Should be @property inout(char)* p() inout Thanks!

Querying parameter passing semantics for `auto ref const` variables

2017-01-15 Thread Nordlöw via Digitalmars-d-learn
Is there a way to query at compile-time whether a call to f(T)(auto ref const T x) passed the variable `x` from a l-value or r-value? A call to `isRef!T` inside the function `f` is always `false` for `l-value` and `r-value` passing. I need this to detect automatic delayed evaluation of

Re: Querying parameter passing semantics for `auto ref const` variables

2017-01-15 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 15 January 2017 at 14:33:25 UTC, Nordlöw wrote: Is there a way to query at compile-time whether a call to Further, overloading such as struct S { int x, y; } static f(in S s) {} static f(const ref S s) {} f(S.init); S s; f(s); fails as declaration f is

Re: Querying parameter passing semantics for `auto ref const` variables

2017-01-15 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 15 January 2017 at 17:00:41 UTC, kinke wrote: On Sunday, 15 January 2017 at 14:33:25 UTC, Nordlöw wrote: A call to `isRef!T` inside the function `f` is always `false` for `l-value` and `r-value` passing. According to https://dlang.org/spec/template.html#auto-ref-parameters, it sho

Re: Querying parameter passing semantics for `auto ref const` variables

2017-01-15 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 15 January 2017 at 17:41:36 UTC, Nordlöw wrote: This struct S { int x, y; } void f()(auto ref const S s) { pragma(msg, "type:", typeof(s), " isRef:", isRef!s); } f(S.init); S s; f(s); prints type:const(S) isRef:false type:const(S) isRef:tr

Initializing floating point types with explicit mantisa and exponent

2017-01-16 Thread Nordlöw via Digitalmars-d-learn
How do I best initialize a D double to an exact mantissa and exponent representation? I'm specifically interested in 2^^i for all i in [min_exp, max_exp]

Re: Initializing floating point types with explicit mantisa and exponent

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 16:40:57 UTC, kinke wrote: If it doesn't have to be D ;), it can be as simple as `core.stdc.math.ldexp(1, exponent)`. No CTFE though. Isn't it a simple as 2.0^^exponent ?

Re: Initializing floating point types with explicit mantisa and exponent

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 18:25:46 UTC, kinke wrote: It should and I looked into that as well, but I didn't like the implementation as loop: https://github.com/dlang/phobos/blob/master/std/math.d#L5988 A special case for base x == 2 wouldn't hurt. That seems strange. Why isn't that a bu

C++-style mutable members

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
Is there a way to mimic C++-style `mutable` members in D?

Re: C++-style mutable members

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 20:47:35 UTC, ketmar wrote: Is there a way to mimic C++-style `mutable` members in D? sure: don't use `const`. otherwise — no, there is simply no way to «mimic» 'em due to completely different meaning of `const` in D and C++. I'm aware of the difference. I'm jus

Where is floating point next{Up,Down}?

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
I can't find nextUp(x) and nextDown(x) described in https://dlang.org/d-floating-point.html Are these D1 only? Is there anything like it in D2/Phobos?

Re: Where is floating point next{Up,Down}?

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 23:38:46 UTC, Ali Çehreli wrote: Found'em! :) https://dlang.org/phobos/std_math.html#.nextUp Thanks!

Printing a floats in maximum precision

2017-01-17 Thread Nordlöw via Digitalmars-d-learn
What's the easiest way to print a double in maximum precision?

__traits(isRef, this) cannot distinguish l-value- from r-value-passed this

2017-01-18 Thread Nordlöw via Digitalmars-d-learn
A compilation of struct T { int x; @disable this(this); // this has no effect on the issue ref inout(T) memberFun() inout { pragma(msg, "memberFun:", __traits(isRef, this) ? "ref" : "non-ref", " this"); return this; } } void freeFun()(auto ref const T x)

Re: __traits(isRef, this) cannot distinguish l-value- from r-value-passed this

2017-01-18 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 19 January 2017 at 00:44:51 UTC, Nordlöw wrote: Any clues on how to retrieve this information? Another much more common use case: Chained property setters could be optimized iff the property setter is called on an r-value, that is when `__traits(isRef,this)` is `false` Typ

Re: Concurrent containers

2017-01-28 Thread Nordlöw via Digitalmars-d-learn
On Saturday, 28 January 2017 at 00:09:45 UTC, Arun Chandrasekaran wrote: Does phobos offer concurrent containers? I couldn't find one at http://dlang.org/phobos/std_container.html Any other in the D land? You can always search here http://code.dlang.org/

Inplace toLower()

2017-03-19 Thread Nordlöw via Digitalmars-d-learn
Is there an in-place version of std.uni.toLower() If not, how do I most elegantly construct one?

DUB mismatch between project structure and dub.json contents

2017-04-10 Thread Nordlöw via Digitalmars-d-learn
I have a project with the tree structure ├── knetquery └── src └── knet ├── lectures ├── readers └── tests ├── linenoise (submodule) ├── linenoise-d (submodule) │ ... └── phobos-next (submodule) ... and a DUB-conversion whoose `dub.json` currently contains {

Re: DUB mismatch between project structure and dub.json contents

2017-04-10 Thread Nordlöw via Digitalmars-d-learn
On Monday, 10 April 2017 at 12:56:49 UTC, Nordlöw wrote: I have a project with the tree structure ├── knetquery Ignore this sub-directory. It's unused. Further, `dub -v` outputs Using dub registry url 'http://code.dlang.org/' Refreshing local packages (refresh existing: true)... Looking for

Recently added __equal

2017-04-17 Thread Nordlöw via Digitalmars-d-learn
What's the plan for the recent adding __equal overloads at https://github.com/dlang/druntime/pull/1808/files Is it only meant for runtime and phobos to be updated? Or does user-libraries, such as container libraries, need to be updated aswell?

Transitive bit-packing of fields

2017-04-30 Thread Nordlöw via Digitalmars-d-learn
Have anybody found a way to do transitive packing of bitfields? For instance, in import std.bitmanip : bitfields; struct X { // one bit too many to fit in one byte mixin(bitfields!(bool, `a`, 1, bool, `b`, 1, ubyte, `c`, 7,

Scope checking on static array struct doesn't kick in

2017-05-09 Thread Nordlöw via Digitalmars-d-learn
I've tagged the ref-returning functions (in this case `opSlice`) with `return scope` for my statically allocated array struct at https://github.com/nordlow/phobos-next/blob/master/src/arrayn.d but for some reason the scope-checking (via -dip1000) allows both https://github.com/nordlow/phobos-n

Re: Scope checking on static array struct doesn't kick in

2017-05-09 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 11:52:35 UTC, Nordlöw wrote: I've tagged the ref-returning functions (in this case `opSlice`) with `return scope` for my statically allocated array struct at Here's a simpler example https://github.com/nordlow/phobos-next/blob/cf85f449d24981fbe6269f8096db23282e2fbb65

Re: Scope checking on static array struct doesn't kick in

2017-05-09 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 12:25:29 UTC, Nordlöw wrote: On Tuesday, 9 May 2017 at 11:52:35 UTC, Nordlöw wrote: I've tagged the ref-returning functions (in this case `opSlice`) with `return scope` for my statically allocated array struct at Here's a simpler example https://github.com/nordlow/p

Re: Scope checking on static array struct doesn't kick in

2017-05-09 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 13:30:49 UTC, Nordlöw wrote: I'll write a Bugzilla issue later today. https://issues.dlang.org/show_bug.cgi?id=17388

Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Nordlöw via Digitalmars-d-learn
What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ?

Structure of Arrays vs Array of Structures

2017-05-14 Thread Nordlöw via Digitalmars-d-learn
After having watched Jonathan Blow's talk on Jai https://www.youtube.com/watch?v=TH9VCN6UkyQ&t=2880s I realized that we should add his Array-of-Structures (AoS) concept to Phobos, preferrably in std.typecons.StructArrays, as something like template StructArrays(Members...) { struct Struc

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: Yes, https://maikklein.github.io/post/soa-d/ Ok, great. Thanks. I can't seem to find any Github code repo, tough. Does it exist?

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 17:10:49 UTC, Per Nordlöw wrote: On Monday, 15 May 2017 at 07:31:25 UTC, Nordlöw wrote: On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: Yes, https://maikklein.github.io/post/soa-d/ Ok, great. Thanks. I can't seem to find any Github code repo, tough. D

No tempFile() in std.file

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
Why isn't there a function, say `tempFile()`, in https://dlang.org/phobos/std_file.html that creates a temporary _file_ when we already have https://dlang.org/phobos/std_file.html#tempDir ?

Atomicity of file-copying/moving

2017-05-16 Thread Nordlöw via Digitalmars-d-learn
What's the status of atomicity of file-copying and -moving (renaming) using std.file on different platforms?

Re: Atomicity of file-copying/moving

2017-05-17 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 20:02:44 UTC, Per Nordlöw wrote: The standard way is to copy the source to a temporary file on the same file system as the target file followed by hardlinking Correction: should be renaming. Here's an implementation in Python (3): https://github.com/nordlow/conta

Re: Structure of Arrays vs Array of Structures

2017-05-23 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 19:52:03 UTC, Nordlöw wrote: soa.d-mixin-143(143,7): Error: variable soa.SOA!(S).SOA.container0LU cannot be further field because it will change the determined SOA size soa.d-mixin-143(143,28): Error: variable soa.SOA!(S).SOA.container1LU cannot be further field becaus

Re: Structure of Arrays vs Array of Structures

2017-05-23 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 16:46:18 UTC, Nordlöw wrote: http://forum.dlang.org/post/wvulryummkqtskiwr...@forum.dlang.org Correction; should be: https://github.com/nordlow/phobos-next/blob/a324f16515bd1c3c1185ba0482dae2886d811bb1/src/soa.d

Linker cannot find malloc and free on OS X

2017-06-04 Thread Nordlöw via Digitalmars-d-learn
My gmp-d tests successfully on Linux as dub test but on OS X it fails as Undefined symbols for architecture x86_64: "free", referenced from: ... "malloc", referenced from: ... Any ideas on why? https://github.com/nordlow/gmp-d/issues/4#issuecomment-305974761

Builtin array-scalar equality

2017-06-14 Thread Nordlöw via Digitalmars-d-learn
Why isn't bool c = a[] == 4; allowed when a[] = b[] + 4; is? given that int[] a, b;

code.dlang.org package isn't automatically bumped when I push a new version tag on github

2017-06-26 Thread Nordlöw via Digitalmars-d-learn
I've made an update to version 0.1 at https://github.com/nordlow/gmp-d/tree/v0.1. But the version on http://code.dlang.org/packages/gmp-d isn't bumped to version 0.1 and I can't find a way to change it. What to do?

Re: code.dlang.org package isn't automatically bumped when I push a new version tag on github

2017-06-26 Thread Nordlöw via Digitalmars-d-learn
On Monday, 26 June 2017 at 08:07:56 UTC, Seb wrote: The crawler runs every hour. Though you can login and trigger a manual refresh. I bumped a couple of days ago so that can't be it. How do I trigger a manual refresh?

Re: code.dlang.org package isn't automatically bumped when I push a new version tag on github

2017-06-26 Thread Nordlöw via Digitalmars-d-learn
On Monday, 26 June 2017 at 08:07:56 UTC, Seb wrote: The crawler runs every hour. Though you can login and trigger a manual refresh. "Show all versions" doesn't show the latest tag version `v1.0`.

Re: code.dlang.org package isn't automatically bumped when I push a new version tag on github

2017-06-26 Thread Nordlöw via Digitalmars-d-learn
On Monday, 26 June 2017 at 09:37:11 UTC, Basile B. wrote: Don't worry, it's just your tag that's malformed; "v1.0" while it should be "v1.0.0" so... git tag -d v1.0 and add v1.0.0 this time Thanks.

Index an AliasSeq with a run-time index

2022-08-14 Thread Per Nordlöw via Digitalmars-d-learn
How do I index an `AliasSeq` with an integer known at run-time?

Re: Index an AliasSeq with a run-time index

2022-08-14 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 14 August 2022 at 10:41:20 UTC, ag0aep6g wrote: On 14.08.22 12:08, Per Nordlöw wrote: How do I index an `AliasSeq` with an integer known at run-time? Thanks

Compiling dynamic library but not its dependencies with specific dflags

2022-09-18 Thread Per Nordlöw via Digitalmars-d-learn
Given shared library `X` depending on other shared libraries `Ys`, is it possible, using dub, to use extra `dflags` `F` when building the sources of `X` only and not have those extra flags `F` be used when (re)compiling `Ys`. In my specific case those flags are `-fsanitize=address` and `-cov`.

Re: Compiling dynamic library but not its dependencies with specific dflags

2022-09-19 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 18 September 2022 at 08:24:27 UTC, Per Nordlöw wrote: Given shared library `X` depending on other shared libraries `Ys`, is it possible, using dub, to use extra `dflags` `F` when building the sources of `X` only and not have those extra flags `F` be used when (re)compiling `Ys`. In m

Override dub dflags for a single source file only

2022-09-19 Thread Per Nordlöw via Digitalmars-d-learn
In dub, is it possible to override the dflags, in my case `-cov`, for a single file only without it affecting the rest of the compiling and linking? Currently, dub enforces static linking of the dependencies when the `-cov` flag is set via `dflags "-cov"` in dub.sdl which makes our build fail.

Supporting foreach (k, v; T.init) for a user-defined (container) type

2022-10-24 Thread Per Nordlöw via Digitalmars-d-learn
What property of a container (type) `T` enables iteration as ```d foreach (k, v; T.init) { ... } ``` ? I thought it sufficed to define `T.byKeyValue` but its presence seem to have no effect.

Re: Disabling All Inlining in DMD Debug Builds

2022-10-25 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote: I wish we could do ``version(DebugFast | Release)`` Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to get correct coverage inclusion of `foo()`. Is this still neeed?

public vs private alias this

2022-11-01 Thread Per Nordlöw via Digitalmars-d-learn
When is it preferrable to use ```d struct S { private T t; alias t this; } ``` instead of ```d struct S { public T t; alias t this; } ``` for any given type `T`?

Sorted Array (Container) Type

2022-11-12 Thread Per Nordlöw via Digitalmars-d-learn
Have anybody created a wrapper container ```d struct Sorted(ArrayLike, alias lessThanPred) ``` that wraps an array-like type `ArrayLike` so that it's always sorted according to the binary predicate `lessThanPred`?

Re: Sorted Array (Container) Type

2022-11-15 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 14 November 2022 at 00:29:40 UTC, Tejas wrote: He said on Discord he want contiguous data structure, rbtree allocates too much rbtree has it's uses cases. I wanted a sorted array because I want to include it in a benchmark suite and study it's time and space complexity. No applicat

Re: Sorted Array (Container) Type

2022-11-15 Thread Per Nordlöw via Digitalmars-d-learn
This is what I have so far. ```d import std.algorithm.mutation : SwapStrategy; /** Wrapper container around array (slice) or array-like (container) `A`. * * See_Also: https://en.wikipedia.org/wiki/Sorted_array */ struct Sorted(A, alias less = "a < b", SwapStrategy ss = SwapStrategy.unstabl

Re: Sorted Array (Container) Type

2022-11-15 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 15 November 2022 at 21:03:24 UTC, Per Nordlöw wrote: This is what I have so far. Found some issues but still cannot instantiate my solution at https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L15 when I uncomment the line containing ```d // TODO: completeSort!(

Re: Sorted Array (Container) Type

2022-11-15 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 15 November 2022 at 22:15:36 UTC, Per Nordlöw wrote: On Tuesday, 15 November 2022 at 21:03:24 UTC, Per Nordlöw wrote: This is what I have so far. Found some issues but still cannot instantiate my solution at https://github.com/nordlow/phobos-next/blob/master/src/nxt/sorted.d#L15

Re: __traits isCopyable vs isPOD

2022-11-28 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 28 November 2022 at 20:58:43 UTC, Per Nordlöw wrote: For which types `T` does ```d __traits(isCopyable, T) ``` differ from ```d __traits(isPOD, T) ``` ? I'm asking because I have code like ```d static if (__traits(isCopyable, Element)) insertAt(elemen

Re: __traits isCopyable vs isPOD

2022-11-28 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 28 November 2022 at 22:59:13 UTC, Paul Backus wrote: Lots of types. For example, types with copy constructors or destructors are not POD but may still be copyable. This should be obvious if you read the definition of POD linked from the language spec: https://dlang.org/glossary.html

Re: __traits isCopyable vs isPOD

2022-11-29 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 29 November 2022 at 00:50:54 UTC, Paul Backus wrote: If your goal is to avoid calling the copy constructor (and, I assume, to avoid unnecessary instantiations of `move`), then yeah, `isPOD` is the one you want. Thanks.

LSP-server for D?

2022-12-05 Thread Per Nordlöw via Digitalmars-d-learn
Is there a D lsp-server available? I couldn't find anything at https://code.dlang.org/search?q=lsp. Am I not using the correct search terms?

Re: LSP-server for D?

2022-12-05 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 5 December 2022 at 12:23:24 UTC, Per Nordlöw wrote: Is there a D lsp-server available? I couldn't find anything at https://code.dlang.org/search?q=lsp. Am I not using the correct search terms? Ahh, it's at https://code.dlang.org/packages/serve-d.

Re: LSP-server for D?

2022-12-05 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 5 December 2022 at 12:38:07 UTC, Per Nordlöw wrote: On Monday, 5 December 2022 at 12:23:24 UTC, Per Nordlöw wrote: Is there a D lsp-server available? I couldn't find anything at https://code.dlang.org/search?q=lsp. Am I not using the correct search terms? Ahh, it's at https://code.

Re: LSP-server for D?

2022-12-06 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 6 December 2022 at 01:48:54 UTC, ryuukk_ wrote: Have you tried this? https://github.com/Pure-D/serve-d/blob/master/editor-emacs.md It should be similar for lsp-mode make sure you provide the proper parameters Ok, thanks.

Re: Is remove safe using foreach

2022-12-13 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 13 December 2022 at 11:22:35 UTC, Per Nordlöw wrote: IRC, the specs says that it's an error to modify a foreach aggregate but the compiler curretly doesn't diagnose it. I believe it should.

Re: Is remove safe using foreach

2022-12-13 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 12 December 2022 at 17:29:00 UTC, Steven Schveighoffer wrote: Removing keys while iterating is not supported. It will break, in confusing ways, and possibly include a null pointer dereference. IRC, the specs says that it's an error to modify a foreach aggregate but the compiler cur

Provisioning C libraries in Windows CI builds

2022-12-19 Thread Per Nordlöw via Digitalmars-d-learn
I just tried activating Linux and Windows CI for https://code.dlang.org/packages/gmp-d via https://github.com/nordlow/gmp-d/.github/workflows/d.yml Linux passes but the Windows builds all fail because `gmp.lib` is not provisioned in the Windows CI. This is new to me so I need some initial gu

Re: serve-d and emacs

2023-04-19 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 28 April 2021 at 23:04:27 UTC, Christian Köstlin wrote: if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo. Its a little tricky, because the basic setup works e.g. with emacs 27.2 or newer, but not with 27.1. All that is needed (if yo

Re: serve-d and emacs

2023-04-19 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote: . Has anybody gotten these things to work? I'm gonna try `lsp-mode` instead of `eglot`.

Re: serve-d and emacs

2023-04-19 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 09:39:19 UTC, Per Nordlöw wrote: On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote: . Has anybody gotten these things to work? I'm gonna try `lsp-mode` instead of `eglot`. I believe this should work ```elisp (defun serve-d-command () "Shell comm

Re: serve-d and emacs

2023-04-19 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 10:35:31 UTC, Per Nordlöw wrote: I believe this should work ```elisp (defun serve-d-command () "Shell command to start serve-d." '("dub" "run" "--vquiet" "serve-d")) (when (require 'lsp nil t) (dolist (mode '(d-mode d-ts-mode)) (add-hook mode #'lsp)

Re: serve-d and emacs

2023-04-19 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 19 April 2023 at 10:35:31 UTC, Per Nordlöw wrote: On Wednesday, 19 April 2023 at 09:39:19 UTC, Per Nordlöw wrote: On Wednesday, 19 April 2023 at 09:37:56 UTC, Per Nordlöw wrote: . Has anybody gotten these things to work? I'm gonna try `lsp-mode` instead of `eglot`. I believe t

Autoformatter for SDLang

2023-04-29 Thread Per Nordlöw via Digitalmars-d-learn
Does anybody know of an autoformatted of SDLang, specifically for dub.sdl?

Re: Need help with 128bit integer ucent boolfilter

2023-10-10 Thread Per Nordlöw via Digitalmars-d-learn
On Friday, 6 October 2023 at 13:44:14 UTC, d007 wrote: I am search for a fast 128bit integer ucent boolfilter, used for server side duplicate request filter. Is 128bit boolfilter a doable thing? or it will not work or will be much more slow compare to 64 bit solution? Can you describe or gi

LDC Stacktrace with symbols instead of addresses

2024-02-10 Thread Per Nordlöw via Digitalmars-d-learn
How do I make LDC stacktraces like ```test-library(+0x1fb232)[0x562230d82232] test-library(+0x2a35b7)[0x562230e2a5b7] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f6ad2242520] test-library(+0x7521a)[0x562230bfc21a] test-library(+0x79083)[0x562230c00083] test-library(+0x2a35f5)[0x562230e2a5f5] tes

Re: LDC Stacktrace with symbols instead of addresses

2024-02-12 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 11 February 2024 at 06:43:19 UTC, Per Nordlöw wrote: How do I make LDC stacktraces like ```test-library(+0x1fb232)[0x562230d82232] So it turns out that ldc2 doesn't show symbols in stack traces by default. IMHO, in debug mode D should adhere to what other languages do. Meaning a

Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn
Why does disabling a struct's postblit increase its sizeof by one word? The following holds: ```d struct S { @disable this(this); int _; } struct T { int _; } static assert(S.sizeof == 16); static assert(T.sizeof == int.sizeof); ``` . Why is this needed?

Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote: Not according to run.dlang.io, for all available DMD versions. Perhaps your tested `S` was nested in some function/aggregate and so had an implicit context pointer. Ahh. Yes. Indeed. My mistake. Thanks.

Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 2 March 2024 at 19:28:08 UTC, Per Nordlöw wrote: On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote: Not according to run.dlang.io, for all available DMD versions. Perhaps your tested `S` was nested in some function/aggregate and so had an implicit context pointer. Ahh. Yes.

Re: Compile-time predicate for checking whether an aggregate field is static

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 2 March 2024 at 19:09:23 UTC, kinke wrote: On Saturday, 2 March 2024 at 15:22:03 UTC, Per Nordlöw wrote: How do I at compile-time check whether an aggregate field is static? https://dlang.org/phobos/std_traits.html#hasStaticMember perhaps. Thanks. Neither my web searches nor Ch

DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
https://github.com/nordlow/phobos-next/releases/tag/v0.6.10 fails to build as ``` ../../.dub/cache/phobos-next/0.6.10/code/phobos-next-test-library-unittest-nyN4MEoglVgAJ1A9GyL6uA/dub_test_root.d(11,15): Error: module `nxt.algorithm.comparsion` from file src/nxt/algorithm/comparison.d must be

Re: DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 16 March 2024 at 07:23:09 UTC, Per Nordlöw wrote: Do you? Fixed it. There was some invisible character that confused the compiler.

Re: DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 16 March 2024 at 07:27:17 UTC, Richard (Rikki) Andrew Cattermole wrote: Do you? ``module nxt.algorithm.comparsion;`` comparsion doesn't look much like comparison to me ;) I know. I'm crushed. Am I getting dislyctic? ;)

Defining classes with cyclic dependencies

2024-03-17 Thread Per Nordlöw via Digitalmars-d-learn
I was surprised that the compiler cannot compile ```d class A { B b; } class B { C c; } class C { D d; } class D { A a; } ``` . Shouldn't it?

Re: Defining classes with cyclic dependencies

2024-03-17 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 17 March 2024 at 20:38:16 UTC, Per Nordlöw wrote: I was surprised that the compiler cannot compile ```d class A { B b; } class B { C c; } class C { D d; } class D { A a; } ``` . Shouldn't it? Ahh, nevermind. I defined these inside a unittest scope so that's why it failed. Defining

Limits of implicit conversion of class arrays

2024-03-23 Thread Per Nordlöw via Digitalmars-d-learn
Is there a reason why ```d class Base {} class Derived : Base {} @safe pure nothrow unittest { Base b; Derived d; b = d; // pass Base[] bs; Derived[] ds; bs ~= ds; // pass bs = ds; // fail [1], should pass bs = cast(Base[])ds; // f

Re: Limits of implicit conversion of class arrays

2024-03-25 Thread Per Nordlöw via Digitalmars-d-learn
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 : Base {} @safe pure nothrow unittest { Base b;

LDC Internal Compiler Error (ICE) mentioning attribute 'nocapture'

2024-03-30 Thread Per Nordlöw via Digitalmars-d-learn
Does anybody recognize the error ``` Attribute 'nocapture' does not apply to function return values %12 = call noalias nocapture align 8 ptr @_D3xxx(ptr nonnull %10, { i64, ptr } %11) #2, !dbg !7978 Attribute 'nocapture' does not apply to function return values ptr @_D3xyz1 Attribute 'nocaptu

Re: Limits of implicit conversion of class arrays

2024-03-31 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 28 March 2024 at 01:53:52 UTC, Steven Schveighoffer wrote: ```d class Base {} class Derived : Base {} @safe pure nothrow unittest { Base b; Derived d; b = d; // pass Base[] bs; Derived[] ds; bs ~= ds; // pass bs = ds; // fail

Structure of Arrays vs Array of Structures

2019-08-26 Thread Per Nordlöw via Digitalmars-d-learn
https://forum.dlang.org/post/cvsajblducyanpqah...@forum.dlang.org On Monday, 15 May 2017 at 06:44:53 UTC, Nordlöw wrote: After having watched Jonathan Blow's talk on Jai https://www.youtube.com/watch?v=TH9VCN6UkyQ&t=2880s I realized that we should add his Array-of-Structures (AoS) concept to

Re: Structure of Arrays vs Array of Structures

2019-08-26 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 26 August 2019 at 09:54:30 UTC, Per Nordlöw wrote: I have made some significant optimizations with regards to compilation performance at https://github.com/nordlow/phobos-next/blob/master/src/soa.d What is the preferred way to implement to support foreach over `x` in struct

Limitation in number of symbols in a single compilation unit

2019-09-12 Thread Per Nordlöw via Digitalmars-d-learn
Is there still a limitation in the number of symbols DMD/LDC can handle for a single compilation unit? Is this limitation target specific and related to a specific linker?

Using enforce or assert to check for fullness when appending to fixed length array container

2019-10-04 Thread Per Nordlöw via Digitalmars-d-learn
I have a wrapper container FixedArray at https://github.com/nordlow/phobos-next/blob/25f4a4ee7347427cebd5cd375c9990b44108d2ef/src/fixed_array.d on top of a static array store that provides the member void insertBack(Es...)(Es es) @trusted if (Es.length <= capacity) // TODO use `isAssign

Fastest way to check if a predicate can take a single parameter of a specific type

2019-10-11 Thread Per Nordlöw via Digitalmars-d-learn
I want to check whether auto _ = pred(T.init); static assert(is(typeof(_) == bool)); compiles or not. Which one __traits(compiles, { auto _ = pred(T.init); static assert(is(typeof(_) == bool)); }) and is(typeof(pred(T.init)) == bool) is preferred compilation performance-wi

Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Per Nordlöw via Digitalmars-d-learn
Why isn't a call to skipOver(string, string) nothrow? I see no reason why it shouldn't be. Further, this test should be qualifyable as nothrow: @safe pure /* TODO nothrow @nogc */ unittest { import std.algorithm.searching : skipOver; auto x = "beta version"; assert(x.skipOver(

Re: Why isn't skipOver(string, string) nothrow?

2019-10-22 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 15:39:17 UTC, Adam D. Ruppe wrote: On Tuesday, 22 October 2019 at 15:33:05 UTC, Per Nordlöw wrote: Why isn't a call to skipOver(string, string) nothrow? without really looking, probably because of invalid utf sequences potentially throwing. Using the .repr

Re: What do you think about About C++20 Concepts?

2019-10-23 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 14:30:32 UTC, lili wrote: Hi: In C++20 Concepts is great idear. but I thinks it is too difficult to write. I like Rust traits simple and elegancy. Andrei Alexandrescou's keynote from CppCon 2018 [1] explains why D's existing template restrictions togeth

<    1   2   3   4   5   6   7   8   9   >