On Monday, 12 January 2015 at 13:37:19 UTC, ref2401 wrote:
Thanks for the links.
I have shared class instance. There are two threads which can
read/write fields of the class. As i understand i can declare
class as synchronized or i can read/write using
atomicLoad/atomicStore.
What's the
On 1/12/15 8:59 AM, Laeeth Isharc wrote:
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln(%s,b);
}
how do i get the time as a binary representation I can write to a file?
You can always
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln(%s,b);
}
how do i get the time as a binary representation I can write to a
file?
Thanks.
Thanks for the links.
I have shared class instance. There are two threads which can
read/write fields of the class. As i understand i can declare
class as synchronized or i can read/write using
atomicLoad/atomicStore.
What's the difference between these two approaches?
In what circumstances
V Mon, 12 Jan 2015 13:59:27 +
Laeeth Isharc via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com napsáno:
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln(%s,b);
}
Thanks for the help to everyone. It seems a common thing to want
to check an array as one may not know the variables at compile
time. Not that it's more than a few lines to do in D. But in
terms of language adoption, small frictions can have large
consequences over time. (Modern people
Laeeth.
Thanks for the reply. Yes, this concerns my HDF5 wrapper
project; the main concern is not that the memory consumption of
course, but rather explicitly controlling lifetimes of the
objects (especially objects like files -- so you are can be
sure there are no zombie handles floating
On Mon, 12 Jan 2015 16:32:30 +
Oleg via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote:
Why are you using ref? Take that off and you can pass any
array, including null, with ease.
Because dynamic arrays are
On Monday, 12 January 2015 at 15:51:17 UTC, Oleg wrote:
void foo(ref int[] param1) {}
Why are you using ref? Take that off and you can pass any array,
including null, with ease.
The only difference is changes to length won't be seen outside
the foo function.
On Monday, 12 January 2015 at 15:59:43 UTC, Adam D. Ruppe wrote:
Why are you using ref? Take that off and you can pass any
array, including null, with ease.
Because dynamic arrays are passed by value to functions. Will it
make another copy of array, if I'll pass array by value?
Looks like
I'm new to D. I have some modest knowledge of C++, but am more
familiar with scripting languages (Matlab, Python, R). D seems so
much easier than C++ in a lot of ways (and I just learned about
rdmd today, which is pretty cool). I am concerned about
performance of D vs. C++, so I wanted to
On Mon, 12 Jan 2015 19:29:53 +
jmh530 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
the proper answer is too long to write (it will be more an article that
a forum answer ;-), so i'll just give you some directions:
import std.typecons;
{
auto b = scoped!B(); //
Thanks for the reply, I wasn't familiar with scoped. I was aware
that structs are on the stack and classes are on the heap in D,
but I didn't know it was possible to put a class on the stack.
Might be interesting to see how this is implemented.
After looking up some more C++, I think what I
On Mon, 12 Jan 2015 20:14:19 +
jmh530 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Thanks for the reply, I wasn't familiar with scoped. I was aware
that structs are on the stack and classes are on the heap in D,
but I didn't know it was possible to put a class on the
On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
Digitalmars-d-learn wrote:
it even has `RefCounted!`, but it doesn't play well with
classes yet
(AFAIR).
I wonder if it's possible to somehow make a version of refcounted
that would work with classes (even if limited/restricted in some
On Mon, 12 Jan 2015 21:37:27 +
aldanor via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
Digitalmars-d-learn wrote:
it even has `RefCounted!`, but it doesn't play well with
classes yet
(AFAIR).
I wonder if it's
On Monday, 12 January 2015 at 21:54:51 UTC, ketmar via
Digitalmars-d-learn wrote:
On Mon, 12 Jan 2015 21:37:27 +
aldanor via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
On Monday, 12 January 2015 at 20:30:45 UTC, ketmar via
Digitalmars-d-learn wrote:
it even has
On Monday, 12 January 2015 at 19:29:54 UTC, jmh530 wrote:
I'm new to D. I have some modest knowledge of C++, but am more
familiar with scripting languages (Matlab, Python, R). D seems
so much easier than C++ in a lot of ways (and I just learned
about rdmd today, which is pretty cool). I am
I am trying to play with D, but I'm getting stuck with the DUB
package manager. If use DUB to download a package to my project,
how do I get DUB to add what I downloaded to the dub.json file?
I have tried DUB --fetch --cache=local http-parser (for example).
It downloads the package, but
On Monday, 12 January 2015 at 18:11:35 UTC, bearophile wrote:
D modules can contain lot of stuff, like variables, constants,
enums, types, structs, etc. And you usually put more than one
class in each D module. Also D class names should be
capitalized (like Project).
When I do this, it
I had seen some stuff on alias thing, but I hadn't bothered to
try to understand it until now. If I'm understanding the first
example a href=http://dlang.org/class.html#AliasThis;here/a,
alias this let's you refer to x in s by writing either s.x (as
normally) or just s. That didn't seem that
On 13/01/2015 2:01 p.m., Andrew Grace wrote:
I am trying to play with D, but I'm getting stuck with the DUB package
manager. If use DUB to download a package to my project, how do I get
DUB to add what I downloaded to the dub.json file? I have tried DUB
--fetch --cache=local http-parser (for
Thanks for detail answer. I stopped at error:
source\cpl_vsi.d(70): Error: module stat is in file
'std\c\stat.d' which cannot
be read
I do not know where I can find this module.
If someone wan't to attempt to create binding, or finish my here
is link of my half-done job
On 01/12/2015 10:09 PM, tcak wrote:
It is just making everything dirty.
request.HttpSocketConnectionRequest
connection.HttpSocketConnection
You can name the files the same as their classes:
HttpSocketConnectionRequest.d, etc.
I just want to create a file called
What namespace? D has modules, unlike C++. In general it's a
bad idea to have inside a module a name (like a variable name
or struct name) equal to the module name, because it causes
confusion.
I am confused as well.
core.stdc.errno
@property int errno() { return getErrno(); }
@property int
On Tuesday, 13 January 2015 at 05:18:46 UTC, Ali Çehreli wrote:
On 01/12/2015 08:22 PM, tcak wrote:
What namespace? D has modules, unlike C++. In general it's a
bad idea
to have inside a module a name (like a variable name or
struct name)
equal to the module name, because it causes confusion.
On 01/12/2015 08:22 PM, tcak wrote:
What namespace? D has modules, unlike C++. In general it's a bad idea
to have inside a module a name (like a variable name or struct name)
equal to the module name, because it causes confusion.
I am confused as well.
core.stdc.errno
@property int
Somewhat related to
https://github.com/D-Programming-Language/phobos/pull/2024
I wonder about the soundness of `map` in
```D
import std.algorithm, std.range, std.stdio;
void main(string[] args)
{
long[] arr;
const n = 3;
iota(n).map!(a = arr ~= a);
writeln(arr);
Hello. How can I call a function with null as parameter, which I
don't want to set. For example:
void foo(ref int[] param1) {}
I can't call this function like:
foo(null);
Is it possible to set default value for an array parameter or
pass null/empty array? I can create empty array and pass it,
tcak:
One way I achieved it, though I cannot put namespace on it.
file: project.d
==
module project;
class project{}
D modules can contain lot of stuff, like variables, constants,
enums, types, structs, etc. And you usually put more than one
class in each D module. Also D
On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via
Digitalmars-d-learn wrote:
nope, it means exactly what is written there. except that
dynamic array
is represented by struct like this:
struct {
void *dataptr;
size_t itemCount;
}
this is what D calls dynamic array, and this is
On Mon, 12 Jan 2015 16:53:59 +
Oleg via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Monday, 12 January 2015 at 16:44:42 UTC, ketmar via
Digitalmars-d-learn wrote:
nope, it means exactly what is written there. except that
dynamic array
is represented by struct
On Monday, January 12, 2015 13:59:27 Laeeth Isharc via Digitalmars-d-learn
wrote:
import std.datetime;
import std.stdio;
import std.conv;
void main(string[] arg)
{
auto a=Clock.currTime();
auto b=cast(ubyte[])a;
writefln(%s,b);
}
how do i get the time as a binary representation
In java, if I create a file, the class that is defined in it must
have the same name of file. So, with the file name, I can relate
to class directly. Is there any way to achieve this in D?
One way I achieved it, though I cannot put namespace on it.
file: project.d
==
module
On Monday, 12 January 2015 at 16:32:31 UTC, Oleg wrote:
Because dynamic arrays are passed by value to functions. Will
it make another copy of array, if I'll pass array by value?
It is important to think of the underlying representation with a
pointer and length passed by value. Since it is a
35 matches
Mail list logo