On Friday, January 02, 2015 08:31:11 Steven Schveighoffer via
Digitalmars-d-learn wrote:
On 1/2/15 6:21 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
The main places that code is likely to use DateTime is if it needs to
operate on dates and times separately from any connection to the
On Friday, 2 January 2015 at 14:50:54 UTC, Suliman wrote:
Anything declared in main() is local to main and not a global.
Ok! So I need create multiple instances of the parseconfig?
Or please suggest me any solution, I really can't understand
how to be in such situation...
Have you ever
I think it's fine to have a global config instance.
Alternatively you can pass the config to both the
seismoDownlead and MySqlWhatever classes.
// there ist enforce(cond, msg) for this in
std.exception/std.conv, dunno.
if (!exists(confpath)) throw new Exception(ERROR: config.ini
do not
I'm currently trying around with vibe.d and I'm confused about the
MongoDB example:
import vibe.d;
MongoClient client;
void test()
{
auto coll = client.getCollection(test.collection);
foreach (doc; coll.find([name: Peter]))
logInfo(Found entry: %s,
On Friday, 2 January 2015 at 15:33:06 UTC, Suliman wrote:
Thanks! I will try!
D is my first compilable language, I wrote only some scripts
without OO before.
So in my case your suggestion is best practice? Or there is any
more simple way to pass config and data to MySQL class?
I think it's
On Friday, 2 January 2015 at 11:21:08 UTC, Suliman wrote:
I looked at my code and it's seems that I can create instance
of MySQL in main.
void main()
{
auto parseconfig = new parseConfig();
auto mysql = new MySQL(parseconfig, seismodownload);
}
In parseConfig I am creation instance of
class parseConfig
{
string dbname;
string dbuser;
string dbpass;
string dbhost;
string dbport;
uint status;
this()
{
auto checkLinkCode(string link) // we need to check all links to
be sure if they are alive
{
return
Thanks! I will try!
D is my first compilable language, I wrote only some scripts
without OO before.
So in my case your suggestion is best practice? Or there is any
more simple way to pass config and data to MySQL class?
Anything declared in main() is local to main and not a global.
Ok! So I need create multiple instances of the parseconfig?
Or please suggest me any solution, I really can't understand how
to be in such situation...
ketmar via Digitalmars-d-learn wrote:
On Sat, 03 Jan 2015 14:45:24 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Well, I just cleared up some of my misunderstanding.
I did not realise the mA (within struct Test) would be a _copy_ of arg,
not a reference
On Sat, 03 Jan 2015 14:45:24 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Well, I just cleared up some of my misunderstanding.
I did not realise the mA (within struct Test) would be a _copy_ of arg, not
a reference (pointer) to arg.
So the more correct code
Hi,
thanks for the reply...to answer your direct question, the original code
looked like:
struct A
{
int someInt;
}
struct Test
{
@property { const(A) getA() { return mA; } }
this( ref const(A) arg )
{
mA = arg;
}
private:
A mA;
}
void main()
{
Test
ketmar via Digitalmars-d-learn wrote:
On Sat, 03 Jan 2015 15:56:58 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Ironically, I'm trying to use const in an effort to understand it...but
there seems to be an unusual amount of pain until I grok it.
just remember
Well, I just cleared up some of my misunderstanding.
I did not realise the mA (within struct Test) would be a _copy_ of arg, not
a reference (pointer) to arg.
So the more correct code snippet would be:
struct A
{
int someInt;
}
struct Test
{
@property { const(A) getA() { return *mA;
On Sat, 03 Jan 2015 15:56:58 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
Ironically, I'm trying to use const in an effort to understand it...but
there seems to be an unusual amount of pain until I grok it.
just remember that `const` infects everything down to the
On Sat, 03 Jan 2015 16:40:14 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I'm now taking the view that const is there for the compiler to optimise
code on the basis that nothing can alter it once set (and can only be set
on initialisation). So I see your point
On Sat, 03 Jan 2015 14:45:24 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
p.s. also please note that structs in D are always passed by value and
copied (until you not explicitly ask for something another). so:
MyStruct a;
MyStruct b;
b = a;
actually does
On Friday, 2 January 2015 at 23:26:57 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
On Friday, January 02, 2015 19:47:50 John Colvin via
Digitalmars-d-learn wrote:
On Friday, 2 January 2015 at 13:14:14 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Objects in D default to being
On Sat, 03 Jan 2015 13:25:31 +1030
ted via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I get the following error from the code below: (dmd2.066.1, linux)
test.d(26): Error: cannot modify struct myTest1 Test with immutable members
Is this expected?
If so, how can I
On Friday, January 02, 2015 19:47:50 John Colvin via Digitalmars-d-learn wrote:
On Friday, 2 January 2015 at 13:14:14 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Objects in D default to being thread-local. __gshared and
shared both make
it so that they're not thread-local.
On Friday, 2 January 2015 at 23:51:05 UTC, John Colvin wrote:
The rule (in C(++) at least) is that all data is assumed to be
visible and mutable from multiple other threads unless proved
otherwise. However, given that you do not write a race, the
compiler will provide full sequential
On Friday, January 02, 2015 15:32:51 Steven Schveighoffer via
Digitalmars-d-learn wrote:
In fact the
only useful aspect of shared is that data not marked as shared is
guaranteed thread local.
That and the fact that you're supposed to be able to know which portions of
your program are
On Friday, 2 January 2015 at 22:10:36 UTC, Ola Fosheim Grøstad
wrote:
On Friday, 2 January 2015 at 21:06:03 UTC, John Colvin wrote:
Hmm. I went in to writing that thinking shared isn't so bad.
Now I've thought about it, it is pretty damn useless. What's
the point of knowing that data is shared
On Friday, January 02, 2015 23:51:04 John Colvin via Digitalmars-d-learn wrote:
AFAIK, the only data in D that the compiler is allowed to assume
to be thread-local is data that it can prove is thread-local. The
trivial case is TLS, which is thread-local by definition.
In D, if a type is not
On Friday, 2 January 2015 at 23:10:46 UTC, John Colvin wrote:
What significant optimisations does SC-DRF actually prevent?
By SC-DRF I assume you mean the Java memory model. AFAIK SCDRF
just means that if you syncronize correctly (manually) then you
will get sequential consistency
I get the following error from the code below: (dmd2.066.1, linux)
test.d(26): Error: cannot modify struct myTest1 Test with immutable members
Is this expected?
If so, how can I achieve this result - being able to set (a new) initial value
of myTest1 from within an nested function ?
thanks !
On Friday, 2 January 2015 at 20:32:51 UTC, Steven Schveighoffer
wrote:
On 1/2/15 2:47 PM, John Colvin wrote:
Are you sure about all this optimisation stuff? I had (perhaps
wrongly)
assumed that __gshared and shared variables in D guaranteed
Sequential
Consistency for Data Race Free (SCDRF)
On Friday, 2 January 2015 at 13:14:14 UTC, Jonathan M Davis via
Digitalmars-d-learn wrote:
Objects in D default to being thread-local. __gshared and
shared both make
it so that they're not thread-local. __gshared does it without
actually
changing the type, making it easier to use but also
Am 02.01.2015 um 19:45 schrieb Vlad Levenfeld:
My personal favorite method is to use the primitives in core.atomic with
a double or triple buffer. To double buffer, keep two buffers in an
array (data[][] or something) and an integer index that points to the
active buffer, then use atomicStore
On Friday, 2 January 2015 at 17:39:19 UTC, Matt wrote:
I'm trying to write a small 3D engine, and wanted to place the
physics in a separate thread to the graphics, using events,
possibly std.concurrency, to communicate between them.
How, then, do I pass large amounts of data between threads?
On 1/2/15 2:47 PM, John Colvin wrote:
Are you sure about all this optimisation stuff? I had (perhaps wrongly)
assumed that __gshared and shared variables in D guaranteed Sequential
Consistency for Data Race Free (SCDRF) and nothing more, just like all
normal variables in C, C++ and Java.
On Friday, 2 January 2015 at 21:06:03 UTC, John Colvin wrote:
Hmm. I went in to writing that thinking shared isn't so bad.
Now I've thought about it, it is pretty damn useless. What's
the point of knowing that data is shared without knowing how to
safely use it? I guess it protects against
I'm trying to write a small 3D engine, and wanted to place the
physics in a separate thread to the graphics, using events,
possibly std.concurrency, to communicate between them.
How, then, do I pass large amounts of data between threads? I'm
thinking the physics world state (matrix for each
Is it possible to get dub to build vibe.d into a dynamic library?
Or is it at least possible to make dub link against the shared version
of phobos?
I found this blog post about dynamic linktimes, unfortunately it does
not describe how to actually make dub use the dynamic version of phobos.
Oh mama mia! I did it!
http://www.everfall.com/paste/id.php?a5pp73ns1e4k
auto seismodownload = new seismoDownload(emsc_csem, this);
then:
auto mysql = new MySQL(parseconfig,eqs);
So could anybody show me better way? As I said I did not fully
understand how use global class instance...
On Friday, January 02, 2015 11:47:46 Daniel Kozak via Digitalmars-d-learn wrote:
I always think that shared should be use to make variable global
across threads (similar to __gshared) with some synchronize
protection. But this code doesn't work (app is stuck on _aaGetX
or _aaRehash ):
shared
On 1/1/15 7:32 AM, Idan Arye wrote:
If I have an associative array and I only modify it's values, without
changing the keys, can I assume that the order won't change?
I would never make that assumption. An AA is free to rehash at any time,
for whatever reason.
What I would say is that you
On 1/2/15 6:21 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
The main places that code is likely to use DateTime is if it needs to
operate on dates and times separately from any connection to the system's
time or time zones and when you want to get the separate pieces of the
date and time
On Wednesday, December 31, 2014 19:07:13 bitwise via Digitalmars-d-learn wrote:
Why do you need DateTime and not SysTime?
I'm actually surprised it doesn't have that too...
-Steve
Initially I was looking for something that would be the
equivalent to DateTime in C#. This now appears to
On Friday, 2 January 2015 at 11:47:47 UTC, Daniel Kozak wrote:
I always think that shared should be use to make variable
global across threads (similar to __gshared) with some
synchronize protection. But this code doesn't work (app is
stuck on _aaGetX or _aaRehash ):
But when I add
On Thursday, 1 January 2015 at 18:58:04 UTC, Andrej Mitrovic via
Digitalmars-d-learn wrote:
On 1/1/15, Tobias Pankrath via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
You could implement an OrderedMap!(Key, Value) via
RedBlackTree!(Tuple!(Key, Value), (a,b) = a[0] b[0]).
We
I always think that shared should be use to make variable global
across threads (similar to __gshared) with some synchronize
protection. But this code doesn't work (app is stuck on _aaGetX
or _aaRehash ):
shared double[size_t] logsA;
void main() {
auto logs = new double[1_000_000];
On Fri, 02 Jan 2015 10:40:22 +
novice2 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
Thanx Daniel, thanx Ketmar.
I just thinked that this is some sort of bug.
May be DMD should not change mangled name of external function...
Bit i dont know.
with `extern(C)` it
I looked at my code and it's seems that I can create instance of
MySQL in main.
void main()
{
auto parseconfig = new parseConfig();
auto mysql = new MySQL(parseconfig, seismodownload);
}
In parseConfig I am creation instance of seismoDownload:
class parseConfig
{
if
What I am doing wrong?
http://www.everfall.com/paste/id.php?iwh4qdcqv6zi
Well, there's no `parseconfig` there. Do you expect the
`parseconfig` from line 30 or line 193 to be available in line
170?
From line 30.
In line 193 I am get in instance of class instance of parseconfig
to be able
Thanx Daniel, thanx Ketmar.
I just thinked that this is some sort of bug.
May be DMD should not change mangled name of external function...
Bit i dont know.
46 matches
Mail list logo