Hello,
I'm trying to hand write some bindings to mongo-c-driver. (For
learning purposes and to get the latest bindings).
My binding code to convert to mongoc/mongoc.d
is:
= c interop file
module mongoc/mongoc.d;
import core.stdc.stdint;
extern (c) {
struct {
uint domain;
On 29.06.20 02:28, Stanislav Blinov wrote:
void local(Args...)(Args args)
{
}
void main() @safe
{
import std.stdio;
scope int* p;
local(p); // Ok
writeln(p); // Error: scope variable p assigned to non-scope
parameter _param_0 calling std.stdio.writeln!(int*).writeln
}
Th
I'm doing this in an X11 application in order to send a timer
event every 100 milliseconds to the main event queue.
class Application
{
shared private bool s_tick;
void clock_task (shared X11.Display* disp, X11.Atom atom,
X11.Window win)
{
for (;;)
{
try
{
re
On 6/28/20 4:08 PM, aberba wrote:
So I checked receiveTimeout() when I was looking for what I could use. I
wish there was an example in the docs.
https://dlang.org/library/std/concurrency/receive_timeout.html
I have an example of it:
http://ddili.org/ders/d.en/concurrency.html#ix_concurre
On Monday, 29 June 2020 at 02:11:15 UTC, NonNull wrote:
Deprecation: Cannot use alias this to partially initialize
variable j of type refer. Use j._()
This is for the line j=3
What is this about? Where does this hidden rule come from?
That one comes from [1]. But there are quite a few more
On Sunday, 28 June 2020 at 21:01:36 UTC, NonNull wrote:
On Sunday, 28 June 2020 at 20:59:59 UTC, NonNull wrote:
Using gdc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Please criticize:
struct refer(T) {
T* ptr;
this(ref T x) { ptr = &x; }
ref T _() { return *ptr; }
alias _ this;
string toStrin
void local(Args...)(Args args)
{
}
void main() @safe
{
import std.stdio;
scope int* p;
local(p); // Ok
writeln(p); // Error: scope variable p assigned to non-scope
parameter _param_0 calling std.stdio.writeln!(int*).writeln
}
The signatures of `std.stdio.writeln` and `local`
On Sunday, 28 June 2020 at 23:39:07 UTC, Stanislav Blinov wrote:
On Sunday, 28 June 2020 at 23:02:26 UTC, aberba wrote:
I believe this:
StopWatch sw;
sw.start;
works becuse D structs are initialized by default, right?
I've never actually done it this way. Little details.
Yup. You can also d
On Sunday, 28 June 2020 at 23:02:26 UTC, aberba wrote:
I believe this:
StopWatch sw;
sw.start;
works becuse D structs are initialized by default, right?
I've never actually done it this way. Little details.
Yup. You can also do a
auto sw = StopWatch(AutoStart.yes);
and not have to call `st
On Sunday, 28 June 2020 at 23:02:26 UTC, aberba wrote:
On Sunday, 28 June 2020 at 14:23:01 UTC, Stanislav Blinov wrote:
On Sunday, 28 June 2020 at 13:29:08 UTC, aberba wrote:
Thanks.
I believe this:
StopWatch sw;
sw.start;
works becuse D structs are initialized by default, right?
I've neve
On Sunday, 28 June 2020 at 14:23:01 UTC, Stanislav Blinov wrote:
On Sunday, 28 June 2020 at 13:29:08 UTC, aberba wrote:
Thanks.
I believe this:
StopWatch sw;
sw.start;
works becuse D structs are initialized by default, right?
I've never actually done it this way. Little details.
To keep this reply brief, I'll just summarize:
Lots of great takeaways from both of your posts, and a handful of
topics you mentioned that I need to dig into further now. This is
great (I too like D :)
I very much appreciate the extra insight into how things work and
why certain design decis
On Sunday, 28 June 2020 at 20:59:59 UTC, NonNull wrote:
Using gdc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Please criticize:
struct refer(T) {
T* ptr;
this(ref T x) { ptr = &x; }
ref T _() { return *ptr; }
alias _ this;
string toString() { import std.conv; return to!string(*ptr);
}
}
Th
Using gdc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Please criticize:
struct refer(T) {
T* ptr;
this(ref T x) { ptr = &x; }
ref T _() { return *ptr; }
alias _ this;
string toString() { import std.conv; return to!string(*ptr); }
}
This will make a reference variable (simulation). [ toString(
On 6/28/20 9:07 AM, Denis wrote:
> * foreach is the actual iterator,
Yes. foreach is "lowered" to the following equivalent:
for ( ; !range.empty; range.popFront()) {
// Use range.front here
}
A struct can support foreach iteration through its opCall() member
function as well. opCall()
On Sunday, 28 June 2020 at 16:39:12 UTC, Anonymouse wrote:
On Sunday, 28 June 2020 at 16:11:50 UTC, BakedPineapple wrote:
import std.stdio;
import std.concurrency;
void main()
{
auto t = spawn((){
receive((shared const(char)[] char_arr) {
ownerTid
On Sunday, 28 June 2020 at 16:11:50 UTC, BakedPineapple wrote:
import std.stdio;
import std.concurrency;
void main()
{
auto t = spawn((){
receive((shared const(char)[] char_arr) {
ownerTid.send(true);
});
});
shared
import std.stdio;
import std.concurrency;
void main()
{
auto t = spawn((){
receive((shared const(char)[] char_arr) {
ownerTid.send(true);
});
});
shared const(char)[] char_arr = "cut my code into pieces";
t.se
Many thanks: your post has helped me get past the initial
stumbling blocks I was struggling with. I do have a followup
question.
First, here are my conclusions up to this point, based on your
post above, some additional experimentation, and further research
(for future reference, and for any
On Monday, 22 June 2020 at 23:53:41 UTC, Stanislav Blinov wrote:
tempDir just returns a path (i.e. "/tmp" or whatever it is on
Windows, etc.), it doesn't create anything.
Given the synopsis of std.file, a procedure for *creating* a
file doesn't belong there, as it would only be half of an
ope
On Sunday, 28 June 2020 at 13:29:08 UTC, aberba wrote:
Getting error:
Error: template std.concurrency.spawn cannot deduce function
from argument types !()(void delegate(Tid id) @system, Tid),
candidates are:
/usr/include/dmd/phobos/std/concurrency.d(460,5):
spawn(F, T...)(F fn, T args
Trying to implement a setInterval() that I can cancel using:
Tid tid = setInterval(2000, (){ writeln("hello");})
And then I can do:
stopInterval(tid);
With something like this:
stopInterval(Tid tid) {
send(tid, "cancel");
}
import std.stdio : writeln;
import std.concurrency : receive, s
On Sunday, 28 June 2020 at 05:13:32 UTC, Mike Parker wrote:
On Sunday, 28 June 2020 at 04:59:12 UTC, Kirill wrote:
something.d:
module something;
int add(int a, int b);
This should be extern(C) int add(int a, int b). The extern(C)
tells the D compiler to use the standard C calling convention
On Sunday, 28 June 2020 at 07:09:53 UTC, Виталий Фадеев wrote:
I want light-weight runtime !
How to ?
If you have access to Google translate or any equivalent tool,
you may use it to write in Russian language and copy+paste the
English here. I think that'll really help.
I always give deep
Is there a release schedule anywhere for DMD? Any list of tasks
to be the next release? I'm only finding 5+ year old things when
searching.
I want light-weight runtime !
How to ?
26 matches
Mail list logo