On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote:
On Tuesday, 22 October 2019 at 07:23:46 UTC, Daniel Kozak wrote:
On Tue, Oct 22, 2019 at 8:00 AM Prokop Hapala via
Digitalmars-d-learn wrote:
I'm examining the possibility to move from Python+C/C++ to D
or
Python+D. I read
(h
On Tuesday, 22 October 2019 at 07:51:16 UTC, Arun Chandrasekaran
wrote:
On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala
wrote:
[...]
If you are building individual files, use ldc2 with
--link-defaultlib-shared flag:
arun@home-pc:/tmp$ cat a.d
void main() { import std; writeln("Ha
On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran
wrote:
Hi all,
I am new to D. But some fair experience with vb.net. I was
playing with D classes. I wrote a class in a D file.
The file name is "classFile.d"
```D
class TestClass {
[...]
What you are seeing is a linker error. Bui
On Monday, 11 November 2019 at 01:28:54 UTC, userTY wrote:
On Sunday, 10 November 2019 at 23:53:22 UTC, Vinod K Chandran
wrote:
[...]
You must use a module that has public imports.
Public imports are visible from the module that contain them
but most importantly from the module that imports t
On Saturday, 25 April 2020 at 04:11:02 UTC, Ali Çehreli wrote:
On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20
4:24 PM, matheus wrote:
> whomever controlled the sociomantic youtube account took down
> all the videos.
I think it's unintentional because the same thing happened to
my
So I was telling my colleague that D would warn on self
assignment, but found that I was wrong.
https://run.dlang.io/is/HLhtek
```
module a;
import std.stdio;
void main() {
string a;
a = a; // Can the compiler warn at this line that
there is no effect?
writeln(a);
r
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions
wrote:
Trying to curl basic stuff but std.net.curl isn't cooperating:
This is one of the reasons I hate D ;/ I've spent more time
trying to get std.net.curl to do something that just works from
the command line.
std.net.curl is not
On Wednesday, 9 May 2018 at 15:20:12 UTC, Jonathan M Davis wrote:
On Wednesday, May 09, 2018 14:12:41 Dmitry Olshansky via
Digitalmars-d-learn wrote:
[...]
To an extent that's true, but anyone providing a library for
use by others in the D community should seriously consider
following it wit
On Sunday, 2 September 2018 at 12:52:11 UTC, Russel Winder wrote:
I am rewriting a C++ program in D, but need to access a C
library that has no D binding: this is a GtkD based program
which has a Pango binding, but Pango doesn't offer the
information I need, that is hidden in the underlying Fon
On Thursday, 6 September 2018 at 16:13:42 UTC, hridyansh thakur
wrote:
how to read a file line by line in D
std.stdio.File.byLine()
Refer the doc here:
https://dlang.org/library/std/stdio/file.by_line.html
An example from the doc:
```
import std.algorithm, std.stdio, std.string;
// Count w
I'm trying to get the current function name and apparently the
commented line errors out.
What am I doing wrong?
https://run.dlang.io/is/EGsRU2
```
#!/usr/bin/rdmd
void main()
{
import std.experimental.all;
void foo() {
// __traits(identifier, mixin(__FUNCTION__)).writeln; //
I'm trying to find the needle in the hay that's an array of
strings. So the second assert fails for some reason. Is this
expected? https://run.dlang.io/is/7OrZTA
```
#!/usr/bin/rdmd
void main()
{
import std.experimental.all;
string s1 = "aaa111aaa";
string s2 = "aaa222aaa";
str
On Friday, 7 December 2018 at 18:57:48 UTC, Dennis wrote:
On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran
wrote:
Why is there a difference in the behavior?
Your first assert expression is looking for a string in a
larger string, your second expression looks for hay which is
n
On Friday, 7 December 2018 at 19:08:05 UTC, Arun Chandrasekaran
wrote:
On Friday, 7 December 2018 at 18:57:48 UTC, Dennis wrote:
On Friday, 7 December 2018 at 18:51:27 UTC, Arun
Chandrasekaran wrote:
Why is there a difference in the behavior?
Your first assert expression is looking for a stri
On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote:
On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran
wrote:
I'm trying to find the needle in the hay that's an array of
strings. So the second assert fails for some reason. Is this
expected? https://run.dlang.io/is/7OrZTA
```
#
On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote:
On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran
wrote:
I'm trying to find the needle in the hay that's an array of
strings. So the second assert fails for some reason. Is this
expected? https://run.dlang.io/is/7OrZTA
```
#
On Friday, 7 December 2018 at 20:28:37 UTC, Seb wrote:
On Friday, 7 December 2018 at 19:38:29 UTC, Arun Chandrasekaran
wrote:
On Friday, 7 December 2018 at 19:12:31 UTC, Seb wrote:
On Friday, 7 December 2018 at 18:51:27 UTC, Arun
Chandrasekaran wrote:
[...]
Alternatively to the answers above
On Sunday, 9 December 2018 at 03:29:27 UTC, Andrew Pennebaker
wrote:
On Monday, 3 November 2008 at 12:29:16 UTC, Simen Kjaeraas
wrote:
On Mon, 03 Nov 2008 12:33:05 +0100, Denis Koroskin
<2kor...@gmail.com> wrote:
[...]
That's not the only error here. Your template function also
calls
foo w
A typical example would be to split the HTTP query string into an
AA.
vibe.d has req.queryString, but no convenient wrapper to access
it as an AA.
http://localhost/hello?name=abc&id=123
I've got this far.
auto arr = req.queryString.splitter('&').map!(a =>
a.splitter('='));
Thanks
On Friday, 8 February 2019 at 04:13:39 UTC, Sudhi wrote:
I have a situation, where i want to modify a shared variable in
a function. Something like below
struct Company
{
string name;
string location;
}
struct Racks
{
int number;
int location;
}
struct Metadata
{
string na
On Friday, 8 February 2019 at 04:51:08 UTC, Sudhi wrote:
On Friday, 8 February 2019 at 04:30:23 UTC, Arun Chandrasekaran
wrote:
[...]
My example code was wrong. Below is the right one.
struct Company
{
string name;
string location;
}
struct Racks
{
int number;
int location;
What am I doing wrong here?
struct A
{
union B
{
int bb;
}
B b;
alias aa = B.bb;
}
void main()
{
A a = A();
// a.b.bb = 4; // works
a.aa = 4; // fails
}
https://run.dlang.io/is/kXaVy2
On Monday, 22 April 2019 at 14:07:11 UTC, Alex wrote:
On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran
wrote:
What am I doing wrong here?
struct A
{
union B
{
int bb;
}
B b;
alias aa = b.bb;
}
void main()
{
A a = A();
// a.b.bb = 4; // works
On Monday, 22 April 2019 at 11:04:49 UTC, dangbinghoo wrote:
hi all,
as now we don't have the net/if.h binding, I need to do struct
ifreq binding myself, here's my code:
[...]
Looks like we both were working on the same thing, few hours
apart.
https://forum.dlang.org/post/nkbnknlgmcwaivpp
On Monday, 22 April 2019 at 19:57:11 UTC, aliak wrote:
On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran
wrote:
What am I doing wrong here?
struct A
{
union B
{
int bb;
}
B b;
alias aa = B.bb;
}
void main()
{
A a = A();
// a.b.bb = 4; // works
On Sat, Apr 27, 2019 at 2:55 AM Andre Pany via Digitalmars-d-learn
wrote:
>
> On Thursday, 25 April 2019 at 10:33:00 UTC, Vladimirs Nordholm
> wrote:
> > Hello.
> >
> > Is there a current "Best Practices" for logging in D?
> >
> > For the actual logging, I know of `std.experimental.logger`.
> > Ho
On Wed, May 1, 2019 at 8:15 AM Guillaume Piolat via
Digitalmars-d-learn wrote:
>
> On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote:
> >
> > Second question. Lots of people these days start to program to
> > solve their problems at work but they may never have been shown
> > the basi
On Wed, May 1, 2019 at 9:18 AM Arun Chandrasekaran wrote:
>
> On Wed, May 1, 2019 at 8:15 AM Guillaume Piolat via
> Digitalmars-d-learn wrote:
> >
> > On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote:
> > >
> > > Second question. Lots of people these days start to program to
> > > s
On Wed, May 1, 2019 at 7:50 PM Anonymouse via Digitalmars-d-learn
wrote:
>
> Is there a way of setting the process/thread name that's neater
> than this?
>
> import core.sys.posix.pthread;
>
> extern(C) int pthread_setname_np(pthread_t, const char*);
>
> void main()
> {
> import std.string :
I've modified the sample from tour.dlang.org to calculate the md5
digest of the files in a directory using std.parallelism.
When I run this on a dir with huge number of files, I get:
core.exception.OutOfMemoryError@src/core/exception.d(696): Memory
allocation failed
Since dirEntries returns
On Friday, 11 August 2017 at 21:33:51 UTC, Arun Chandrasekaran
wrote:
I've modified the sample from tour.dlang.org to calculate the
[...]
RHEL 7.2 64 bit
dmd v2.075.0
ldc 1.1.0
On Friday, 11 August 2017 at 21:58:20 UTC, Johnson wrote:
Just a thought, maybe the GC isn't cleaning up quick enough?
You are allocating and md5 digest each iteration.
Possibly, an opitimization is use use a collection of md5
hashes and reuse them. e.g., pre-allocate 100(you probably only
ne
On Wednesday, 27 September 2017 at 14:34:06 UTC, Eugene Wissner
wrote:
On Wednesday, 27 September 2017 at 14:23:01 UTC, Ky-Anh Huynh
wrote:
See also the following chapter in Ali's book:
http://ddili.org/ders/d.en/templates.html
This chapter is what hooked me with D. Naming that chapter as
On Monday, 16 October 2017 at 03:49:18 UTC, ketmar wrote:
Michael V. Franklin wrote:
[...]
judging from my several decades of expirience, bounties almost
never works. there are alot of reasons for that, but the fact
still stands: it is *almost* impossible to make something
happen with boun
I've written a simple tool [1] to find the DET and CMC
specifically for biometrics performance measurement.
When I generate the report, I expected to see high precision
floating point numbers, but I see that writefln trims the
precision to the last 6 digits after decimal point.
Am I doing th
On Monday, 23 October 2017 at 14:07:06 UTC, Arun Chandrasekaran
wrote:
I've written a simple tool [1] to find the DET and CMC
specifically for biometrics performance measurement.
When I generate the report, I expected to see high precision
floating point numbers, but I see that writefln trims
On Monday, 23 October 2017 at 18:08:43 UTC, Ali Çehreli wrote:
On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote:
> [...]
The rule is that every expression has a type and 22/7 is int.
Thanks Ali. Is this for backward compatibility with C? Because,
if there is a division, a natural/mathematical
On Tuesday, 24 October 2017 at 16:18:03 UTC, H. S. Teoh wrote:
On Tue, Oct 24, 2017 at 10:02:11AM +, Arun Chandrasekaran
via Digitalmars-d-learn wrote:
On Monday, 23 October 2017 at 18:08:43 UTC, Ali Çehreli wrote:
> On 10/23/2017 07:22 AM, Arun Chandrasekaran wrote:
> > [...]
>
CSV with empty values for integer fields throws
(Row: 1, Col: 3) Unexpected end of input when converting from
type string to type int
Code that parses the CSV:
```
import std.algorithm;
import std.array;
import std.csv;
import std.stdio;
import std.conv;
import std.range;
private struct Iden
On Sunday, 29 October 2017 at 15:45:23 UTC, Jesse Phillips wrote:
Not really you'll need to parse it out as a string and do the
conversion later.
It probably would be good to support nullable!int pretty sure
it doesn't currently.
Should I raise a ticket on Bugzilla to address this?
On Wednesday, 29 November 2017 at 17:26:11 UTC, Nick Treleaven
wrote:
Here's a list of significant things - maybe incomplete:
https://wiki.dlang.org/Differences_With_TDPL
Multiple alias this
You can only have one subtyping member currently.
Shared
Not all of shared's guarantees are implemen
Git CLI is arcane and esoteric. I've lost my commits before
(yeah, my mistake). Since then I always access git via mercurial.
In comparison Mercurial is far better a VCS tool.
On Sunday, 3 December 2017 at 23:39:49 UTC, Basile B. wrote:
On Sunday, 3 December 2017 at 22:22:47 UTC, Arun Chandrasekaran
wrote:
Git CLI is arcane and esoteric. I've lost my commits before
(yeah, my mistake).
Who hasn't ;)
Happened to me last time because i tried a command supposed to
remo
On Monday, 4 December 2017 at 01:26:45 UTC, Arun Chandrasekaran
wrote:
On Sunday, 3 December 2017 at 23:39:49 UTC, Basile B. wrote:
[...]
If you still lose changes, you could try using Mercurial with
hggit. It can be a bit slow, but not destructive as git itself.
;)
I really wish Mercurial
I was wondering if std.container.array.Array supports threadsafe
parallel reads similar to std::vector. I've created a small
program for demonstration
https://github.com/carun/parallel-read-tester
It works fine with just couple of problems though:
1. D version takes way too long compared to C
On Friday, 8 December 2017 at 06:37:36 UTC, Adam D. Ruppe wrote:
On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote:
Is there a way to compile a project and deploying it as a
single statically linked binary?
A default build of a D program is *reasonably* compatible. All
its dependenc
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
2. I'm on an 8 CPU box and I don't seem to hit 800% CPU with D
version (max 720%). However I can get 800% CPU usage with the
C++ version.
Please ignore, this is because of the write.
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector. I've created
a small program for demonstration
https://github.com/carun/parallel-read-tester
It works fine with just c
On Friday, 8 December 2017 at 10:01:14 UTC, Kagamin wrote:
On Friday, 8 December 2017 at 07:34:53 UTC, Arun Chandrasekaran
wrote:
I was wondering if std.container.array.Array supports
threadsafe parallel reads similar to std::vector.
No, your code can also fail on a system with inconsistent ca
So I tried the same on Haswell processor with LDC 1.6.0 and it
crashes
```
=== Starting D version ===
Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna
search in parallel...
*** Error in `./dmain-ldc': double free or corruption (fasttop):
0x00edc6e0 ***
*** Error in `./dmain-
Is there a way to get the pointer or reference of an element in
Array(T)?
https://run.dlang.io/gist/70fd499afe8438d4877f57aec90c3091?compiler=dmd
The assertion seems to fail below. Value copy is not is intended
here.
module test;
void main()
{
struct Data
{
int id;
}
On Saturday, 9 December 2017 at 01:34:40 UTC, Arun Chandrasekaran
wrote:
So I tried the same on Haswell processor with LDC 1.6.0 and it
crashes
```
=== Starting D version ===
Took 1 sec, 107 ms, and 383 μs to load 100 items. Gonna
search in parallel...
*** Error in `./dmain-ldc': double fr
On Saturday, 9 December 2017 at 06:38:46 UTC, anonymous wrote:
On Saturday, 9 December 2017 at 06:15:16 UTC, Arun
Chandrasekaran wrote:
Is there a way to get the pointer or reference of an element
in Array(T)?
[...]
auto d2 = gallery[0];
auto d2 = &gallery[0];
Thanks. Just curious why
On Saturday, 9 December 2017 at 19:26:26 UTC, David Nadlinger
wrote:
but "free" references don't exist in the language.
To the point! Thanks!
So dub gets into indefinite loop (let's not argue about
infinite/indefinite).
I've reported the issue a month back here
http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/thread/16888/ and recently here https://github.com/dlang/dub/issues/1345
Does anyone face the same issue? How d
Hi All,
Is there a way to rewrite this
```
import std.parallelism;
auto pool = new TaskPool(options.threadCount);
foreach (_; 0 .. options.iterationCount) {
switch (options.operation) {
case Operation.a:
pool.put(task!a(options));
break;
On Saturday, 27 January 2018 at 10:28:10 UTC, Arun Chandrasekaran
wrote:
Hi All,
Is there a way to rewrite this
[...]
Damn! The subject should've been something else.. naming is
surely hard..
On Saturday, 27 January 2018 at 10:38:25 UTC, Nicholas Wilson
wrote:
On Saturday, 27 January 2018 at 10:28:10 UTC, Arun
Chandrasekaran wrote:
```
import std.parallelism;
auto pool = new TaskPool(options.threadCount);
foreach (_; 0 .. options.iterationCount) {
switch (options.
On Saturday, 27 January 2018 at 10:49:45 UTC, Arun Chandrasekaran
wrote:
On Saturday, 27 January 2018 at 10:38:25 UTC, Nicholas Wilson
wrote:
...
[snip]
Simplified test case that still errors:
```
enum Operation {
a,
b
}
import std.traits;
import std.conv;
void main(string[] args) {
On Saturday, 27 January 2018 at 17:54:53 UTC, thedeemon wrote:
On Saturday, 27 January 2018 at 11:19:37 UTC, Arun
Chandrasekaran wrote:
Simplified test case that still errors:
You got really close here. Here's a working version:
enum Operation {
a,
b
}
import std.traits, std.conv, st
On Sunday, 28 January 2018 at 04:44:23 UTC, thedeemon wrote:
On Saturday, 27 January 2018 at 20:49:43 UTC, Arun
Chandrasekaran wrote:
But really I'm not sure why you want static foreach here
I was just trying to see if static foreach can be used here, but
well, you showed that it's not requi
I was reading through
https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing
There is currently no way in D to mark symbols for internal
linkage, saying "this an implementation detail, you should not
even know this one exists". This is an important module-level
encapsulation
On Thursday, 15 February 2018 at 06:52:15 UTC, Seb wrote:
On Thursday, 15 February 2018 at 06:43:52 UTC, Arun
Chandrasekaran wrote:
I was reading through
https://wiki.dlang.org/Access_specifiers_and_visibility#What_is_missing
[...]
DMD v2.077.1 exhibits the same behavior. Is this is already
On Tuesday, 13 March 2018 at 13:59:00 UTC, Steven Schveighoffer
wrote:
On 3/12/18 10:06 PM, psychoticRabbit wrote:
[...]
OK, so I agree there are drawbacks. But these can be worked
around.
[...]
Private members still have external linkage. Is there anyway to
solve this?
What am I doing wrong here that makes the D equivalent 2.5 times
slower than it's C equivalent?
Compilers used:
LDC2: LDC - the LLVM D compiler (1.8.0)
GCC: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
11:36:39 ~/code/c/test2$ ldc2 sigmoid.d -O5 && ./sigmoid
Max deviation is 0.001664
10^
, 2018 at 8:53 PM, Arun Chandrasekaran via
Digitalmars-d-learn wrote:
[...]
Much better with mir.math.common, still a bit slower than C (even
with larger loops):
10^7 iterations using sigmoid1: 168 ms
10^7 iterations using sigmoid2: 39 ms
Also LDC optimized away the computation. So I had to
On Saturday, 7 April 2018 at 23:48:36 UTC, kinke wrote:
On Saturday, 7 April 2018 at 20:33:13 UTC, Arun Chandrasekaran
wrote:
[...]
As this appears to be benchmarking mostly the
std.math.exp(float) performance - some/many basic algos in
std.math, incl. exp(), are currently using the x87 FPU
I have this trivial code where the main thread clones a child
thread.
import std.stdio;
import core.thread;
import std.concurrency;
class DerivedThread : Thread
{
this()
{
super(&run);
}
void quit()
{
_quit = true;
}
private:
void setOSThreadName()
On Tuesday, 22 December 2015 at 16:08:01 UTC, Dejan Lekic wrote:
Arun, isn't that what the 'name' property is there for?
Hi Dejan,
Thanks for a quick reply.
Setting the name property is not reflecting in the OS level. May
be it is just used only at the object level?
After setting the threa
I am looking for a RESTful framework in D, which can interact
with an existing backend processes (C++) via ZeroMQ and shared
memory. I thought vibe.d might be a viable option. But I
discussed with someone on Freenode #d and found that vibe.d
doesn't support explicit threading [1].
Can someone
On Tuesday, 25 October 2016 at 21:23:21 UTC, Arun Chandrasekaran
wrote:
I am looking for a RESTful framework in D, which can interact
with an existing backend processes (C++) via ZeroMQ and shared
memory. I thought vibe.d might be a viable option. But I
discussed with someone on Freenode #d and
On Tuesday, 17 January 2017 at 08:12:50 UTC, ketmar wrote:
import core.thread;
import core.time;
import std.stdio;
void threadStarter (string path) {
new Thread({
for (;;) {
writeln(path);
Thread.sleep(1.seconds);
}
}).start();
}
class A {
~this () { import core.stdc.
Does phobos offer concurrent containers?
I couldn't find one at http://dlang.org/phobos/std_container.html
Any other in the D land?
Arun
I'm trying to write an RAII wrapper on Linux.
I understand struct in D doesn't have default constructor (for
.init reasons).
I don't want to use `scope`.
Is there an elegant way to achieve this in D?
```
import core.sys.posix.pthread;
import core.sys.posix.sys.types;
/// Makes pthread_mutexa
On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote:
Arun Chandrasekaran wrote:
I'm trying to write an RAII wrapper on Linux.
I understand struct in D doesn't have default constructor (for
.init reasons).
I don't want to use `scope`.
Is there an elegant way to achieve this in D?
why
On Thursday, 23 February 2017 at 21:05:48 UTC, cym13 wrote:
It reminds me of
https://w0rp.com/blog/post/an-raii-constructor-by-another-name-is-just-as-sweet/ which isn't what you want but may be interesting anyway.
It is interesting, indeed, thanks.
76 matches
Mail list logo