On 10/29/21 7:10 AM, Stanislav Blinov wrote:
On Friday, 29 October 2021 at 11:05:14 UTC, Imperatorn wrote:
On Thursday, 28 October 2021 at 01:39:10 UTC, Thomas Gregory wrote:
I am a maintainer of the
[dhtslib](https://github.com/blachlylab/dhtslib) package and I have
been running into issues w
On 10/18/21 12:03 PM, dangbinghoo wrote:
hi,
It seems that now we have `Optional` and `Result` packages in Dub, are
these enough or fully equal to Rust or Scala's error-handling and
pattern-matching?
if these are enough for real-code, any best practice advice?
thanks!
Not quite the same
On 7/27/21 9:12 PM, Denis Feklushkin wrote:
Spawning fiber is expensive (but not so expensive as spawning thread, of
course), but switching is fast.
Thus, you can spawn and pause "workers" fibers for avaiting of jobs.
(Probably, this behaviour is already implemented in number of libraries
and
On 3/29/21 1:44 PM, drug wrote:
I use asdf https://code.dlang.org/packages/asdf
Also vibe-d https://code.dlang.org/packages/vibe-d has
vibe-d:data subpackage
Also a happy `asdf` user
On 3/19/21 4:04 AM, Chris Piker wrote:
Has there ever been talk of adding C source code support to dub, or is
that a forbidden topic? I know if dub supported C, all my C libs and
all my necessary dependencies (openssl, expat, etc.) would have dub.json
files before the weekend was over.
C
On 2/24/21 2:38 PM, Mark wrote:
Is there a way to obtain a list, at compile-time, of all the exception
types that a function might throw (directly or through a call to another
function)?
Thanks.
Crazy idea:
Could a program import its own source file as a string (`string source =
import('th
On 2/9/21 12:45 AM, JG wrote:
I was trying to profile a d program. So I ran: dub build
--build=profile. I then ran the program and it produced trace.log and
trace.def. I then ran d-profile-viewer and got the following error:
std.conv.ConvException@/home/jg/dlang/ldc-1.24.0/bin/../import/std/co
On 1/20/21 6:50 AM, Marcone wrote:
On Tuesday, 19 January 2021 at 14:20:06 UTC, Imperatorn wrote:
On Tuesday, 19 January 2021 at 11:10:25 UTC, Marcone wrote:
On Tuesday, 19 January 2021 at 06:25:31 UTC, Imperatorn wrote:
On Monday, 18 January 2021 at 19:42:22 UTC, Marcone wrote:
How can I crea
On 1/15/21 4:55 PM, Ola Fosheim Grøstad wrote:
On Friday, 15 January 2021 at 21:18:55 UTC, aberba wrote:
TL;DR:
In summation, the garbage collection system is a robust part of
Unreal Engine that affords C++ programmers a lot of safety from
memory leaks, as well as convenience. With this high-
On 1/7/21 9:53 PM, Jack wrote:
I coduln't find an equivalent in the documentation, I could see
appender, Array, container etc but none of has a Remove(T item) method
like C#'s [1]. Are there not such implementation and I do have to write
one myself or I just couldn't find?
[1]:
https://docs.
On 11/27/20 12:05 PM, Steven Schveighoffer wrote:
FYI, this bug was just fixed (eventcore version 0.9.11). I tested it and
it works.
Thanks Sönke for fixing this!
-Steve
https://github.com/vibe-d/vibe-core/issues/205
Hooray and congrats to Soenke and team!
On 11/6/20 5:51 AM, Andrey Zherikov wrote:
I have auto function 'f' that might return either an error (with some
text) or a result (with some value). The problem is that the type of the
error is not the same as the type of result so compilation fails.
...
How can I make the original code comp
On 11/7/20 7:58 AM, Arjan wrote:
Is there a cmdline switch to DUB to override certain dub.sdl settings
for a dependency? Like the addition or override to lib dirs or link-libs?
For example once and a while I run into linking issues with symbols not
found due to the `soname` being different on
On Thursday, 5 November 2020 at 16:22:11 UTC, Alaindevos wrote:
This is from the bootstrap documentation. I think you must
adapt this to .dt files.
Correct. It looks like flask_bootstrap is just a convenience that
injects the js and css scripts or script URI for you into master
flask template
On Wednesday, 4 November 2020 at 19:01:16 UTC, Alaindevos wrote:
(title).
In flask it is "from flask_bootstrap import Bootstrap".
But what do you have to do with vibe.d ?
I am not sure you really understand what bootstrap is?
On 10/31/20 8:28 PM, Jesse Phillips wrote:
Well I was putting this together, but didn't want to attempt submission
until I felt I would be able to put in the time for the review process
https://github.com/JesseKPhillips/DIPs/blob/serialize/attribute/DIPs/1NNN-jkp.md
Bravo! An idea whose time
On 10/30/20 1:56 PM, Steven Schveighoffer wrote:
I was looking to report an enhancement request to vibe.data.json (filed
here: https://github.com/vibe-d/vibe.d/issues/2490), and I started
looking at the serialization code for vibe. It's really really
complicated, and I'm just wondering if this
On 10/26/20 9:19 PM, Ruby The Roobster wrote:
Following code doesn't work(it's not the actual code but it represents
it). Is there some rule about function overrides that I don't know about?
...
The error I keep getting no matter what says: Error: Multiple Overrides
of Same Function. Anybody
On 10/13/20 5:23 AM, Jamie wrote:
Building with:
g++ -c a.cpp
dmd main.d a.o
Throws the error:
/usr/bin/ld: main.o: in function `_Dmain':
main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void
func3(int*, int*)'
/usr/bin/ld: main.d:(.text._Dmain[_Dmain]+0x3e): undefined reference to
On 10/5/20 11:42 AM, Alaindevos wrote:
Use "rangify" template to get forward range from answer
Thanks, this answers the question on programmatic level.
Yet I guess something is special with the answer datatype which makes
foreach to fail.
Instead of thinking of it as "foreach failing," instea
On 10/2/20 9:32 AM, Steven Schveighoffer wrote:
This seems like an oversight. But it's not impossible.
Thank you Steve. Is there any chance that this mechanism will ever be
revised? Presumably it would require a DIP.
Just curry the information to the receiver. opDollar doesn't have to
retur
Suppose I have a data structure encoding sequence lengths:
seq1: 0 1 2 ... N
seq2: 0 1 2 3 4 ... M
seq3: 0 1 ... P
I would like to write opIndex and opDollar to support the notation
obj[seq, x .. $] to retrieve sequences.
However, given that opDollar is templated on dimension (always 1 in thi
On 9/24/20 6:22 PM, mw wrote:
Hi,
I'm just wondering what's the best way to convert sysTime to local
machine's time (zone)?
Is there any library function does this already?
https://dlang.org/phobos/std_datetime_systime.html#SysTime
(The time in SysTime is kept internally in hnsecs from mid
On 9/18/20 9:35 AM, Russel Winder wrote:
On Fri, 2020-09-18 at 09:02 -0400, Steven Schveighoffer via Digitalmars-d-
learn wrote:
[…]
it ddoc files, and compile those along with your
application.
https://dlang.org/spec/ddoc.html#using_ddoc_for_other_documentation
Any small project examples
On 9/17/20 12:46 PM, IGotD- wrote:
The only way is to return from main. The thing is that druntime runs
initialization before main and then returning from main it runs all the
tear down code including cleaning up the GC. This means there is no
equivalent of the exit function in the C library. C
On 9/15/20 8:24 PM, James Blachly wrote:
Again with the self-reply :/
Forgot the reference:
https://www.unicode.org/versions/Unicode13.0.0/ch22.pdf
On 9/15/20 8:10 PM, James Blachly wrote:
Steve: It sounds as if the spec is correct but the glyph (codepoint?)
range is outdated. If this is the case, it would be a worthwhile update.
Do you really think it would be rejected out of hand?
OK interestingly this code point 0x2202 falls within the
On 9/15/20 10:59 AM, Steven Schveighoffer wrote:
Thanks to Paul, Jon, Dominikus and H.S. for thoughtful responses.
What will it take (i.e. order of difficulty) to get this fixed -- will
merely a bug report (and PR, not sure if I can tackle or not) do it,
or will this require more in-depth disc
On 9/15/20 4:36 AM, Dominikus Dittes Scherkl wrote:
On Tuesday, 15 September 2020 at 06:49:08 UTC, Jon Degenhardt wrote:
On Tuesday, 15 September 2020 at 02:23:31 UTC, Paul Backus wrote:
Identifiers start with a letter, _, or universal alpha, and are
followed by any number of letters, _, digits
I wish to write a function including ∂x and ∂y (these are trivial to
type with appropriate keyboard shortcuts - alt+d on Mac), but without a
unicode byte order mark at the beginning of the file, the lexer rejects
the tokens.
It is not apparently easy to insert such marks (AFAICT no common tool
On 9/13/20 2:35 PM, ag0aep6g wrote:
Easy peasy:
import std.meta: Repeat;
Repeat!(kvargs.length, const(char)*) zs;
foreach (i, ref z; zs) z = toStringz(kvargs[i]);
return sam_hdr_add_line(this.h, type.ptr, zs, null);
Great, thank you!
By the way, `kvargs` is
Summary:
Can a typesafe D variadic function, or D variadic template pass its
parameters to a C variadic function?
Background:
I maintain a library binding [0] to htslib, a high-performance and very
widely used C library for high-throughput sequencing (hts) data files.
We use this internally a
On 9/11/20 7:28 AM, Daniel Kozak wrote:
void fun(HTTPServerRequest req, HTTPServerResponse res) nothrow
{
try
{
res.headers["Content-Disposition"] = "filename=\"muj.csv\"";
res.writeBody("some;csv;data", "text/csv");
}
catch (Exception e)
{}
}
Selim, note the Content-Disposition header in parti
On 9/1/20 2:55 PM, Steven Schveighoffer wrote:
On 9/1/20 2:20 PM, Jesse Phillips wrote:
Using RangeError is nice as it allows code to use array index inside
`nothrow.`
This is the big sticking point -- code that is nothrow would no longer
be able to use AAs. It makes the idea, unfortunately,
On Saturday, 29 August 2020 at 11:27:28 UTC, Kirill wrote:
I need a stand-alone executable that does not require the user
to install any libraries on their computer. Everything should
be packed into the executable.
I understand that I need to statically link all of the
libraries I use in my p
On Tuesday, 25 August 2020 at 18:42:53 UTC, codic wrote:
I'd like to be able to change the callback of a vibe.d Timer
(eg created with
http://vibe-core.dpldocs.info/v1.9.3/vibe.core.core.createTimer.html) after creation, something like:
auto timer = createTimer();
timer.rearm(duration, /*...*/
Peeling off from Mathias Lang's thread in General about making
'in' useful, for some novice questions:
1. The thread involves 'in' qualifier. Documentation
(https://dlang.org/spec/function.html#param-storage) indicates
that `in` is defined as `scope const` and should not be used as
it is not
On Monday, 24 August 2020 at 19:56:49 UTC, Tariq Siddiqui wrote:
Hello everyone,
I am looking for a master thesis topic using D Programming
language. Earlier I choose Design by Introspection, but I did
not find enough material in academic journals. DbI total
material which I found is DConf An
On Tuesday, 18 August 2020 at 13:07:56 UTC, Arredondo wrote:
On Tuesday, 18 August 2020 at 04:07:56 UTC, 9il wrote:
To reorder the columns data according to precomputed index:
auto index = a.byDim!1.map!sum.slice;
Hello Ilya, thanks for the answer!
Unfortunately I can't use it because I don't
On 7/18/20 8:16 AM, Andre Pany wrote:
On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote:
>> ...
I started the program with "dub" command and everything worked as I
expected. Except that there were a lot "deprecation" warnings and long
time to compile.But when I exit the service by ct
On 8/10/20 1:51 AM, Andy Balba wrote:
generating random numbers using
https://dlang.org/library/std/random/uniform01.html
I find the example given in this section totally incomprehensible
.. Can any help me answer two simple questions:
How to generate a random floating number in range [0,1) ?
H
On 3/15/20 5:28 PM, Simen Kjærås wrote:
...
Since toStringImpl will always call toStringBase, this could perhaps
better be modeled with a template mixin:
mixin template DerivedToString() {
override string toStringImpl() {
return this.toStringBase();
}
}
class Derived2 : Base
I would like to programmatically retrieve members of a subclass to
create a self-documenting interface. I am afraid that my approach is not
possible due to need for compile time __traits / std.traits, and runtime
typeinfo. My proposed approach is as follows:
class Base
{
string whatever;
On 1/23/20 8:13 PM, Mike Parker wrote:
On Thursday, 23 January 2020 at 15:44:10 UTC, Adam D. Ruppe wrote:
Or delete all that wordpress junk and make something in D :P
I intend to delete all that Wordpress junk and go completely static
eventually.
Mike, I know we're not a golang shop, but I
On 1/22/20 7:58 PM, Adam D. Ruppe wrote:
On Thursday, 23 January 2020 at 00:52:10 UTC, Mike Parker wrote:
Got any examples? No one has reported this to me before and I haven’t
encountered a 404 in a while.
Almost all of them!
Hit F12 to open browser tools and notice the network tab:
https://
On 1/15/20 3:06 PM, mark wrote:
I am learning D for the first time.
While I wait for Mike Parker's "Learning D" book to arrive, I have
started using the tour.
I really like the tour, especially the fact that you can run and tweak
the code as well as read the explanations.
However, ...
Ma
On 11/17/19 7:15 PM, Steven Schveighoffer wrote:
On 11/17/19 10:45 AM, James Blachly wrote:
/home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3453,36):
Error: cannot implicitly convert expression aa of type
shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])
TL;DR druntime regression?
https://gist.github.com/jblachly/78c5762bbfea65b09e7a1417ad763019
---
Our team has an older codebase that compiled fine up until frontend
version 2.087 (builds with 2.086.1). Now, compiler (DMD2 and LDC2)
complains about implicit conversion of shared(AA) to const(s
On 11/16/19 10:20 AM, James Blachly wrote:
On 11/16/19 9:48 AM, James Blachly wrote:
I am trying to write templated code that will take a character array
-- mutable, const, or immutable (string).
I am aware of isSomeString, but I am still curious about Unqual array
from a learning perspective
On 11/16/19 9:48 AM, James Blachly wrote:
I am trying to write templated code that will take a character array --
mutable, const, or immutable (string).
I am aware of isSomeString, but I am still curious about Unqual array
from a learning perspective.
I am trying to write templated code that will take a character array --
mutable, const, or immutable (string).
static assert(is(Unqual!(const char) == char));
(Succeeds)
static assert(is(Unqual!(const(char)[]) == char[]));
Error: static assert: `is(const(char)[] == char[])` is false
Is th
On 8/31/19 5:12 PM, ag0aep6g wrote:
I've made a pull request to get rid of those allocations:
https://github.com/dlang/phobos/pull/7163
Wonderful!
For my own learning, why was a unittest to ensure no GC added to sformat
instead of a @nogc annotation?
The documentation for std.experimental.allocator is a little dense and I
wanted to make sure I am understanding composition correctly.
Suppose I have the following, taken more-or-less direct from the docs:
auto batchAllocator = AllocatorList!(
(size_t n) => Region!Mallocator(max(n,
On 8/3/19 5:26 AM, Andrey wrote:
Hello, how to get name of my application (project) that we write in
dub.json? Is there any compile-time constant like __MODULE__?
Dear Andrey:
Perhaps this is similar to what you are looking for:
https://dlang.org/spec/grammar.html#SpecialKeyword
SpecialKeywo
On 5/19/19 2:34 AM, Andrew Edwards wrote:
P.S. Why do we still have two sets of documentations ([1],[2]) for the
language? Which is the official one and when can we get rid of the other?
[1] https://dlang.org/library/std/array.html
[2] https://dlang.org/phobos/std_array.html
I have wondered t
On 5/4/19 5:27 PM, Andre Pany wrote:
On Saturday, 4 May 2019 at 21:16:25 UTC, James Blachly wrote:
It is listed in the build settings table of the referenced link.
Kind regards
Andre
Somehow firefox enabled "whole word" search *rolleyes*, which I did not
even realize was a thing. Thanks an
the preBuildCommand is no longer listed in the dub format spec[1]
although it shows up in the google cache for the page. When was it
removed, and why? I can't find any announcement.
[1] https://dub.pm/package-format-json.html
On 5/3/19 5:42 AM, Ali Çehreli wrote:
On 05/02/2019 08:21 PM, James Blachly wrote:
On 5/2/19 4:05 PM, ag0aep6g wrote:
Just slice the pointer with the length:
int* ptr;
size_t len;
int[] arr = ptr[0 .. len];
Perfect thanks. I searched but without using the magic word "slice" I
On 5/2/19 4:05 PM, ag0aep6g wrote:
Just slice the pointer with the length:
int* ptr;
size_t len;
int[] arr = ptr[0 .. len];
Perfect thanks. I searched but without using the magic word "slice" I
couldn't find meaningful results.
Thanks again.
I work a lot with C functions, many of which yield pointer + length.
Is there a way to cast this or materialize a D-style array backed by the
already allocated data (with length) to avoid copies which slow things down?
I recognize memory management is a complication. Typically, I would be
res
On 3/29/19 7:52 PM, H. S. Teoh wrote:
On Fri, Mar 29, 2019 at 10:48:47PM +, Chris Katko via Digitalmars-d-learn
wrote:
...> There are probably other similar gotchas, but these are the ones
off the
top of my head. Feel free to ask if you're having trouble correctly
translating something fr
On 3/22/19 9:24 AM, Alex wrote:
On Friday, 22 March 2019 at 12:08:39 UTC, James Blachly wrote:
First, how do we deal with toString, std.format, writeln, etc. with
un-copyable objects, when it is only a member that is uncopyable? In
my case I got around this by creating a pointer and moving the
I have a struct S with member containers.UnrolledList [1]. UnrolledList
is @disable this(this), but this unfortunately makes my struct S also
un-copyable, which now breaks some of my debugging statements which rely
on toString, as writeln, format, etc. all copy the object. This leaves
me in the
On 3/21/19 6:51 PM, James Blachly wrote:
On 3/21/19 6:01 AM, Johannes Pfau wrote:
On Thursday, 21 March 2019 at 08:19:56 UTC, Per Nordlöw wrote:
At
https://github.com/D-Programming-GDC/GDC/commits/master
there's the heading
"This repository has been archived by the owner. It is now read-only
On 3/21/19 6:01 AM, Johannes Pfau wrote:
On Thursday, 21 March 2019 at 08:19:56 UTC, Per Nordlöw wrote:
At
https://github.com/D-Programming-GDC/GDC/commits/master
there's the heading
"This repository has been archived by the owner. It is now read-only."
Where will the development of GDC cont
On 3/7/19 8:00 PM, Philos Kim wrote:
I want to make a nested array and flatten it at run-time like this.
auto nestedArray = [1, 2, [3, 4], 5];
auto flattenedArray = myFun(nestedArray);
writeln(flattenedArray); // => [1, 2, 3, 4, 5]
How can I do this in D?
Please help me out!
There are
On 2/25/19 2:09 AM, Nicholas Wilson wrote:
Leaving aside the issue of why DMD can't handle this, the entire reason
pragma(inline, bool) takes a bool is for it to be (potentially)
predicated.
In this case you want:
version(DigitalMars)
private enum inline_overlaps = false;
else // assumin
On 2/25/19 2:09 AM, Nicholas Wilson wrote:
Leaving aside the issue of why DMD can't handle this, the entire reason
pragma(inline, bool) takes a bool is for it to be (potentially) predicated.
In this case you want:
version(DigitalMars)
private enum inline_overlaps = false;
else // assuming
Any ideas why DMD2 cannot inline this, but LDC2 has no problem doing so
-- or suggestions for what I can do to make DMD2 inline it?
Alternatively, I could version(DigitalMars) and version(LDC), but AFAICT
this requires me to duplicate the entire template, because I cannot
figure out how to mak
On Tuesday, 5 February 2019 at 16:24:03 UTC, Eduard Staniloiu
wrote:
I think you are making a slight confusion. Your `Interval`
struct and the `Elem` type that `lowerBound` takes, are the
same type.
You can define your RBTree and Interval as follows
```
struct Interval
{
int start;
int
On Tuesday, 5 February 2019 at 10:10:44 UTC, RazvanN wrote:
On Monday, 4 February 2019 at 22:54:01 UTC, James Blachly wrote:
I tried to implement an interval tree backed by
std.container.rbtree today and fell flat.
[...]
You can use alias this [1] in your interval element type:
struct Interv
I tried to implement an interval tree backed by
std.container.rbtree today and fell flat.
A standard way to make an interval tree is to make an augmented
tree; I supposed since rbtree was a generic container and because
I could define opCmp, this should be a cinch. I ran into two
problems.
Great -- Thank you both.
I previously found Unqual, but it looks like that needs template
support so wasn't feasible, hence my question.
Neia is right that I tried to cast as in the second case ( but
without UFCS -- reserve( cast(int[]), N); ). As an aside, what
is going on behind the scene
When I add the "shared" attribute to an array, I am no longer
able to call reserve because the template won't instantiate:
Error: template object.reserve cannot deduce function from
argument types !()(shared(int[]), int), candidates are:
/dlang/dmd/linux/bin64/../../src/druntime/import/object.d
On Friday, 31 August 2018 at 17:50:17 UTC, Steven Schveighoffer
wrote:
What the C compiler is doing is storing it as data, and then
storing the symbol to point at the first element in the data.
When you use const char* in D, it's expecting a *pointer* to be
stored at that address, not the data
On Friday, 31 August 2018 at 17:18:58 UTC, Neia Neutuladh wrote:
On Friday, 31 August 2018 at 06:20:09 UTC, James Blachly wrote:
Hi all,
...
When linking to this library from D, I have declared it as:
extern __gshared const(char)* seq_nt16_str;
***But this segfaults when I treat it like an a
On Friday, 31 August 2018 at 12:52:17 UTC, bauss wrote:
So basically ... Instead of copying the value, you're just
copying the address.
I can't see the benefit other than added complexity.
I assume a benefit could be observed if you are copying a large
struct instead of an int.
Hi all,
I am linking to a C library which defines a symbol,
const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN";
In the C sources, this is an array of 16 bytes (17 I guess,
because it is written as a string).
In the C headers, it is listed as extern const char
seq_nt16_str[];
When linking to t
On Monday, 13 August 2018 at 13:20:25 UTC, Seb wrote:
BTW it's very uncommon for empty to do work, it's much more
common to do such lazy initialization in `.front`.
Thanks Seb, that entire reply is a huge help.
By lazy initialization in `.front`, do you mean that I should
find a way for `f
On Thursday, 14 June 2018 at 00:42:25 UTC, James Blachly wrote:
...
I assume the (apparent) lack of parity between ctor and dtor is
because the "default postblit" (which I figured out for a
struct means an empty `this(this)` ctor) is called when a copy
is made. My understanding is that I canno
Hi all,
I now really appreciate the power Ranges provide and am an avid
consumer, but am only slowly becoming accustomed to implementing
my own.
In the present problem, I am writing a binding to a C library
(htslib) that provides many functions related to high-throughput
sequencing files. O
Consider the below:
```
class C
{
int x;
}
struct S
{
int x;
}
void main()
{
immutable C[] c = [ new C(), new C()];
immutable S[] s = [ S(), S() ];
immutable int[] i = [ 1, 2 ];
auto x = c.dup;
auto y = s.dup;
auto z = i.dup;
}
```
This fails to compi
I am puzzled why enumerating in a foreach returns a dchar (which
forces me to cast), whereas without the enumerate the range
returns a char as expected.
Example:
```
import std.stdio;
import std.range : enumerate;
void main()
{
char[] s = ['a','b','c'];
char[3] x;
auto i = 0;
On Wednesday, 14 March 2018 at 22:58:25 UTC, ag0aep6g wrote:
You can probably get around the (manually maintained?) `FIELDS`
array with `.tupleof` or something similar:
static foreach (i, f; S.tupleof)
{
case __traits(identifier, f):
}
Any pointers / design patterns on this parti
For context, please keep in mind I am coming from a python
background, but am very much enjoying strong typing, although it
is taking some significant adjustment.
Suppose I have a struct (which is really a memory map of a data
file I am reading in) with too many data members to reasonably
cod
85 matches
Mail list logo