https://github.com/Boris-Barboris/libaio/blob/master/source/libaio/package.d
https://code.dlang.org/packages/libaio
If you need to write some shady block-level stuff for Linux
libaio this thin Derelict loader can save a day of your time.
import std;
import std.range;
void main()
{
int[] a = [3, 5, 7];
foreach (i, ref ae; a.enumerate)
{
writeln(i, " ", ae);
ae = 6;
}
writeln(a);
assert(a[].equal([6, 6, 6])); // fails, a is in initial state
}
Why does the compiler allow such 'ref ae' loop,
On Tuesday, 21 May 2019 at 17:16:05 UTC, Russel Winder wrote:
Hi,
Has anyone used D to work with arbitrary length bitfields with
multiple occurences of a sub-bitfield. I am working with DVB
Sections and EIT packets are defined as bitfields with loops in
them and the header is 112 bits. The
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote:
What makes it decide to collect? What triggers it?
You can try setting heapSizeFactor option to something lower than
2 to increase collection frequency:
On Sunday, 19 May 2019 at 22:20:48 UTC, Josh wrote:
This is just more curiosity, but do you happen to know why I
have to use DList.linearRemove() instead of DList.remove()?
These two functions are separate because they differ in
complexity. remove is O(1), linearRemove on the other hand
On Friday, 14 December 2018 at 21:22:05 UTC, unDEFER wrote:
So it looks like a bug, and I have reported about it:
https://issues.dlang.org/show_bug.cgi?id=19487
Not an expert, but you may wish to try GC.minimize()
(https://dlang.org/phobos/core_memory.html#.GC.minimize).
On Thursday, 13 December 2018 at 09:51:42 UTC, aliak wrote:
Ie:
struct S {
@disable this(this);
this(int i) {}
}
struct Container(T) {
T value;
this(T value) {
this.value = value;
}
}
void main() {
auto a = Container!S(S(3)); // can't do this.
}
I can build a
On Tuesday, 20 November 2018 at 13:20:08 UTC, Stanislav Blinov
wrote:
https://dlang.org/changelog/2.083.0.html#reboot14246
Wording "object" means both classes and structs?
On Tuesday, 20 November 2018 at 13:20:08 UTC, Stanislav Blinov
wrote:
https://dlang.org/changelog/2.083.0.html#reboot14246
Nvm, found the info in the issue tracker, thank you for the link.
https://run.dlang.io/is/LdylJX
Notice no "B destructor" line in stdout.
Just got bitten by the assumption that my Buffer struct that
transactionally aquires multiple external resources in
constructor will rollback via member destructors that were
successfully completed before the throw.
On Sunday, 14 October 2018 at 01:31:26 UTC, Jonathan M Davis
wrote:
Unless there's something about the implementation that's tied
to the list itself, I would think that it would make more sense
to make it a generic algorithm, then it will work with any
non-random-access range, and it avoids
On Sunday, 7 October 2018 at 02:01:17 UTC, Manu wrote:
... but I'm really struggling
to express it in terms of the type system...
I'm pretty sure no simple attribute system is any more useful
than current const\shared idiom. I am yet to see a language with
semantics that actually help with
On Monday, 1 October 2018 at 23:07:29 UTC, spikespaz wrote:
The problem with the code you have is that the callback needs
to be extern (Windows). I don't know how to do that with a
"lambda".
Neither do I actually. Apparently it is impossible.
Best I could squeeze out was this:
On Monday, 1 October 2018 at 20:27:43 UTC, spikespaz wrote:
I was hoping I could use something more akin to JavaScript's
syntax: (void* hWnd, long) => {}.
I tried this but I'm getting errors with the signature, it says
the function is a delegate and apparently Windows API can't
accept a
On Saturday, 25 August 2018 at 20:52:06 UTC, Walter Bright wrote:
I.e. a nothrow constructor now must call a throwing destructor.
This is not some made up example, it breaks existing code:
https://github.com/dlang/dmd/pull/6816
If I fix the bug, I break existing code, and apparently a
On Wednesday, 4 July 2018 at 10:47:12 UTC, Jonathan M Davis wrote:
At this point, to operate on anything that's shared, either
means using atomics or protecting the data with a mutex (be
that with a synchronized block / function or a mutex object)
and temporarily casting away shared while
Given the pain of shared usage with std and pretty much every
library in existence, I cowboyed the server without this
qualifier. One of the mechanisms required atomic class reference
compare-and-set, and the class reference is not shared, because
it would otherwise require, like, 30 or 40
On Sunday, 1 April 2018 at 22:44:45 UTC, Jonathan M Davis wrote:
Which doesn't work in @safe code and doesn't work when you have
an rvalue as you would when passing 42. Ultimately, using
pointers ultimately either requires explicitly allocating stuff
on the heap to be able to pass rvalues, or
On Sunday, 1 April 2018 at 22:25:45 UTC, Jonathan M Davis wrote:
How would a pointer help? Instead of doing
foo(nullable(42))
he'd have to do
foo(new int(42))
which is just one character shorter and ends up allocating on
the heap, unlike with Nullable.
- Jonathan M Davis
foo();
On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer
wrote:
I currently have a situation where I want to have a function
that accepts a parameter optionally.
I would simply use a pointer for this. Fighting D grammar seems
too much of a hassle for such simple task.
On Friday, 30 March 2018 at 20:31:35 UTC, Per Nordlöw wrote:
Is there a faster way of allocating many small class objects
such as...
maybe something like this:
import std.conv: to;
import std.stdio;
class Node {}
class StrNode : Node
{
string value;
}
void main()
{
On Tuesday, 27 March 2018 at 09:27:07 UTC, Jonathan M Davis wrote:
On Tuesday, March 27, 2018 09:15:43 Boris-Barboris via Now that
DIP 1000 is being implemented, and scope is actually going to
do something for more than just delegates, it was deemed too
dangerous to have in suddenly really
Hello! Can someone point me to the changelong entry or maybe a
pull request, wich changed the "in" from "scope const" to
"const"? I thought the previous matter of things was pretty
natural, and current "in" is now redundant. Would be glad to read
up on this design decision.
On Saturday, 10 February 2018 at 06:32:43 UTC, German Diago wrote:
The mixin line does not work. I want to generate the access to
the field. How could I achieve that?
struct Outer
{
struct Inner
{
int a;
float b;
}
Inner i;
On Tuesday, 6 February 2018 at 23:08:48 UTC, David Nadlinger
wrote:
Apparently, GDC folks do not populate builtin module, so there's
no easy way to look check it, besides actually trying to compile:
On Tuesday, 6 February 2018 at 23:08:48 UTC, David Nadlinger
wrote:
Oh, look:
https://github.com/ldc-developers/druntime/blob/7b77937c70b4aba720e98727dcaad3323c29bd8d/src/ldc/intrinsics.di#L579-L587
— David
Not gcc, no platforms, BEBEBEBEBEBE.
On the serious note: nice, good to see.
On Tuesday, 6 February 2018 at 02:31:42 UTC, psychoticRabbit
wrote:
Plenty of others seems to have a different opinion ;-)
That's just my opinion. My generation has plenty of C++
programmers, but I have no acquaintance who does userspace C. I
would never do that too, unless forced to work
On Monday, 5 February 2018 at 23:42:18 UTC, welkam wrote:
There is PGO (Profile Guided Optimization) that can do that
without additional language extensions. You need to find better
example to support your claims.
It is sometimes impossible. Some parts of the Linux kernel cannot
be profiled
On Monday, 5 February 2018 at 20:12:09 UTC, Walter Bright wrote:
Most of those gcc builtin's I've never heard of, and I've been
programming C for 35 years now. I've also never had a use for
them. I find it hard to believe that list would be a deal
breaker, especially since much of it seems to
On Monday, 5 February 2018 at 05:28:54 UTC, Walter Bright wrote:
True, D cannot directly read .h files. There are tools, though,
to convert C .h files to D.
'Tools' sounds very capritious, but I have no experience with
such things. I somehow doubt things like SWIG will work ok on
kernel
On Sunday, 4 February 2018 at 20:15:47 UTC, bpr wrote:
Which benefits of C are lost?
Ability to interface with C using C header files of a target
library\executable as-is. Being able to understand the interfaces
your operating system provides, described on the language it
uses, is a huge
On Saturday, 13 January 2018 at 17:58:14 UTC, Joe wrote:
...ddb. The latter perhaps has the distinction that it doesn't
use libpq, but rather implements the Postgres FE/BE protocol.
That's a bit *too* native for my taste. It means the library
maintainer has to keep up with changes to the
On Tuesday, 5 September 2017 at 03:22:37 UTC, denizzzka wrote:
On Monday, 4 September 2017 at 17:56:04 UTC, Boris-Barboris
wrote:
On Monday, 4 September 2017 at 16:05:17 UTC, denizzzka wrote:
Sorry fot duplicate answer
Ok, just FYI, I guess what I described was implemented in
libpq for
On Monday, 4 September 2017 at 16:05:17 UTC, denizzzka wrote:
Sorry fot duplicate answer
Ok, just FYI, I guess what I described was implemented in libpq
for version 9.6 (but works on any PSQL since 8.4, since they all
implement extended query protocol i wrote the client for) in a
form of
On Monday, 4 September 2017 at 15:53:30 UTC, denizzzka wrote:
I dare say that you are engaged in premature optimization.
Quite possible, but it took tolerable amount of time. I definetly
will play with dpq2 more some day, maybe there is indeed no need
to reinvent libpq. But what's done is
On Monday, 4 September 2017 at 15:45:23 UTC, denizzzka wrote:
Also, ORM is typical architecturial error.
https://en.m.wikipedia.org/wiki/Object-relational_impedance_mismatch
It's a tool. Error is when you use wrong tool for your job. ORMs
surely help many people, and do a lot of good.
On Monday, 4 September 2017 at 15:40:47 UTC, denizzzka wrote:
This is just internal function. Don't try to call it from your
application.
I guess it's the Python curse
Oh... What is it:
PARSE + BIND + EXEC + SYNC
?
Yeah, that's what I do currently, just write the whole command
chain (same
On Monday, 4 September 2017 at 15:28:11 UTC, denizzzka wrote:
What do you mean?
It seems like a very generic method way to send batched messages,
wich would give a lot of freedom.
Possible without any src modify.
Will linux socket get a send called between them, or it will be
buffered by
On Monday, 4 September 2017 at 14:42:31 UTC, denizzzka wrote:
https://github.com/denizzzka/vibe.d.db.postgresql uses dpq2
backend
https://github.com/denizzzka/vibe.d.db.postgresql/blob/master/source/vibe/db/postgresql/package.d#L92
Very interesting read, thank you.
Making this:
On Monday, 4 September 2017 at 12:07:29 UTC, Jacob Carlborg wrote:
Ah, ok. I didn't know about hb-ddb until you started this
thread. I'm currently one of the maintainers of ddb and I
haven't seen anything upstreamed there.
Haha, yeah, I guess I've developed a habit of looking at github
On Monday, 4 September 2017 at 09:30:06 UTC, Suliman wrote:
Could you give an example how to make connection object if I
need access to it from several classes? Should it be global?
"""Good way""" is probably to wrap it into some ConnectionPool
(at least that's what I did).
Snipper from
On Monday, 4 September 2017 at 06:40:09 UTC, Jacob Carlborg wrote:
If would be great if you want to upstream your improvements.
I think it's a bit unfortunate that everyone is rolling their
own implementations in this community instead of working
together. I would say that it's rare to need
Hi! Couple of weeks ago I was approached with a task of writing
simple microservice, and I decided to give D a chance. The
problem with performance became apparent very soon, and I started
to look for the cause. I tried all existing libraries, and noted
pretty mature dpq2 and ddb (and it's
On Friday, 23 June 2017 at 20:13:07 UTC, ag0aep6g wrote:
You've got bad `@trusted`s:
Ty, I misunderstood the concept. I guess in a code like this it's
mostly @system anyways, too many indirections to control safety
level. I'm probably gonna remove most of the attributes.
Hi, I wrote a small library, inspired by atilaneves automem. I
didn't like some things, especially that smart pointers proxied
underlying types, also I wanted class upcasting.
https://github.com/Boris-Barboris/daii
https://code.dlang.org/packages/daii
What do you think about the
On Thursday, 22 June 2017 at 21:16:40 UTC, Ali Çehreli wrote:
And yes, there should be one destructor, which may be a no-op
if you grab its resource and set it to null.
On all compilers...
That's a relief, thank you for your help.
On Thursday, 22 June 2017 at 20:05:46 UTC, Ali Çehreli wrote:
To be complete, 'auto ref' passes lvalues by reference and
rvalues by value, which you can detect with __traits(isRef):
struct S{
}
void foo()(auto ref S s) {
static if (__traits(isRef, s)) {
pragma(msg, "lvalue");
On Thursday, 22 June 2017 at 19:17:13 UTC, Ali Çehreli wrote:
No time to think about the rest of the design but just to get
the code compiled, replace 'ref' with 'auto ref' like so:
Ok, looks like this indeed passes rhs by reference, thank you.
destcalls - number of times UniquePtr destructor
On Thursday, 22 June 2017 at 19:17:13 UTC, Ali Çehreli wrote:
No time to think about the rest of the design but just to get
the code compiled, replace 'ref' with 'auto ref' like so:
this(DT)(scope auto ref UniquePtr!DT rhs)
{
// ...
}
Ali
i added this static variable:
On Thursday, 22 June 2017 at 19:11:19 UTC, Cym13 wrote:
Here it's the programmer's fault really. You should never use
casts in normal code, cast is the ultimate switch to say "Look,
I know what I'm doing, so disable all safety, don't try to make
sense of it, and let me do my thing. If I'm
Hi
https://dpaste.dzfl.pl/0def4e286564
Is there a cleaner way to go than the one on the line 26? And why
is the constructor
/d475/f781.d(37): f781.UniquePtr!(A).UniquePtr.__ctor(DT)(ref
scope UniquePtr!DT rhs)
unfit for line 51?
Is it because the expression " = UniquePtr!B.make()" cannot
On Thursday, 22 June 2017 at 13:56:29 UTC, ag0aep6g wrote:
For example, the type system guarantees that immutable data
never changes. But the compiler allows you to cast from
immutable to mutable and change the data. It's an invalid
operation, but the compiler is not expected to catch that for
On Thursday, 22 June 2017 at 09:45:09 UTC, Russel Winder wrote:
I think the term "systems programming language" contains no
actual data, so needs to be retired. In this situation it
provides no reason for conservative garbage collection.
It means the intent of language designer to let you
On Monday, 19 June 2017 at 06:34:49 UTC, Ali Çehreli wrote:
It's unreliable because structs are value types in D, which
means that they can be moved around freely. This is why
self-referencing structs are illegal in D.
I guess it's more like the spec states, that they can be moved
vithout
Hello, I was trying to write some templated unique pointers.
Idea was simple: struct UniquePointer that handles underlying
pointer in RAII-style and WeakPointer struct that is spawned by
UniquePointer. Weak pointer is handled differently in my
collections, wich subscribe to the event of
On Thursday, 8 June 2017 at 22:42:14 UTC, Boris-Barboris wrote:
1). Do I understand correctly, that there is currently no way
(aside from editing the sources of course) to efficiently
(using one underlying iteration) remove all\first element(s)
from DList based on a predicate?
Oh, sorry, I
Good day to you reader! I have a couple questions about Phobos:
1). Do I understand correctly, that there is currently no way
(aside from editing the sources of course) to efficiently (using
one underlying iteration) remove all\first element(s) from DList
based on a predicate? Can such
Ok, sorry, look's like that was always the case in C++, so it's
too late to question it. I'll just elevate it to package, I guess.
Hi!
I have a base class in module A:
module A;
...
class GuiElement: GuiComponent
{
protected
{
GuiElement _parent;
...
}
template isGuiElement(T)
{
enum isGuiElement = is(T: GuiElement);
}
...
and derived class in module B:
module B;
...
class Div(uint dim, uint odim):
On Sunday, 9 April 2017 at 16:44:41 UTC, ag0aep6g wrote:
Or you can make it a template value parameter [2] with type
`string[]`:
string[] sfilter(T, string[] fields)()
{
string[] result;
foreach (f; aliasSeqOf!fields)
{
/* ... loop body as you have it ... */
}
On Wednesday, 15 March 2017 at 17:27:35 UTC, ag0aep6g wrote:
Phobos has it: std.meta.aliasSeqOf "converts an input range
[...] to an
alias sequence." [1]
Woops, forgot to give the URL for that "[1]". Here it is:
http://dlang.org/phobos/std_meta.html#aliasSeqOf
Hello, I have a similar
On Saturday, 8 April 2017 at 17:57:11 UTC, Vladimir Panteleev
wrote:
Yes; in my opinion, I think that's desirable because it is
aligned with the unidirectional flow of information from
higher-level components to lower-level ones, and does not
impose a particular configuration framework onto
On Saturday, 8 April 2017 at 13:09:59 UTC, Vladimir Panteleev
wrote:
On Saturday, 8 April 2017 at 10:11:11 UTC, Boris-Barboris wrote:
2). After preprocessing I wish to have fully-typed, safe and
fast Config class, that contains all the groups I defined for
it in it's body, and not as
Hello! It's a bit long one, I guess, but I'd like to have some
discussion of topic. I'll start with a concrete use case:
For the sake of entertainment, I tried to wrote generic
configuration management class. I was inspired by oslo_config
python package that I have to deal with on work. I
64 matches
Mail list logo